Sha256: e2ddbce0cfda1cd9d7c505bf5756dec036321547b2120849bdae3e517d2545e9

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module ActiveElement
  # Base controller for all ActiveElement API admin front ends, provides standard layout, menu,
  # authentication as Superuser, and standardised HTML widgets.
  class ApplicationController < ActionController::Base
    include ActionView::Helpers::TagHelper
    include ActiveElement::DefaultControllerActions

    layout 'active_element'

    def self.active_element
      @active_element ||= ActiveElement::ControllerInterface.new(self)
    end

    def self.active_element_editable_fields(*args)
      @active_element_assigned_editable_fields = args
    end

    def active_element
      @active_element ||= ActiveElement::ControllerInterface.new(self.class, self)
    end

    before_action -> { active_element.authenticate }
    before_action -> { ActiveElement::ControllerAction.new(self).process_action }

    helper_method :active_element
    helper_method :render_active_element_hook

    def render_active_element_hook(hook, locals: {})
      render_to_string partial: hook, locals: locals
    rescue ActionView::MissingTemplate
      nil
    end

    def _active_element_text_search
      render(**ActiveElement::Components::TextSearch::Component.new(controller: self).response)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_element-0.0.31 app/controllers/active_element/application_controller.rb
active_element-0.0.30 app/controllers/active_element/application_controller.rb
active_element-0.0.29 app/controllers/active_element/application_controller.rb
active_element-0.0.28 app/controllers/active_element/application_controller.rb
active_element-0.0.27 app/controllers/active_element/application_controller.rb
active_element-0.0.26 app/controllers/active_element/application_controller.rb
active_element-0.0.24 app/controllers/active_element/application_controller.rb
active_element-0.0.23 app/controllers/active_element/application_controller.rb
active_element-0.0.22 app/controllers/active_element/application_controller.rb
active_element-0.0.21 app/controllers/active_element/application_controller.rb