Sha256: 09a363b4b69bccb9f04dfd41c6750cfe20911e7ff9c1d137494787b7d91df50a

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

module Decidim
  module TermCustomizer
    class AdminEngine < ::Rails::Engine
      isolate_namespace Decidim::TermCustomizer::Admin

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

      routes do
        resources :translation_sets, path: :sets, except: [:show] do
          resources :translations, except: [:show]
          resources :add_translations, only: [:index, :create] do
            collection do
              get :search
            end
          end
        end

        root to: "translation_sets#index"
      end

      initializer "decidim_term_customizer.admin_mount_routes" do
        Decidim::Core::Engine.routes do
          mount Decidim::TermCustomizer::AdminEngine, at: "/admin/term_customizer", as: "decidim_admin_term_customizer"
        end
      end

      initializer "decidim_term_customizer.admin_assets" do |app|
        app.config.assets.precompile += %w(translation_sets_admin_manifest.js)
      end

      initializer "decidim_term_customizer.admin_menu" do
        Decidim.menu :admin_menu do |menu|
          menu.item I18n.t("menu.term_customizer", scope: "decidim.term_customizer"),
                    decidim_admin_term_customizer.translation_sets_path,
                    icon_name: "text",
                    position: 7.1,
                    active: :inclusive,
                    if: allowed_to?(:update, :organization, organization: current_organization)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-term_customizer-0.16.3 lib/decidim/term_customizer/admin_engine.rb
decidim-term_customizer-0.16.2 lib/decidim/term_customizer/admin_engine.rb
decidim-term_customizer-0.16.1 lib/decidim/term_customizer/admin_engine.rb
decidim-term_customizer-0.16.0 lib/decidim/term_customizer/admin_engine.rb