Sha256: 4cbff133d287eb6a858460dc29b32d989448344f804453c2adf1ff1975ee2232

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "rails"
require "decidim/core"

module Decidim
  module ComparativeStats
    # This is the engine that runs on the public interface of comparative_stats.
    class Engine < ::Rails::Engine
      isolate_namespace Decidim::ComparativeStats

      routes do
        # Add engine routes here
        get "widgets/:graph", to: "widgets#show", as: :widget, defaults: { graph: "global_stats" }
        root to: "widgets#show"
      end

      initializer "decidim_comparative_stats.mount_routes" do
        Decidim::Core::Engine.routes do
          mount Decidim::ComparativeStats::Engine, at: "/comparative_stats", as: "decidim_comparative_stats"
        end
      end

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

      initializer "decidim_comparative_stats.assets" do |app|
        app.config.assets.precompile += %w(comparative_stats_manifest.js comparative_stats_manifest.css)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-comparative_stats-1.1.0 lib/decidim/comparative_stats/engine.rb
decidim-comparative_stats-1.0.1 lib/decidim/comparative_stats/engine.rb