Sha256: 15fefcb69ce30b14b33bb0b79cb4fbbaca05aacd56d57ff25758af97a66beb62

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require "rails"
require "decidim/core"
require "decidim/decidim_awesome/awesome_helpers"

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

      routes do
        post :editor_images, to: "editor_images#create"
      end

      initializer "decidim_awesome.view_helpers" do
        ActionView::Base.send :include, AwesomeHelpers
      end

      initializer "decidim_decidim_awesome.assets" do |app|
        app.config.assets.precompile += %w(decidim_decidim_awesome_manifest.js decidim_decidim_awesome_manifest.css)
        # add to precompile any present
        Dir.glob(Rails.root.join("app", "assets", "themes", "*.*")).each do |path|
          app.config.assets.precompile << path
        end
      end

      # Prepare a zone to create overrides
      # https://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers
      config.to_prepare do
        Dir.glob("#{Engine.root}/app/awesome_overrides/**/*_override.rb").each do |override|
          require_dependency override
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.6.4 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.3 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.2 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.1 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.0 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.5.1 lib/decidim/decidim_awesome/engine.rb