Module: RailsCoreExtensions::ActionViewExtensions
- Defined in:
- lib/rails_core_extensions/action_view_extensions.rb
Instance Method Summary collapse
- #boolean_select_tag(name, *args) ⇒ Object
- #textilize(content) ⇒ Object
-
#tooltip(hover_element_id, text, title = '') ⇒ Object
Generates a tooltip with given text text is textilized before display.
Instance Method Details
#boolean_select_tag(name, *args) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rails_core_extensions/action_view_extensions.rb', line 18 def boolean_select_tag(name, *args) = args. ||= {} yes_no_opts = [%w[Yes 1], %w[No 0]] = (yes_no_opts, [:selected]) select_tag name, , .except(:selected) end |
#textilize(content) ⇒ Object
3 4 5 |
# File 'lib/rails_core_extensions/action_view_extensions.rb', line 3 def textilize(content) super(h(content)).html_safe end |
#tooltip(hover_element_id, text, title = '') ⇒ Object
Generates a tooltip with given text text is textilized before display
9 10 11 12 13 14 15 16 |
# File 'lib/rails_core_extensions/action_view_extensions.rb', line 9 def tooltip(hover_element_id, text, title='') content = "<div style='width: 25em'>#{textilize(text)}</div>" "<script>" + "new Tip('#{hover_element_id}', '#{escape_javascript(content)}',"+ "{title : '#{escape_javascript title}', className: 'silver_smaller_div',"+ "showOn: 'mouseover', hideOn: { event: 'mouseout' }, fixed: false});"+ "</script>" end |