Sha256: bc1a3c109e1a080269a30480abd7637389349513bcbf80b78c771c06b2897ba9

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true

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

      paths["db/migrate"] = nil
      paths["lib/tasks"] = nil

      routes do
        # Add admin engine routes here
        resources :constraints
        resources :config, param: :var, only: [:show, :update]
        get :checks, to: "checks#index"
        root to: "config#show", var: :editors
      end

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

      initializer "decidim_decidim_awesome.admin_mount_routes" do
        Decidim::Core::Engine.routes do
          mount Decidim::DecidimAwesome::AdminEngine, at: "/admin/decidim_awesome", as: "decidim_admin_decidim_awesome"
        end
      end

      initializer "decidim_awesome.admin_menu" do
        Decidim.menu :admin_menu do |menu|
          menu.item I18n.t("menu.decidim_awesome", scope: "decidim.admin", default: "Decidim Awesome"),
                    decidim_admin_decidim_awesome.config_path(:editors),
                    icon_name: "fire",
                    position: 7.5,
                    active: is_active_link?(decidim_admin_decidim_awesome.config_path(:editors), :inclusive)
        end
      end

      def load_seed
        nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.6.2 lib/decidim/decidim_awesome/admin_engine.rb
decidim-decidim_awesome-0.6.1 lib/decidim/decidim_awesome/admin_engine.rb
decidim-decidim_awesome-0.6.0 lib/decidim/decidim_awesome/admin_engine.rb
decidim-decidim_awesome-0.5.1 lib/decidim/decidim_awesome/admin_engine.rb