Class: Jav::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
ApplicationHelper, Concerns::Breadcrumbs, UrlHelpers, Pundit, Pundit::Authorization
Defined in:
app/controllers/jav/application_controller.rb

Instance Method Summary collapse

Methods included from Concerns::Breadcrumbs

#add_breadcrumb, #jav_breadcrumbs

Methods included from UrlHelpers

#edit_resource_path, #new_resource_path, #related_resources_path, #resource_attach_path, #resource_detach_path, #resource_path, #resource_view_path, #resources_path

Methods included from ApplicationHelper

#a_button, #a_link, #button_classes, #decode_filter_params, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg, #white_panel_classes

Instance Method Details

#_current_userObject



60
61
62
# File 'app/controllers/jav/application_controller.rb', line 60

def _current_user
  instance_eval(&Jav.configuration.current_user)
end

#check_jav_licenseObject

super end



56
57
58
# File 'app/controllers/jav/application_controller.rb', line 56

def check_jav_license
  true
end

#contextObject



64
65
66
# File 'app/controllers/jav/application_controller.rb', line 64

def context
  instance_eval(&Jav.configuration.context)
end

#exception_logger(exception) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/jav/application_controller.rb', line 37

def exception_logger(exception)
  respond_to do |format|
    format.html { raise exception }
    format.json do
      render json: {
        errors: exception.respond_to?(:record) && exception.record.present? ? exception.record.errors : [],
        message: exception.message,
        traces: exception.backtrace
      }, status: ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name)
    end
  end
end

#init_appObject



31
32
33
34
35
# File 'app/controllers/jav/application_controller.rb', line 31

def init_app
  Jav::App.init request: request, context: context, current_user: _current_user, view_context: view_context, params: params

  @license = Jav::App.license
end