Sha256: 02c2a6706e5f3a3b10aaff589939688cebd3cf675551ed671469361b3eddb558

Contents?: true

Size: 975 Bytes

Versions: 12

Compression:

Stored size: 975 Bytes

Contents

module Alchemy
  class ElementsController < Alchemy::BaseController
    load_and_authorize_resource
    layout false

    rescue_from CanCan::AccessDenied do |exception|
      raise ActiveRecord::RecordNotFound
    end

    # == Renders the element view partial
    #
    # === Accepted Formats
    #
    # * html
    # * js (Tries to replace a given +container_id+ with the elements view partial content via jQuery.)
    # * json (A JSON object that includes all contents and their ingredients)
    #
    def show
      @page = @element.page
      @options = params[:options]

      respond_to do |format|
        format.html
        format.js { @container_id = params[:container_id] }
        format.json do
          ActiveSupport::Deprecation.warn("The Alchemy elements json API moved to `api` namespace. Please use `/api/elements` for json requests instead.")
          render json: @element, serializer: LegacyElementSerializer
        end
      end
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
alchemy_cms-3.1.3 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.1 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.rc3 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.rc2 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.rc1 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta6 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta5 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta4 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta3 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta2 app/controllers/alchemy/elements_controller.rb
alchemy_cms-3.1.0.beta1 app/controllers/alchemy/elements_controller.rb