Sha256: 7d383b0929cb9167a6f5f80c828bf7896e2559824490dcfcdbc88620934c83ce

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryDocuments
    module DocumentsHelper
      include Decidim::ParticipatoryDocuments::Admin::ButtonHelper
      include Decidim::Admin::UserRolesHelper

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

        content_tag(: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

      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

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-participatory_documents-0.2.2 app/helpers/decidim/participatory_documents/documents_helper.rb
decidim-participatory_documents-0.2.1 app/helpers/decidim/participatory_documents/documents_helper.rb
decidim-participatory_documents-0.2.0 app/helpers/decidim/participatory_documents/documents_helper.rb