using flash to display empty model set

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@100 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2008-01-27 07:36:47 +00:00
parent 4de6c9a57a
commit 68e9d000de
6 changed files with 8 additions and 22 deletions

View File

@ -9,6 +9,9 @@ class BeersController < ApplicationController
@secondary_title = 'Browsing all beers'
@pages, @beers = paginate :beers, :include => 'page', :per_page => per_page,
:order => 'beers.title ASC'
if @beers.empty?
flash.now[:notice] = 'There are no beers yet.'
end
@tags = Page.tags(:limit => 25, :order => "name DESC",
:owner_type => 'Beer')
respond_to do |format|

View File

@ -9,10 +9,11 @@ class BreweriesController < ApplicationController
@secondary_title = 'Browsing all breweries'
@pages, @breweries = paginate :breweries, :include => 'page',
:order => 'breweries.title ASC', :per_page => per_page
if @breweries.empty?
flash.now[:notice] = 'There are no breweries yet.'
end
@tags = Page.tags(:limit => 25, :order => "name DESC",
:owner_type => 'Beer')
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @breweries.to_xml }

View File

@ -1,9 +1,5 @@
<ul>
<% unless @beers.empty? -%>
<% for beer in @beers %><li><%= link_to beer.title, beer_path(beer.page.title_for_url) %></li><% end -%>
<% else -%>
<li>No beers, yet</li>
<% end -%>
<% for beer in @beers %><li><%= link_to beer.title, beer_path(beer.page.title_for_url) %></li><% end %>
</ul>
<%= render :partial => 'shared/pagination_links' %>

View File

@ -1,9 +1,5 @@
<ul>
<% unless @breweries.empty? -%>
<% for brewery in @breweries %><li><%= show_brewery_link(brewery) -%></li><% end -%>
<% else -%>
<li>No breweries, yet.</li>
<% end -%>
</ul>
<%= render :partial => 'shared/pagination_links' %>

View File

@ -1,9 +1,5 @@
<ul>
<% unless @peoples.empty? -%>
<% for people in @peoples -%><li><%= show_people_link(people) -%></li><% end %>
<% else -%>
<li>No people, yet!</li>
<% end -%>
</ul>
<%= render :partial => 'shared/pagination_links' %>

View File

@ -1,11 +1,5 @@
<ul>
<% unless @roles.empty? -%>
<% for role in @roles %>
<li><%= show_role_link(role) -%></li>
<% end %>
<% else -%>
<li>No roles, yet.</li>
<% end -%>
<% for role in @roles -%><li><%= show_role_link(role) -%></li><% end %>
</ul>
<% content_for :sidebar do -%>