diff --git a/app/cells/decidim/amendable/amend_button_card_cell.rb b/app/cells/decidim/amendable/amend_button_card_cell.rb new file mode 100644 index 000000000..96db1b2c6 --- /dev/null +++ b/app/cells/decidim/amendable/amend_button_card_cell.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Decidim + module Amendable + # This cell renders the button to amend the given resource. + class AmendButtonCardCell < Decidim::ViewModel + delegate :current_user, to: :controller, prefix: false + + def model_name + model.model_name.human + end + + def current_component + model.component + end + + def new_amend_path + decidim.new_amend_path(amendable_gid: model.to_sgid.to_s) + end + + def new_amend_button_label + t("button", scope: "decidim.amendments.amendable", model_name: model_name) + end + + def new_amend_help_text + content_tag :small do + t("help_text", + scope: "decidim.amendments.amendable", + model_name: model_name.downcase, + amendable_fields: model.amendable_fields.map { |field| model.class.human_attribute_name(field) }.to_sentence) + end + end + + def button_classes + "amend_button_card_cell button hollow expanded button--icon button--sc" + end + end + end +end diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 3b274ba10..126e30774 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -34,6 +34,11 @@ ja: secondary_color: セカンダリ minutes: visible: 表示する + activerecord: + attributes: + decidim/proposals/proposal: + title: タイトル + body: 本文 date: formats: decidim_short: "%Y/%m/%d"