Class: Decidim::Amendable::PromoteButtonCardCell

Inherits:
ViewModel
  • Object
show all
Defined in:
app/cells/decidim/amendable/promote_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



46
47
48
# File 'app/cells/decidim/amendable/promote_button_card_cell.rb', line 46

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

#current_componentObject



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

def current_component
  model.component
end

#decidimObject



42
43
44
# File 'app/cells/decidim/amendable/promote_button_card_cell.rb', line 42

def decidim
  Decidim::Core::Engine.routes.url_helpers
end

#emendationObject



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

def emendation
  @emendation ||= model
end

#model_nameObject



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

def model_name
  model.model_name.human
end

#promote_amend_button_labelObject



25
26
27
# File 'app/cells/decidim/amendable/promote_button_card_cell.rb', line 25

def promote_amend_button_label
  t("promote_button", scope: "decidim.amendments.amendable", model_name: model_name)
end

#promote_amend_help_textObject



33
34
35
36
37
38
39
40
# File 'app/cells/decidim/amendable/promote_button_card_cell.rb', line 33

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

#promote_amend_pathObject



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

def promote_amend_path
  decidim.promote_amend_path(model.amendment)
end

#promote_confirm_textObject



29
30
31
# File 'app/cells/decidim/amendable/promote_button_card_cell.rb', line 29

def promote_confirm_text
  t("promote_confirm_text", scope: "decidim.amendments.amendable")
end