Sha256: 114518743afc345a3ce53a706bc8b1565fe180a3bb21a84e5bde9eb37506098c

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

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

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

      routes do
        # Add admin engine routes here
        put :hide_proposal, to: "proposals#hide_proposal"
        post :add_photos, to: "proposals#add_photos"
        delete :remove_photo, to: "proposals#remove_photo"
        resources :proposal_notes, only: :update
      end

      initializer "decidim_reporting_proposals.template_routes" do
        if defined? Decidim::Templates::AdminEngine
          Decidim::Templates::AdminEngine.routes do
            resources :proposal_answer_templates do
              member do
                post :copy
              end
              collection do
                get :fetch
              end
            end
          end
        end
      end

      initializer "decidim_reporting_proposals.admin_mount_routes" do
        Decidim::Admin::Engine.routes do
          mount Decidim::ReportingProposals::AdminEngine, at: "/reporting_proposals", as: "decidim_admin_reporting_proposals"
        end
      end

      def load_seed
        nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.5.2 lib/decidim/reporting_proposals/admin_engine.rb
decidim-reporting_proposals-0.5.1 lib/decidim/reporting_proposals/admin_engine.rb
decidim-reporting_proposals-0.5.0 lib/decidim/reporting_proposals/admin_engine.rb
decidim-reporting_proposals-0.4.2 lib/decidim/reporting_proposals/admin_engine.rb