action links to prevent excess typing
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@31 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
629cc9c2cc
commit
1e88dc6d10
|
@ -1,2 +1,15 @@
|
||||||
module BeersHelper
|
module BeersHelper
|
||||||
|
def new_beer_link
|
||||||
|
link_to 'New Beer', new_beer_path, { :title => 'Create a new beer' }
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_beer_link(beer)
|
||||||
|
link_to 'Show', beer_path(beer.page.title_for_url),
|
||||||
|
{ :title => beer.title }
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_beer_link(beer)
|
||||||
|
link_to 'Edit Beer', edit_beer_path(beer.page.title_for_url),
|
||||||
|
{ :title => "Edit #{beer.title}" }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,16 @@
|
||||||
module BreweriesHelper
|
module BreweriesHelper
|
||||||
|
def new_brewery_link
|
||||||
|
link_to 'New Brewery', new_brewery_path,
|
||||||
|
{ :title => 'Create a new brewery' }
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_brewery_link(brewery)
|
||||||
|
link_to 'Show', brewery_path(brewery.page.title_for_url),
|
||||||
|
{ :title => brewery.title }
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_brewery_link(brewery)
|
||||||
|
link_to 'Edit Brewery', edit_brewery_path(brewery.page.title_for_url),
|
||||||
|
{ :title => "Edit #{brewery.title}" }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,15 @@
|
||||||
module PagesHelper
|
module PagesHelper
|
||||||
|
def new_page_link
|
||||||
|
link_to 'New Page', new_page_path, { :title => 'Create a new page' }
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_page_link(page)
|
||||||
|
link_to 'Show', page_path(page.title_for_url),
|
||||||
|
{ :title => page.title }
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_page_link(page)
|
||||||
|
link_to 'Edit Page', edit_page_path(page.title_for_url),
|
||||||
|
{ :title => "Edit #{page.title}" }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
<% content_for :sidebar do -%>
|
||||||
<%= link_to 'New Beer', new_beer_path -%><br />
|
<%= new_beer_link -%><br />
|
||||||
<%= link_to 'Show', beer_path(@beer.page.title_for_url) -%><br />
|
<%= show_beer_link(@beer) -%><br />
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%= render :partial => 'pages/page' %>
|
<%= render :partial => 'pages/page' %>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
<% content_for :sidebar do -%>
|
||||||
<%= link_to 'New Beer', new_beer_path -%><br />
|
<%= new_beer_link -%><br />
|
||||||
<%= link_to 'Edit Beer', edit_beer_path(@beer.page.title_for_url) -%><br />
|
<%= edit_beer_link(@beer) -%><br />
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
<% content_for :sidebar do -%>
|
||||||
<%= link_to 'Show', page_path({ :id => @page.title_for_url }) %><br />
|
<%= new_page_link -%><br />
|
||||||
<%= link_to 'Browse Pages', pages_path %><br />
|
<%= show_page_link(@page) -%><br />
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%= render :partial => 'page' -%>
|
<%= render :partial => 'page' -%>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
<% content_for :sidebar do -%>
|
||||||
<%= link_to 'New Page', new_page_path -%><br />
|
<%= new_page_link -%><br />
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -11,7 +11,3 @@
|
||||||
<%= submit_tag "Create" %>
|
<%= submit_tag "Create" %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
|
||||||
<%= link_to 'Browse Pages', pages_path %><br />
|
|
||||||
<% end -%>
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%= render :partial => 'page' %>
|
<%= render :partial => 'page' %>
|
||||||
|
|
||||||
<% content_for :sidebar do -%>
|
<% content_for :sidebar do -%>
|
||||||
<%= link_to 'Edit Page', edit_page_path({ :id => @page.title_for_url }) %><br />
|
<%= new_page_link -%><br />
|
||||||
<%= link_to 'Browse Pages', pages_path %><br />
|
<%= edit_page_link(@page) -%><br />
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
Reference in New Issue