Module: Decidim::ParticipatoryDocuments::DocumentsHelper

Includes:
Admin::UserRolesHelper, Admin::ButtonHelper
Defined in:
app/helpers/decidim/participatory_documents/documents_helper.rb

Instance Method Summary collapse

Methods included from Admin::ButtonHelper

#btn_icon, #button_builder

Instance Method Details

#back_edit_pdf_btnObject



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

def back_edit_pdf_btn
  btn_title = t("actions.back_edit", scope: "decidim.participatory_documents")

  (:a,
              title: btn_title,
              href: Decidim::EngineRouter.admin_proxy(document.component).edit_pdf_documents_path(id: document.id),
              class: "button small warning mr-s") do
    button_builder(btn_title, icon: "layers")
  end
end

#finish_publish_btnObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/decidim/participatory_documents/documents_helper.rb', line 20

def finish_publish_btn
  btn_title = t("actions.finish_publishing", scope: "decidim.participatory_documents")

  link_to(
    Decidim::EngineRouter.admin_proxy(document.component).publish_document_path(document),
    method: :put,
    data: { confirm: t("actions.confirm", scope: "decidim.participatory_documents") },
    class: "button small light success"
  ) do
    button_builder(btn_title, icon: "check")
  end
end

#preview_mode?Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
# File 'app/helpers/decidim/participatory_documents/documents_helper.rb', line 33

def preview_mode?
  return if document.published?
  return if current_user.blank?

  current_component.manifest.admin_engine && user_role_config.component_is_accessible?(current_component.manifest_name)
end