Sha256: 3e889ed6d6fd993eb9328d77c953a612c7e82f595755b6b58f9168303a71362d

Contents?: true

Size: 1.65 KB

Versions: 10

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

require "decidim/templates/menu"

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

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

      routes do
        resources :proposal_answer_templates do
          member do
            post :copy
          end
          collection do
            get :fetch
          end
        end

        ## Routes for Questionnaire Templates
        resources :questionnaire_templates do
          member do
            post :copy

            resource :questionnaire, module: :questionnaire_templates # To manage the templatable resource
          end

          collection do
            post :apply # To use when creating an object from a template
            post :skip # To use when creating an object without a template
            get :preview # To provide a preview for the template in the object creation view
          end
        end
        resources :block_user_templates do
          member do
            post :copy
          end
          collection do
            get :fetch
          end
        end

        get "/questionnaire_template/questionnaire/answer_options", to: "questionnaires#answer_options", as: "answer_options_template"

        root to: "questionnaire_templates#index"
      end

      initializer "decidim_templates_admin.menu" do
        Decidim::Templates::Menu.register_admin_template_types_menu!
        Decidim::Templates::Menu.register_admin_menu!
      end

      def load_seed
        nil
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-templates-0.29.1 lib/decidim/templates/admin_engine.rb
decidim-templates-0.28.4 lib/decidim/templates/admin_engine.rb
decidim-templates-0.29.0 lib/decidim/templates/admin_engine.rb
decidim-templates-0.28.3 lib/decidim/templates/admin_engine.rb
decidim-templates-0.29.0.rc4 lib/decidim/templates/admin_engine.rb
decidim-templates-0.29.0.rc3 lib/decidim/templates/admin_engine.rb
decidim-templates-0.29.0.rc2 lib/decidim/templates/admin_engine.rb
decidim-templates-0.29.0.rc1 lib/decidim/templates/admin_engine.rb
decidim-templates-0.28.2 lib/decidim/templates/admin_engine.rb
decidim-templates-0.28.1 lib/decidim/templates/admin_engine.rb