Sha256: e17922376989d9fa3dcf6a682544a7fa74e64be24b3676bc71f147d47e643134

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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 theme asset
        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

3 entries across 3 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.6.7 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.6 lib/decidim/decidim_awesome/engine.rb
decidim-decidim_awesome-0.6.5 lib/decidim/decidim_awesome/engine.rb