Sha256: e187d0b815cba57c55766bb68c8e6a87dc22486fefda3d035f4aa3b358d9cfa9

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module Admin
      module MaintenanceContext
        extend ActiveSupport::Concern

        included do
          layout "decidim/decidim_awesome/admin/maintenance"
          helper_method :current_view, :available_views, :present_private_data

          private

          def present_private_data(model)
            PrivateDataPresenter.new(model)
          end

          def current_view
            return params[:id] if available_views.include?(params[:id])

            available_views.keys.first
          end

          def available_views
            {
              "private_data" => {
                title: I18n.t("private_data", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
                icon: "spy-line",
                path: decidim_admin_decidim_awesome.maintenance_path("private_data")
              },
              "checks" => {
                title: I18n.t("checks", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
                icon: "pulse",
                path: decidim_admin_decidim_awesome.checks_maintenance_index_path
              }
            }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.11.2 app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb
decidim-decidim_awesome-0.11.1 app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb