Sha256: fcbe39f3ab809a7934e6bcbd8836a1e27172db76f803296327bfc1891b1e5e0c

Contents?: true

Size: 1.83 KB

Versions: 26

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

require "decidim/core"

module Decidim
  module Accountability
    # This is the engine that runs on the public interface of `decidim-accountability`.
    # It mostly handles rendering the created results associated to a participatory
    # process.
    class Engine < ::Rails::Engine
      isolate_namespace Decidim::Accountability

      routes do
        resources :results, only: [:index, :show] do
          resources :versions, only: [:show, :index]
        end
        root to: "results#home"
      end

      initializer "decidim_accountability.view_hooks" do
        Decidim.view_hooks.register(:participatory_space_highlighted_elements, priority: Decidim::ViewHooks::LOW_PRIORITY) do |view_context|
          view_context.cell("decidim/accountability/highlighted_results", view_context.current_participatory_space)
        end
      end

      initializer "decidim_accountability.add_cells_view_paths" do
        Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Accountability::Engine.root}/app/cells")
        Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Accountability::Engine.root}/app/views")
      end

      initializer "decidim_accountability.register_metrics" do
        Decidim.metrics_registry.register(:results) do |metric_registry|
          metric_registry.manager_class = "Decidim::Accountability::Metrics::ResultsMetricManage"

          metric_registry.settings do |settings|
            settings.attribute :highlighted, type: :boolean, default: false
            settings.attribute :scopes, type: :array, default: %w(home)
            settings.attribute :weight, type: :integer, default: 4
          end
        end
      end

      initializer "decidim_accountability.webpacker.assets_path" do
        Decidim.register_assets_path File.expand_path("app/packs", root)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
decidim-accountability-0.27.9 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.8 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.7 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.6 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.10 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.9 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.5 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.8 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.4 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.3 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.7 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.5 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.2 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.1 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.4 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.0 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.3 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.0.rc2 lib/decidim/accountability/engine.rb
decidim-accountability-0.27.0.rc1 lib/decidim/accountability/engine.rb
decidim-accountability-0.26.2 lib/decidim/accountability/engine.rb