Sha256: 8b503418d75e86a2d432a10a80501b46d5abc7fed86ea01677903e5a0ae7d594

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 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

      initializer "decidim_reporting_proposals.register_icons" do
        Decidim.icons.register(name: "camera-line", icon: "camera-line", category: "system", description: "", engine: :decidim_reporting_proposals)
      end

      def load_seed
        nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-reporting_proposals-0.6.0 lib/decidim/reporting_proposals/admin_engine.rb