Module: YMDP::LinkTagHelper

Included in:
Compiler::Template::View
Defined in:
lib/ymdp/view/asset_tag_helper.rb

Instance Method Summary collapse

Instance Method Details



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, options={})
  if url_or_view =~ ProtocolRegexp
    options[:href] = url_or_view
    options[:target] ||= "_blank"
  else
    # this will create an in-YMDP link
    options[:onclick] = "Launcher.l('#{url_or_view}'); return false;"
    options[:href] = "#"
  end
  ("a", text, options)
end


27
28
29
30
31
# File 'lib/ymdp/view/asset_tag_helper.rb', line 27

def link_to_function(text, function, options={})
  options[:onclick] = function
  options[:href] = "#"
  ("a", text, options)
end


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, options={});
  if Application.current_view.downcase == url_or_view.downcase
    text
  else
    link_to(text, url_or_view, options)
  end
end