class Humpyard::Config
Humpyard::Config
is responsible for holding and managing the configuration for your Humpyard
Rails Application.
Possible configuration options are:
table_name_prefix
-
The prefix for the SQL tables
The default value is
"humpyard_"
www_prefix
-
The prefix for the pages in your routes
You may use some variables that will be replaced by
Humpyard::Page.human_url
":locale"
-
The current ::I18n.locale
Leading slashes (“/”) as it would result in invalid URLs and will be ignored.
A tailing slash (“/”) indicates, that the value should be a path. Without the tailing slash the last part would become a prefix to the pages URL. A page with the path “about/config.html” with the ::I18n.locale=“en” and the given prefix will result in:
":locale/"
-
"/en/about/config.html"
":locale/cms_"
-
"/en/cms_about_config.html"
"cms/"
-
"/cms/about/config.html"
""
:"/about/config.html"
The default value is
":locale/"
admin_prefix
-
The prefix for the admin controllers
The default value is
"admin"
locales
-
The locales used for the pages
This option can be configured by giving an Array or comma separated String, e.g.
'en,de,fr'
or['en', 'de', 'fr']
.Setting this option will also alter the HumpyardForm.config.locales to the given value
The default value is
['en']
Public Instance Methods
# File lib/humpyard/config.rb 166 def admin_prefix=(prefix) 167 if prefix 168 @admin_prefix = prefix.gsub /^\//, '' 169 else 170 @admin_prefix = nil 171 end 172 end
# File lib/humpyard/config.rb 206 def compass_format 207 @compass_format ||= 'scss' 208 end
# File lib/humpyard/config.rb 210 def compass_stylesheet_link_tag_path 211 @compass_stylesheet_link_tag_path ||= 'compiled/' 212 end
Configure your Humpyard
Rails Application with the given parameters in the block. For possible options see above.
# File lib/humpyard/config.rb 57 def configure(&block) 58 yield(self) 59 end
# File lib/humpyard/config.rb 138 def default_template_name 139 default_template.to_s 140 end
# File lib/humpyard/config.rb 202 def js_framework 203 @js_framework ||= 'jquery-ui-18' 204 end
Get the given locales as Regexp constraint. This may be used to see if a locale matches the configured locales. Usage is e.g. in the routes.
# File lib/humpyard/config.rb 194 def locales_contraint 195 Regexp.new locales * '|' 196 end
Get the given locales as Regexp constraint. This may be used to see if a locale matches the configured locales. Usage is e.g. in the routes.
# File lib/humpyard/config.rb 231 def page_formats_contraint 232 Regexp.new page_formats * '|' 233 end
Get the prefix of your pages with interpreted variables given as params. You normally don't want to call it yourself. Instead use the Humpyard::Page.human_url
which will put the current ::I18n.locale into the params.
# File lib/humpyard/config.rb 154 def parsed_www_prefix(params) 155 prefix = "#{www_prefix}" 156 params.each do |key,value| 157 prefix.gsub!(":#{key}", value.to_s) 158 end 159 prefix 160 end
# File lib/humpyard/config.rb 198 def users_framework 199 @users_framework ||= 'simple' 200 end
# File lib/humpyard/config.rb 69 def www_prefix=(prefix) 70 if prefix 71 @www_prefix = prefix.gsub /^\//, '' 72 else 73 @www_prefix = nil 74 end 75 end