Sha256: e04e8556c4cece8e9117ea58f6ea5015a8825a3f8b5b4f279a21af05437b2c79

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require "searchlight"
require "kaminari"

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

      routes do
        resources :projects, only: [:index, :show]
        resource :order, only: [:destroy] do
          member do
            post :checkout
          end
          resource :line_item, only: [:create, :destroy]
        end

        root to: "projects#index"
      end

      initializer "decidim_budgets.assets" do |app|
        app.config.assets.precompile += %w(decidim_budgets_manifest.js)
      end

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

      initializer "decidim_budgets.register_metrics" do
        Decidim.metrics_operation.register(:participants, :budgets) do |metric_operation|
          metric_operation.manager_class = "Decidim::Budgets::Metrics::BudgetParticipantsMetricMeasure"
        end

        Decidim.metrics_operation.register(:followers, :budgets) do |metric_operation|
          metric_operation.manager_class = "Decidim::Budgets::Metrics::BudgetFollowersMetricMeasure"
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-budgets-0.22.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.21.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.20.1 lib/decidim/budgets/engine.rb
decidim-budgets-0.20.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.19.1 lib/decidim/budgets/engine.rb
decidim-budgets-0.18.1 lib/decidim/budgets/engine.rb
decidim-budgets-0.19.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.17.2 lib/decidim/budgets/engine.rb
decidim-budgets-0.18.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.17.1 lib/decidim/budgets/engine.rb
decidim-budgets-0.16.1 lib/decidim/budgets/engine.rb
decidim-budgets-0.17.0 lib/decidim/budgets/engine.rb
decidim-budgets-0.16.0 lib/decidim/budgets/engine.rb