Module: ShinyThemes::RendersTheme
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/shiny_themes/renders_theme.rb
Overview
RendersTheme concern Included into ActionController::Base providing a theme class variable for controllers. This theme defines a view path for templates and a layout to render with.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#current_theme_layout ⇒ String
The current theme default layout.
-
#current_theme_name ⇒ String
The current theme name.
-
#update_current_theme(name, options = {}) ⇒ Theme
Update the current theme for the controller and optionally save.
Instance Method Details
#current_theme_layout ⇒ String
Returns the current theme default layout.
24 25 26 |
# File 'lib/shiny_themes/renders_theme.rb', line 24 def current_theme_layout self.class.theme.layout end |
#current_theme_name ⇒ String
Returns the current theme name.
19 20 21 |
# File 'lib/shiny_themes/renders_theme.rb', line 19 def current_theme_name self.class.theme.name end |
#update_current_theme(name, options = {}) ⇒ Theme
Update the current theme for the controller and optionally save
34 35 36 37 38 39 40 |
# File 'lib/shiny_themes/renders_theme.rb', line 34 def update_current_theme(name, = {}) self.class.renders_theme(name, ) Rails.application.config.theme.name = current_theme_name Rails.application.config.theme.layout = current_theme_layout ShinyThemes::Engine.theme_config.save unless [:dont_save] self.class.theme # return current theme object end |