Sha256: 60d7214298a0f2470fbda07d1cc1ee9da06faf5f20490888f6a2c184e40fd719

Contents?: true

Size: 921 Bytes

Versions: 29

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Admin
    class TrashController < Alchemy::Admin::BaseController
      helper "alchemy/admin/elements"

      authorize_resource class: false

      def index
        @elements = Element.trashed.includes(*element_includes)
        @page = Page.find(params[:page_id])
        @allowed_elements = @page.available_element_definitions
      end

      def clear
        @page = Page.find(params[:page_id])
        @elements = Element.trashed
        @elements.map(&:destroy)
      end

      private

      def element_includes
        [
          {
            contents: {
              essence: :ingredient_association,
            },
            all_nested_elements: [
              {
                contents: {
                  essence: :ingredient_association,
                },
              },
            ],
          },
        ]
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
alchemy_cms-5.1.10 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.10 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.9 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.9 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.8 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.8 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.7 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.7 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.6 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.6 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.5 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.5 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.4 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.4 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.3 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.2 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.1 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.3 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.1.0 app/controllers/alchemy/admin/trash_controller.rb
alchemy_cms-5.0.2 app/controllers/alchemy/admin/trash_controller.rb