Module: ThemesForRails::CommonMethods
- Includes:
- Interpolation
- Defined in:
- lib/themes_for_rails/common_methods.rb
Instance Method Summary collapse
-
#add_theme_view_path ⇒ Object
will add the view path for the current theme.
-
#add_theme_view_path_for(name) ⇒ Object
will add the view path for a given theme name.
- #public_theme_path ⇒ Object
- #set_theme(name) ⇒ Object
- #theme_asset_path ⇒ Object
- #theme_asset_path_for(theme_name) ⇒ Object
- #theme_name ⇒ Object
- #theme_name=(name) ⇒ Object
- #theme_view_path ⇒ Object
- #theme_view_path_for(theme_name) ⇒ Object
- #valid_theme? ⇒ Boolean
Methods included from Interpolation
Instance Method Details
#add_theme_view_path ⇒ Object
will add the view path for the current theme
37 38 39 |
# File 'lib/themes_for_rails/common_methods.rb', line 37 def add_theme_view_path add_theme_view_path_for(self.theme_name) end |
#add_theme_view_path_for(name) ⇒ Object
will add the view path for a given theme name
42 43 44 |
# File 'lib/themes_for_rails/common_methods.rb', line 42 def add_theme_view_path_for(name) self.view_paths.insert 0, ::ActionView::FileSystemResolver.new(theme_view_path_for(name)) end |
#public_theme_path ⇒ Object
46 47 48 |
# File 'lib/themes_for_rails/common_methods.rb', line 46 def public_theme_path theme_view_path("/") end |
#set_theme(name) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/themes_for_rails/common_methods.rb', line 23 def set_theme(name) self.theme_name = name if valid_theme? add_theme_view_path end end |
#theme_asset_path ⇒ Object
50 51 52 |
# File 'lib/themes_for_rails/common_methods.rb', line 50 def theme_asset_path theme_asset_path_for(theme_name) end |
#theme_asset_path_for(theme_name) ⇒ Object
62 63 64 |
# File 'lib/themes_for_rails/common_methods.rb', line 62 def theme_asset_path_for(theme_name) interpolate(ThemesForRails.config.assets_dir, theme_name) end |
#theme_name ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/themes_for_rails/common_methods.rb', line 7 def theme_name @cached_theme_name ||= begin case @theme_name when Symbol then self.respond_to?(@theme_name, true) ? self.send(@theme_name) : @theme_name.to_s when String then @theme_name else nil end end end |
#theme_name=(name) ⇒ Object
19 20 21 |
# File 'lib/themes_for_rails/common_methods.rb', line 19 def theme_name=(name) @theme_name = name end |
#theme_view_path ⇒ Object
54 55 56 |
# File 'lib/themes_for_rails/common_methods.rb', line 54 def theme_view_path theme_view_path_for(theme_name) end |
#theme_view_path_for(theme_name) ⇒ Object
58 59 60 |
# File 'lib/themes_for_rails/common_methods.rb', line 58 def theme_view_path_for(theme_name) interpolate(ThemesForRails.config.views_dir, theme_name) end |
#valid_theme? ⇒ Boolean
32 33 34 |
# File 'lib/themes_for_rails/common_methods.rb', line 32 def valid_theme? !self.theme_name.nil? end |