From 790f9fb3de61bcea9c4a31a5c1bc1ef7d2c06e76 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 1 Feb 2008 05:21:09 +0000 Subject: [PATCH] using helper throughout git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@104 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7 --- app/helpers/application_helper.rb | 9 +++++++++ app/views/beers/show.rhtml | 2 +- app/views/breweries/show.rhtml | 4 +++- app/views/layouts/application.rhtml | 1 - app/views/peoples/show.rhtml | 3 +++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a2a213..dd0b4fc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -112,6 +112,15 @@ module ApplicationHelper block_to_partial('shared/lightbox', options, &block) end + ## + # Renders everything you need to display the TagImage browser. + # + def tagged_image_browser(obj) + javascript_include_tag('control.modal.js') + + render(:partial => 'shared/tagged_image_browser', + :locals => { :obj => obj }) + end + ## # Pagination link image browser thingey for the tagged image lightbox. # diff --git a/app/views/beers/show.rhtml b/app/views/beers/show.rhtml index 669aabb..e7d9e15 100644 --- a/app/views/beers/show.rhtml +++ b/app/views/beers/show.rhtml @@ -1,4 +1,4 @@ -<%= render :partial => 'shared/tagged_image_browser', :locals => { :obj => @beer } %> +<%= tagged_image_browser(@beer) %> <%= render :partial => 'pages/page' %> diff --git a/app/views/breweries/show.rhtml b/app/views/breweries/show.rhtml index e40d782..2ff5136 100644 --- a/app/views/breweries/show.rhtml +++ b/app/views/breweries/show.rhtml @@ -1,8 +1,10 @@ +<%= tagged_image_browser(@brewery) %> + <%= render :partial => 'pages/page' %> <% content_for :sidebar do -%> <%= new_brewery_link -%>
<%= edit_brewery_link(@brewery) -%>
<%= link_to 'Destroy', brewery_path(@brewery.page.title_for_url), :confirm => 'Are you sure?', :method => :delete %>
- <%= tagged_image_browser_link -%>
+ <% unless @brewery.tagged_images.empty? -%><%= tagged_image_browser_link -%>
<% end -%> <% end -%> diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 33e5281..1680b77 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -5,7 +5,6 @@ <%= stylesheet_link_tag 'application', :media => 'all' %> <%= javascript_include_tag :defaults %> - <%= javascript_include_tag 'control.modal.js' %> diff --git a/app/views/peoples/show.rhtml b/app/views/peoples/show.rhtml index 01a4ca2..bd48ad3 100644 --- a/app/views/peoples/show.rhtml +++ b/app/views/peoples/show.rhtml @@ -1,7 +1,10 @@ +<%= tagged_image_browser(@people) %> + <%= render :partial => 'pages/page' %> <% content_for :sidebar do -%> <%= new_people_link -%>
<%= edit_people_link(@people) %>
<%= link_to 'Destroy', people_path(@people.page.title_for_url), :confirm => 'Are you sure?', :method => :delete %>
+ <% unless @people.tagged_images.empty? -%><%= tagged_image_browser_link -%>
<% end -%> <% end -%> \ No newline at end of file