Skip to content

Commit

Permalink
Merge pull request #540 from codeforjapan/develop
Browse files Browse the repository at this point in the history
Fix amendable_fields in Decidim::Amendable::AmendButtonCardCell
  • Loading branch information
ayuki-joto authored Jul 1, 2023
2 parents 9803249 + 467c782 commit fd041f5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
39 changes: 39 additions & 0 deletions app/cells/decidim/amendable/amend_button_card_cell.rb
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ ja:
secondary_color: セカンダリ
minutes:
visible: 表示する
activerecord:
attributes:
decidim/proposals/proposal:
title: タイトル
body: 本文
date:
formats:
decidim_short: "%Y/%m/%d"
Expand Down

0 comments on commit fd041f5

Please sign in to comment.