Class: Smriti::Admin::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
AuthBridge
Defined in:
app/controllers/smriti/admin/application_controller.rb

Overview

Smriti::Admin::ApplicationController

Base controller for the Smriti admin interface.

Responsibilities:

  • Provides authentication and authorization via Smriti::Admin::AuthBridge.
  • Applies the smriti/admin layout and includes UI helpers.
  • Manages locale (I18n.locale) and enforces language parameter consistency.
  • Sets the browser time zone around each request when provided via cookies.
  • Exposes smriti_data_theme (light/dark) for theming via cookies.
  • Provides frame helpers (render_frame, ensure_frame) to support Turbo-driven admin UI navigation.

Filters:

  • before_action: sets locale and redirects to enforce lang consistency.
  • around_action: wraps requests in the browser’s time zone if valid.

Methods:

  • #default_url_options ensures lang param is included in generated URLs.
  • #set_time_zone runs the request in the cookie-provided time zone if valid.
  • #render_frame renders a UI frame partial given frame_id.
  • #ensure_frame requires a frame_id param for frame-only actions.
  • #redirect_to_lang redirects when the URL lang param differs from I18n.locale.
  • #set_smriti_locale sets the session-defined or default locale.
  • #smriti_data_theme returns light, dark, or nil for theming.

Method Summary

Methods included from AuthBridge

#user