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