Module: Vanilla::Routes
Instance Method Summary collapse
- #edit_link(snip_name, link_text) ⇒ Object
- #link_to(link_text, snip_name = link_text, part = nil) ⇒ Object
- #new_link(snip_name = "New") ⇒ Object
- #url_to(snip_name, part = nil) ⇒ Object
- #url_to_raw(snip_name, part = nil) ⇒ Object
Instance Method Details
#edit_link(snip_name, link_text) ⇒ Object
19 20 21 |
# File 'lib/vanilla/routes.rb', line 19 def edit_link(snip_name, link_text) %[<a href="/edit?name=#{snip_name}">#{link_text}</a>] end |
#link_to(link_text, snip_name = link_text, part = nil) ⇒ Object
3 4 5 |
# File 'lib/vanilla/routes.rb', line 3 def link_to(link_text, snip_name=link_text, part=nil) %{<a href="#{Vanilla::Routes.url_to(snip_name, part)}">#{link_text}</a>} end |
#new_link(snip_name = "New") ⇒ Object
23 24 25 |
# File 'lib/vanilla/routes.rb', line 23 def new_link(snip_name="New") %[<a href="/new?name=#{snip_name}" class="new">#{snip_name}</a>] end |
#url_to(snip_name, part = nil) ⇒ Object
7 8 9 10 11 |
# File 'lib/vanilla/routes.rb', line 7 def url_to(snip_name, part=nil) url = "/#{snip_name}" url += "/#{part}" if part url end |
#url_to_raw(snip_name, part = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/vanilla/routes.rb', line 13 def url_to_raw(snip_name, part=nil) url = "/#{snip_name}" url += "/#{part}" if part url += ".raw" end |