diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb index 6368e227..256cb4e3 100644 --- a/tracks/app/controllers/todos_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -294,24 +294,20 @@ class TodosController < ApplicationController # def tag - @tag = tag_name = params[:name] - - if Tag.find_by_name(tag_name).nil? - # TODO: This doesn't work - you get kicked back to the index - # with a generic "Error occured on the server error" - notify :error, "Tag \'#{@tag}\' does not exist", 2.0 - @not_done_todos = [] - else - tag_collection = Tag.find_by_name(tag_name).todos - @not_done_todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active']) + @tag_name = params[:name] + @tag = Tag.find_by_name(@tag_name) + if @tag.nil? + @tag = Tag.new(:name => @tag_name) end + tag_collection = @tag.todos + @not_done_todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active']) @contexts = current_user.contexts.find(:all, :include => [ :todos ]) @contexts_to_show = @contexts.reject {|x| x.hide? } @deferred = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'deferred']) - @page_title = "TRACKS::Tagged with \'#{@tag}\'" + @page_title = "TRACKS::Tagged with \'#{@tag_name}\'" # If you've set no_completed to zero, the completed items box # isn't shown on the home page max_completed = current_user.prefs.show_number_completed diff --git a/tracks/app/views/todos/tag.rhtml b/tracks/app/views/todos/tag.rhtml index 16f407ab..1ed6378d 100644 --- a/tracks/app/views/todos/tag.rhtml +++ b/tracks/app/views/todos/tag.rhtml @@ -3,19 +3,19 @@

No actions found

-

Currently there are no incomplete actions with the tag '<%= @tag %>'

+

Currently there are no incomplete actions with the tag '<%= @tag_name %>'

<%= render :partial => "contexts/context", :collection => @contexts_to_show, :locals => { :collapsible => true } %> <% unless @deferred.nil? -%> - <%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag}’" } %> + <%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag_name}’" } %> <% end -%> <% unless @done.nil? -%> <%= render :partial => "todos/completed", - :locals => { :done => @done, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag}’" } %> + :locals => { :done => @done, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag_name}’" } %> <% end -%> diff --git a/tracks/test/selenium/tags/open_starred_tags_without_anything_starred.rsel b/tracks/test/selenium/tags/open_starred_tags_without_anything_starred.rsel new file mode 100644 index 00000000..de8fbeda --- /dev/null +++ b/tracks/test/selenium/tags/open_starred_tags_without_anything_starred.rsel @@ -0,0 +1,6 @@ +setup :fixtures => [:users, :projects, :contexts, :todos, :notes] +login :as => 'admin' +open "/" +click_and_wait "xpath=//ul[@id='navlist'] //a[@title='See your starred actions']" +assert_title "exact:TRACKS::Tagged with 'starred'" +verify_text_present "Currently there are no incomplete actions with the tag 'starred'"