Sha256: f5d90e80b2df71d54e9f624afa8e0c8f3e841c9b7d2b5e69bbacf12e3e939032

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 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)
      render_to_string partial: hook
    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

9 entries across 9 versions & 1 rubygems

Version Path
active_element-0.0.19 app/controllers/active_element/application_controller.rb
active_element-0.0.18 app/controllers/active_element/application_controller.rb
active_element-0.0.17 app/controllers/active_element/application_controller.rb
active_element-0.0.16 app/controllers/active_element/application_controller.rb
active_element-0.0.15 app/controllers/active_element/application_controller.rb
active_element-0.0.14 app/controllers/active_element/application_controller.rb
active_element-0.0.13 app/controllers/active_element/application_controller.rb
active_element-0.0.12 app/controllers/active_element/application_controller.rb
active_element-0.0.11 app/controllers/active_element/application_controller.rb