Sha256: 53dab189ecf02b8d8cd6c68df3babb0e77229fe5633d6c5084c09ab140bfcf7d

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

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

    layout 'active_element'

    def self.active_element
      @active_element ||= ActiveElement::ControllerInterface.new(self)
    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

5 entries across 5 versions & 1 rubygems

Version Path
active_element-0.0.10 app/controllers/active_element/application_controller.rb
active_element-0.0.9 app/controllers/active_element/application_controller.rb
active_element-0.0.8 app/controllers/active_element/application_controller.rb
active_element-0.0.7 app/controllers/active_element/application_controller.rb
active_element-0.0.6 app/controllers/active_element/application_controller.rb