Sha256: 6988e41fe0fb23040416b391e3ac8cdfc417cd2eb44350c757866fab637c7cf3
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module Spina module Admin class AdminController < ActionController::Base include Spina::CurrentMethods helper Spina::Engine.helpers before_action :add_view_path before_action :set_admin_locale before_action :authorize_spina_user admin_section :content def current_admin_path request.fullpath[%r{/#{ Spina.config.backend_path }(.*)}, 1] end helper_method :current_admin_path private def render_flash render turbo_stream: turbo_stream.update("flash", partial: "spina/admin/shared/flash") end def set_admin_locale I18n.locale = I18n.default_locale end def authorize_spina_user redirect_to admin_login_path, flash: {information: I18n.t('spina.notifications.login')} unless current_spina_user end def authorize_admin render status: 401 unless current_spina_user.admin? end def add_view_path prepend_view_path Spina::Engine.root.join('app/views/spina/admin') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spina-2.1.1 | app/controllers/spina/admin/admin_controller.rb |
spina-2.1.0 | app/controllers/spina/admin/admin_controller.rb |