Module: ClassyBody::ViewHelpers
- Defined in:
- lib/classy_body/view_helpers.rb
Instance Method Summary collapse
Instance Method Details
#body_class ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/classy_body/view_helpers.rb', line 3 def body_class ary = [controller_name] ary << controller.action_name ary << params['id'] if params['id'].present? ary << 'mobile' if mobile_agent? if content_for?(:body_class) ary << content_for(:body_class) end ary.join(' ') end |
#controller_name ⇒ Object
16 17 18 |
# File 'lib/classy_body/view_helpers.rb', line 16 def controller_name controller.controller_path.gsub('/','-') end |
#mobile_agent? ⇒ Boolean
20 21 22 23 |
# File 'lib/classy_body/view_helpers.rb', line 20 def mobile_agent? return true if params[:mobile] == "1" request.user_agent =~ /Mobile|webOS/ end |