From 8e719d9e9a62254fd095b663c669de0c77e7166b Mon Sep 17 00:00:00 2001 From: lukemelia Date: Wed, 28 Mar 2007 05:08:55 +0000 Subject: [PATCH] Added message to contexts page when no contexts exist. Fixes #476. Also tweaked a couple of selenium login tests to make them work properly if run alone. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@488 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/contexts_controller.rb | 10 +++++++++- tracks/app/controllers/projects_controller.rb | 1 + tracks/app/views/contexts/create.rjs | 1 + tracks/app/views/contexts/index.rhtml | 3 +++ tracks/app/views/projects/index.rhtml | 2 -- tracks/public/stylesheets/standard.css | 2 +- tracks/test/selenium/login/login_failure.rsel | 1 + tracks/test/selenium/login/login_success.rsel | 1 + 8 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tracks/app/controllers/contexts_controller.rb b/tracks/app/controllers/contexts_controller.rb index 5f83ba15..b92d7107 100644 --- a/tracks/app/controllers/contexts_controller.rb +++ b/tracks/app/controllers/contexts_controller.rb @@ -11,7 +11,7 @@ class ContextsController < ApplicationController def index respond_to do |format| - format.html { @page_title = "TRACKS::List Contexts"; render } + format.html &render_contexts_html format.xml { render :xml => @contexts.to_xml( :except => :user_id ) } format.rss &render_contexts_rss_feed format.atom &render_contexts_atom_feed @@ -98,6 +98,14 @@ class ContextsController < ApplicationController protected + def render_contexts_html + lambda do + @page_title = "TRACKS::List Contexts" + @no_contexts = @contexts.empty? + render + end + end + def render_contexts_rss_feed lambda do render_rss_feed_for @contexts, :feed => Context.feed_options(@user), diff --git a/tracks/app/controllers/projects_controller.rb b/tracks/app/controllers/projects_controller.rb index 0cea2cc5..f9bee11f 100644 --- a/tracks/app/controllers/projects_controller.rb +++ b/tracks/app/controllers/projects_controller.rb @@ -136,6 +136,7 @@ class ProjectsController < ApplicationController @active_projects = @projects.select{ |p| p.active? } @hidden_projects = @projects.select{ |p| p.hidden? } @completed_projects = @projects.select{ |p| p.completed? } + @no_projects = @projects.empty? @projects.cache_note_counts @new_project = @user.projects.build render diff --git a/tracks/app/views/contexts/create.rjs b/tracks/app/views/contexts/create.rjs index 170fd716..ffcb013f 100644 --- a/tracks/app/views/contexts/create.rjs +++ b/tracks/app/views/contexts/create.rjs @@ -1,4 +1,5 @@ if @saved + page.hide 'contexts-empty-nd' page.insert_html :bottom, "list-contexts", :partial => 'context_listing', :locals => { :context_listing => @context } page.sortable "list-contexts", get_listing_sortable_options page.call "Form.reset", "context-form" diff --git a/tracks/app/views/contexts/index.rhtml b/tracks/app/views/contexts/index.rhtml index c107a7f6..6c5f0d26 100644 --- a/tracks/app/views/contexts/index.rhtml +++ b/tracks/app/views/contexts/index.rhtml @@ -1,5 +1,8 @@
+
+

Currently there are no contexts

+
<%= render :partial => 'context_listing', :collection => @contexts %>
diff --git a/tracks/app/views/projects/index.rhtml b/tracks/app/views/projects/index.rhtml index 350b68f6..59dd05a5 100644 --- a/tracks/app/views/projects/index.rhtml +++ b/tracks/app/views/projects/index.rhtml @@ -1,5 +1,3 @@ -<% @no_projects = @active_projects.empty? && @hidden_projects.empty? && @completed_projects.empty? %> -

Currently there are no projects

diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index 3728526a..8274b3c3 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -525,7 +525,7 @@ div.buttons, div.buttons a, div.buttons a:hover { background-color: transparent; } -div#list-active-projects, div#list-hidden-projects, div#list-completed-projects, div#list-contexts { +div#list-active-projects, div#list-hidden-projects, div#list-completed-projects, div#list-contexts, div#projects-empty-nd { border: 1px solid #999; } diff --git a/tracks/test/selenium/login/login_failure.rsel b/tracks/test/selenium/login/login_failure.rsel index 39d38c46..1c2e5f8b 100644 --- a/tracks/test/selenium/login/login_failure.rsel +++ b/tracks/test/selenium/login/login_failure.rsel @@ -1,3 +1,4 @@ +setup :fixtures => :all open :controller => 'login', :action => 'logout' open :controller => 'login' assert_title 'exact:TRACKS::Login' diff --git a/tracks/test/selenium/login/login_success.rsel b/tracks/test/selenium/login/login_success.rsel index 7c7257d6..b63074a9 100644 --- a/tracks/test/selenium/login/login_success.rsel +++ b/tracks/test/selenium/login/login_success.rsel @@ -1,3 +1,4 @@ +setup :fixtures => :all open :controller => 'login', :action => 'logout' open :controller => 'login' assert_title 'exact:TRACKS::Login'