Module: Decidim::ParticipatoryDocuments::Admin::SuggestionHelper
- Includes:
- ActionView::Helpers::TextHelper, Admin::IconLinkHelper
- Included in:
- SuggestionCell, SuggestionSerializer
- Defined in:
- app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb
Instance Method Summary collapse
- #bulk_valuators_select(participatory_space, prompt) ⇒ Object
- #humanize_suggestion_state(state) ⇒ Object
- #icon_with_link_to_suggestion(document, suggestion) ⇒ Object
- #suggestion_content(suggestion) ⇒ Object
Instance Method Details
#bulk_valuators_select(participatory_space, prompt) ⇒ Object
23 24 25 26 |
# File 'app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb', line 23 def bulk_valuators_select(participatory_space, prompt) = find_valuators_for_select(participatory_space) select(:valuator_role, :id, , prompt: prompt) end |
#humanize_suggestion_state(state) ⇒ Object
10 11 12 |
# File 'app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb', line 10 def humanize_suggestion_state(state) I18n.t(state, scope: "decidim.participatory_documents.suggestions.answers", default: :not_answered) end |
#icon_with_link_to_suggestion(document, suggestion) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb', line 14 def icon_with_link_to_suggestion(document, suggestion) return unless allowed_to?(:create, :suggestion_note, suggestion: suggestion) || allowed_to?(:update, :suggestion_answer, suggestion: suggestion) icon_link_to("comment-square", document_suggestion_path(document, suggestion), t(:answer, scope: "decidim.participatory_documents.admin.suggestions.index.actions"), class: "icon--small action-icon--show-suggestion") end |
#suggestion_content(suggestion) ⇒ Object
28 29 30 31 32 33 |
# File 'app/helpers/decidim/participatory_documents/admin/suggestion_helper.rb', line 28 def suggestion_content(suggestion) { text: suggestion_body(suggestion), file_link: suggestion.file.attached? && file_link(suggestion) } end |