Module: Decidim::ParticipatoryDocuments::Admin::DocumentsHelper

Includes:
ButtonHelper
Defined in:
app/helpers/decidim/participatory_documents/admin/documents_helper.rb

Instance Method Summary collapse

Methods included from ButtonHelper

#btn_icon, #button_builder

Instance Method Details

#back_btnObject



21
22
23
24
25
26
27
# File 'app/helpers/decidim/participatory_documents/admin/documents_helper.rb', line 21

def back_btn
  btn_title = t("actions.back", scope: "decidim.participatory_documents")

  (:a, title: btn_title, href: manage_component_path(current_component), class: "button small button--simple") do
    button_builder(btn_title, icon: "caret-left")
  end
end

#boolean_label(active) ⇒ Object



29
30
31
32
33
# File 'app/helpers/decidim/participatory_documents/admin/documents_helper.rb', line 29

def boolean_label(active)
  (:span, class: "label #{active ? "success" : "alert"}") do
    t(active ? "yes" : "no", scope: "decidim.participatory_documents")
  end
end

#pdf_manage_buttons(document) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/decidim/participatory_documents/admin/documents_helper.rb', line 9

def pdf_manage_buttons(document)
  (:div, class: "flex--cc flex-gap--1") do
    if document.blank? && allowed_to?(:create, :participatory_document)
      new_pdf_btn
    elsif document.file.attached? && allowed_to?(:update, :participatory_document, document: document)
      edit_document_btn + edit_boxes_btn + preview_sections_btn
    elsif allowed_to?(:update, :participatory_document, document: document)
      edit_document_btn
    end
  end
end