Class: ThemesForRails::Config
- Inherits:
-
Object
- Object
- ThemesForRails::Config
- Includes:
- Interpolation
- Defined in:
- lib/themes_for_rails/config.rb
Instance Attribute Summary collapse
-
#assets_dir ⇒ Object
relative assets dir for view overloading support used for theme_view_path_for method to get theme path and add to view paths.
- #base_dir ⇒ Object
-
#default_theme ⇒ Object
Returns the value of attribute default_theme.
- #themes_dir ⇒ Object
-
#themes_routes_dir ⇒ Object
This is the base themes dir that is used for mapping URL paths.
-
#use_sass ⇒ Object
Returns the value of attribute use_sass.
-
#views_dir ⇒ Object
relative views directory for theme views to be separated from assets used for Asset Pipeline support.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #sass_is_available? ⇒ Boolean
-
#themes_path ⇒ Object
Full path to themes.
- #use_sass? ⇒ Boolean
Methods included from Interpolation
Constructor Details
#initialize(&block) ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 |
# File 'lib/themes_for_rails/config.rb', line 10 def initialize(&block) @use_sass = true @default_theme = 'default' yield if block_given? end |
Instance Attribute Details
#assets_dir ⇒ Object
relative assets dir for view overloading support used for theme_view_path_for method to get theme path and add to view paths. Defaults to themes_dir for non asset pipeline users
If you are using the Rails Asset Pipeline, this should be changed to the path of your assets in your app. For example, if you store your themes under /app/assets/themes - Rails.root/app/assets/themes you would need to set this to ‘app/assets/themes’ in your initializer config
28 29 30 |
# File 'lib/themes_for_rails/config.rb', line 28 def assets_dir @assets_dir ||= ":root/themes/:name" end |
#base_dir ⇒ Object
16 17 18 |
# File 'lib/themes_for_rails/config.rb', line 16 def base_dir @base_dir ||= Rails.root.to_s end |
#default_theme ⇒ Object
Returns the value of attribute default_theme.
6 7 8 |
# File 'lib/themes_for_rails/config.rb', line 6 def default_theme @default_theme end |
#themes_dir ⇒ Object
38 39 40 |
# File 'lib/themes_for_rails/config.rb', line 38 def themes_dir @themes_dir ||= ":root/themes" end |
#themes_routes_dir ⇒ Object
This is the base themes dir that is used for mapping URL paths.
If you are using the Rails Asset Pipeline, this should be changed to the prefix dir of your assets path. For example, if you store your themes under /app/assets/themes - Rails.root/app/assets/themes you would need to set this value to ‘assets’ to match up with the Sprockets path resolution process.
55 56 57 |
# File 'lib/themes_for_rails/config.rb', line 55 def themes_routes_dir @themes_routes_dir ||= "themes" end |
#use_sass ⇒ Object
Returns the value of attribute use_sass.
6 7 8 |
# File 'lib/themes_for_rails/config.rb', line 6 def use_sass @use_sass end |
#views_dir ⇒ Object
relative views directory for theme views to be separated from assets used for Asset Pipeline support. Defaults to match #assets_dir/views
34 35 36 |
# File 'lib/themes_for_rails/config.rb', line 34 def views_dir @views_dir ||= ":root/themes/:name/views" end |
Instance Method Details
#clear ⇒ Object
59 60 61 62 63 64 |
# File 'lib/themes_for_rails/config.rb', line 59 def clear @base_dir = nil @themes_dir = nil @assets_dir = nil @views_dir = nil end |
#sass_is_available? ⇒ Boolean
70 71 72 |
# File 'lib/themes_for_rails/config.rb', line 70 def sass_is_available? !!defined?Sass::Plugin end |
#themes_path ⇒ Object
Full path to themes
43 44 45 |
# File 'lib/themes_for_rails/config.rb', line 43 def themes_path interpolate(themes_dir) end |
#use_sass? ⇒ Boolean
66 67 68 |
# File 'lib/themes_for_rails/config.rb', line 66 def use_sass? @use_sass and sass_is_available? end |