Sha256: 1467c044137096b3cef73f1742befce445064ba90e9b20bd7193dd18dddd2860

Contents?: true

Size: 1.64 KB

Versions: 13

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    module Admin
      # The main admin application controller for participatory processes
      class ApplicationController < Decidim::Admin::ApplicationController
        register_permissions(::Decidim::ParticipatoryProcesses::Admin::ApplicationController,
                             ::Decidim::ParticipatoryProcesses::Permissions,
                             ::Decidim::Admin::Permissions)

        private

        helper_method :tabs

        def permissions_context
          super.merge(
            current_participatory_space: try(:current_participatory_space)
          )
        end

        def permission_class_chain
          ::Decidim.permissions_registry.chain_for(::Decidim::ParticipatoryProcesses::Admin::ApplicationController)
        end

        def tabs
          @tabs ||= items.map { |item| item.slice(:id, :text, :icon) }
        end

        def panels
          @panels ||= items.map { |item| item.slice(:id, :method, :args) }
        end

        def items
          @items ||= [
            {
              id: "images",
              text: t("decidim.application.photos.photos"),
              icon: "upload-line",
              method: :cell,
              args: ["decidim/images_panel", @current_initiative]
            },
            {
              id: "documents",
              text: t("decidim.application.documents.documents"),
              icon: "upload-line",
              method: :cell,
              args: ["decidim/documents_panel", @current_initiative]
            }
          ].select { |item| item[:enabled] }
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.29.1 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.4 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.29.0 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.3 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.29.0.rc4 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.29.0.rc3 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.29.0.rc2 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.29.0.rc1 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.2 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.1 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.0 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.0.rc5 app/controllers/decidim/participatory_processes/admin/application_controller.rb
decidim-participatory_processes-0.28.0.rc4 app/controllers/decidim/participatory_processes/admin/application_controller.rb