From 68e9d000de68ba5264cce08ff3999f0d5b4c099f Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 27 Jan 2008 07:36:47 +0000 Subject: [PATCH] using flash to display empty model set git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@100 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7 --- app/controllers/beers_controller.rb | 3 +++ app/controllers/breweries_controller.rb | 5 +++-- app/views/beers/index.rhtml | 6 +----- app/views/breweries/index.rhtml | 4 ---- app/views/peoples/index.rhtml | 4 ---- app/views/roles/index.rhtml | 8 +------- 6 files changed, 8 insertions(+), 22 deletions(-) diff --git a/app/controllers/beers_controller.rb b/app/controllers/beers_controller.rb index bc67e3b..2095adb 100644 --- a/app/controllers/beers_controller.rb +++ b/app/controllers/beers_controller.rb @@ -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| diff --git a/app/controllers/breweries_controller.rb b/app/controllers/breweries_controller.rb index eb1e524..3c24d90 100644 --- a/app/controllers/breweries_controller.rb +++ b/app/controllers/breweries_controller.rb @@ -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 } diff --git a/app/views/beers/index.rhtml b/app/views/beers/index.rhtml index 01d5c8b..bc94949 100644 --- a/app/views/beers/index.rhtml +++ b/app/views/beers/index.rhtml @@ -1,9 +1,5 @@ <%= render :partial => 'shared/pagination_links' %> diff --git a/app/views/breweries/index.rhtml b/app/views/breweries/index.rhtml index 424c9e5..b52df6d 100644 --- a/app/views/breweries/index.rhtml +++ b/app/views/breweries/index.rhtml @@ -1,9 +1,5 @@ <%= render :partial => 'shared/pagination_links' %> diff --git a/app/views/peoples/index.rhtml b/app/views/peoples/index.rhtml index 4de464e..f702097 100644 --- a/app/views/peoples/index.rhtml +++ b/app/views/peoples/index.rhtml @@ -1,9 +1,5 @@ <%= render :partial => 'shared/pagination_links' %> diff --git a/app/views/roles/index.rhtml b/app/views/roles/index.rhtml index 3ba92af..c6dec99 100644 --- a/app/views/roles/index.rhtml +++ b/app/views/roles/index.rhtml @@ -1,11 +1,5 @@ <% content_for :sidebar do -%>