Module: ApplicationHelper
- Defined in:
- lib/branston/app/helpers/application_helper.rb
Instance Method Summary collapse
- #clippy(text, bgcolor = '#FFFFFF') ⇒ Object
-
#element_id(obj, field = "") ⇒ Object
Produces a string id using the type and id of obj plus any field suffix supplied useful when assigning html ids on index pages.
-
#tab_on(tab_name, html_class = "current_page_item") ⇒ Object
Applies an html class attribute where the controller name contains the ‘tab_name’.
Instance Method Details
#clippy(text, bgcolor = '#FFFFFF') ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/branston/app/helpers/application_helper.rb', line 14 def clippy(text, bgcolor='#FFFFFF') html = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"\nwidth=\"110\"\nheight=\"14\"\nid=\"clippy\" >\n<param name=\"movie\" value=\"/flash/clippy.swf\"/>\n<param name=\"allowScriptAccess\" value=\"always\" />\n<param name=\"quality\" value=\"high\" />\n<param name=\"scale\" value=\"noscale\" />\n<param NAME=\"FlashVars\" value=\"text=\#{text}\">\n<param name=\"bgcolor\" value=\"\#{bgcolor}\">\n<embed src=\"/flash/clippy.swf\"\nwidth=\"110\"\nheight=\"14\"\nname=\"clippy\"\nquality=\"high\"\nallowScriptAccess=\"always\"\ntype=\"application/x-shockwave-flash\"\npluginspage=\"http://www.macromedia.com/go/getflashplayer\"\nFlashVars=\"text=\#{text}\"\nbgcolor=\"\#{bgcolor}\"\n/>\n</object>\n" end |
#element_id(obj, field = "") ⇒ Object
Produces a string id using the type and id of obj plus any field suffix supplied useful when assigning html ids on index pages. e.g. element_id(user, ‘name’) => ‘User_23_name’
10 11 12 |
# File 'lib/branston/app/helpers/application_helper.rb', line 10 def element_id(obj, field="") obj.class.to_s + '_' + obj.id.to_s + (field.blank? ? '' : '_' + field) end |
#tab_on(tab_name, html_class = "current_page_item") ⇒ Object
Applies an html class attribute where the controller name contains the ‘tab_name’.
3 4 5 |
# File 'lib/branston/app/helpers/application_helper.rb', line 3 def tab_on(tab_name, html_class="current_page_item") controller_name.match(Regexp.new("#{tab_name}")) ? " class=\"#{html_class}\"" : '' end |