Sha256: 525cf8a9ea2b96ce41826734a233adf65f4d1fb7f769b6683439fe707b61aa81

Contents?: true

Size: 1.84 KB

Versions: 7

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

require "decidim/elections/menu"

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

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

      routes do
        get "/answer_options", to: "feedback_forms#answer_options", as: :answer_options_election_feedback, defaults: { format: "json" }

        resources :elections do
          resources :steps, only: [:index, :update] do
            get :stats
          end
          member do
            put :publish
            put :unpublish
            resource :feedback_form, only: [:edit, :update] do
              collection do
                get :answers, to: "feedback_forms#index"
                get "/answer/:session_token", to: "feedback_forms#show", as: :answer
                get "/answer/:session_token/export", to: "feedback_forms#export_response", as: :answer_export
              end
            end
          end
          resources :questions do
            resources :answers do
              collection do
                get :proposals_picker
                resource :proposals_import, only: [:new, :create]
              end
              member do
                put :select
                put :unselect
              end
            end
          end
        end

        resources :trustees, only: [:index, :new, :edit, :create, :destroy], controller: "trustees_participatory_spaces"

        root to: "elections#index"
      end

      def self.participatory_space_endpoints
        [:trustees]
      end

      initializer "decidim_elections_admin.menu_entry" do
        Decidim::Elections::Menu.register_participatory_space_registry_manifests!
      end

      def load_seed
        nil
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.3 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.2 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.1 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.0 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.0.rc5 lib/decidim/elections/admin_engine.rb
decidim-elections-0.28.0.rc4 lib/decidim/elections/admin_engine.rb