Class: Decidim::Amendable::AmendButtonCardCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/amendable/amend_button_card_cell.rb

Overview

This cell renders the button to amend the given resource.

Instance Method Summary collapse

Methods inherited from ViewModel

#call, #current_user

Methods included from MarkupHelper

#element_id

Methods included from ReplaceButtonsHelper

#button_to, #submit_tag

Methods included from Decidim::ActionAuthorizationHelper

#action_authorized_button_to, #action_authorized_link_to, #logged_button_to, #logged_link_to

Methods included from ScopesHelper

#has_visible_scopes?, #scope_name_for_picker, #scopes_picker_field, #scopes_picker_filter, #scopes_picker_tag

Methods included from TranslatableAttributes

#default_locale?

Methods included from DecidimFormHelper

#areas_for_select, #base_error_messages, #decidim_form_for, #decidim_form_slug_url, #editor_field_tag, #form_field_has_error?, #form_required_explanation, #name_with_locale, #scopes_picker_field_tag, #tab_element_class_for, #translated_field_tag

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator, #resource_title

Instance Method Details

#button_classesObject



34
35
36
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 34

def button_classes
  "amend_button_card_cell button hollow expanded button--icon button--sc"
end

#current_componentObject



13
14
15
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 13

def current_component
  model.component
end

#model_nameObject



9
10
11
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 9

def model_name
  model.model_name.human
end

#new_amend_button_labelObject



21
22
23
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 21

def new_amend_button_label
  t("button", scope: "decidim.amendments.amendable", model_name: model_name)
end

#new_amend_help_textObject



25
26
27
28
29
30
31
32
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 25

def new_amend_help_text
   :small do
    t("help_text",
      scope: "decidim.amendments.amendable",
      model_name: model_name.downcase,
      amendable_fields: model.amendable_fields.to_sentence)
  end
end

#new_amend_pathObject



17
18
19
# File 'app/cells/decidim/amendable/amend_button_card_cell.rb', line 17

def new_amend_path
  decidim.new_amend_path(amendable_gid: model.to_sgid.to_s)
end