Module: YMDP::LinkTagHelper
- Included in:
- Compiler::Template::View
- Defined in:
- lib/ymdp/view/asset_tag_helper.rb
Instance Method Summary collapse
- #link_to(text, url_or_view, options = {}) ⇒ Object
- #link_to_function(text, function, options = {}) ⇒ Object
- #link_to_unless_current(text, url_or_view, options = {}) ⇒ Object
Instance Method Details
#link_to(text, url_or_view, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ymdp/view/asset_tag_helper.rb', line 15 def link_to(text, url_or_view, ={}) if url_or_view =~ ProtocolRegexp [:href] = url_or_view [:target] ||= "_blank" else # this will create an in-YMDP link [:onclick] = "Launcher.l('#{url_or_view}'); return false;" [:href] = "#" end content_tag("a", text, ) end |
#link_to_function(text, function, options = {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/ymdp/view/asset_tag_helper.rb', line 27 def link_to_function(text, function, ={}) [:onclick] = function [:href] = "#" content_tag("a", text, ) end |
#link_to_unless_current(text, url_or_view, options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/ymdp/view/asset_tag_helper.rb', line 7 def link_to_unless_current(text, url_or_view, ={}); if Application.current_view.downcase == url_or_view.downcase text else link_to(text, url_or_view, ) end end |