Module: Vanilla::Routes

Extended by:
Routes
Included in:
Routes
Defined in:
lib/vanilla/routes.rb

Instance Method Summary collapse

Instance Method Details



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


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


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