diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 26bbaaf8..d0a558b1 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -107,6 +107,7 @@ class TodosController < ApplicationController end @todo.reload if @saved + @todo_was_created_deferred = @todo.deferred? respond_to do |format| format.html { redirect_to :action => "index" } @@ -415,7 +416,8 @@ class TodosController < ApplicationController @original_item_due = @todo.due @context_id = @todo.context_id @project_id = @todo.project_id - + @todo_was_destroyed_from_deferred_state = @todo.deferred? + # activate successors if they only depend on this todo activated_successor_count = 0 @pending_to_activate = [] diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 06c1bf5c..547bb62b 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -354,11 +354,11 @@ module TodosHelper source_view do |page| page.project { - return "tickler-empty-nd" if @todo_was_deferred_from_active_state || @todo_was_blocked_from_active_state + return "tickler-empty-nd" if @todo_was_deferred_from_active_state || @todo_was_blocked_from_active_state || @todo_was_destroyed_from_deferred_state || @todo_was_created_deferred return "p#{todo.project_id}empty-nd" } page.tag { - return "tickler-empty-nd" if @todo_was_deferred_from_active_state + return "tickler-empty-nd" if @todo_was_deferred_from_active_state || @todo_was_destroyed_from_deferred_state || @todo_was_created_deferred return "hidden-empty-nd" if @todo.hidden? return "c#{todo.context_id}empty-nd" } diff --git a/app/views/todos/create.js.erb b/app/views/todos/create.js.erb index f6bc0d85..c8b22407 100644 --- a/app/views/todos/create.js.erb +++ b/app/views/todos/create.js.erb @@ -31,8 +31,10 @@ function insert_new_context_with_new_todo() { function add_todo_to_existing_context() { <% if source_view_is_one_of(:todo, :deferred, :tag) -%> - $('#c<%= @todo.context_id %>').fadeIn(500, function() {}); - $('#no_todos_in_view').slideUp(100); + <% unless source_view_is_one_of(:todo, :tag) && @todo.deferred? -%> + $('#c<%= @todo.context_id %>').fadeIn(500, function() {}); + $('#no_todos_in_view').slideUp(100); + <% end -%> <% end -%> $('#<%=empty_container_msg_div_id%>').hide(); $('#<%=item_container_id(@todo)%>').append(html_for_new_todo()); diff --git a/app/views/todos/destroy.js.erb b/app/views/todos/destroy.js.erb index 93bfe6d6..3ff53768 100644 --- a/app/views/todos/destroy.js.erb +++ b/app/views/todos/destroy.js.erb @@ -31,18 +31,20 @@ function show_empty_messages() { } function remove_todo_from_page() { - <% if (@remaining_in_context == 0) + <% if (@remaining_in_context == 0) && update_needs_to_hide_context # remove context with deleted todo -%> - $('#c<%=@todo.context_id%>').fadeOut(1000, function() { + $('#c<%=@todo.context_id%>').fadeOut(400, function() { $('#<%=dom_id(@todo)%>').remove(); }); - <% else + <%= show_empty_message_in_source_container -%> + <% else # remove only the todo -%> - $('#<%=dom_id(@todo)%>').slideUp(1000, function() { + <%= show_empty_message_in_source_container %> + $('#<%=dom_id(@todo)%>').slideUp(400, function() { $('#<%=dom_id(@todo)%>').remove(); - }); + }); <% end -%> } diff --git a/features/edit_a_todo.feature b/features/edit_a_todo.feature index 2d70fddd..a2441a5c 100644 --- a/features/edit_a_todo.feature +++ b/features/edit_a_todo.feature @@ -20,11 +20,44 @@ Feature: Edit a next action from every page When I delete the action "delete me" Then I should not see "delete me" - Scenario: Removing the last todo in context will hide context # delete, edit - Given this is a pending scenario + @selenium + Scenario: Removing the last todo in context will hide context + Given I have a todo "delete me" in the context "@home" + And I have a context called "@pc" + When I go to the home page + Then I should see the container for context "@home" + And I should see "delete me" in the context container for "@home" + When I mark "delete me" as complete + Then I should not see the container for context "@home" + When I mark "delete me" as uncompleted + Then I should see the container for context "@home" + When I edit the context of "delete me" to "@pc" + Then I should not see the container for context "@home" + When I delete the todo "delete me" + Then I should not see "delete me" + And I should not see the container for context "@home" + And I should not see the container for context "@pc" - Scenario: Deleting the last todo in container will show empty message # only project, context, tag, not todo - Given this is a pending scenario + @selenium + Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo + Given I have a context called "@home" + And I have a project "my project" that has the following todos + | context | description | tags | + | @home | first action | test, bla | + | @home | second action | bla | + When I go to the + Then I should not see "" + And I should see "first action" + When I delete the todo "first action" + Then I should not see "" + When I delete the todo "second action" + Then I should see "" + + Scenarios: + | page | empty message | + | "my project" project | Currently there are no incomplete actions in this project | + | context page for "@home" | Currently there are no incomplete actions in this context | + | tag page for "bla" | No actions found | @selenium Scenario Outline: I can mark an active todo complete and it will update empty messages @@ -46,23 +79,23 @@ Feature: Edit a next action from every page | tag page for "starred" | No actions found | | context page for "visible context" | Currently there are no incomplete actions in this context | - @selenium @wip + @selenium Scenario Outline: I can mark a deferred todo complete and it will update empty messages - When I go to the # not for home page because it does not show deferred todos + Given I have a context called "visible context" + And I have a project called "visible project" + When I go to the # not for home page or context because it does not show deferred todos Then I should see "" - When I submit a new deferred action with description "visible todo" to project "visible project" with tags "test" in the context "visible context" + When I submit a new deferred action with description "visible todo" to project "visible project" with tags "starred" in the context "visible context" Then I should see "visible todo" And I should not see "" - When I mark "visible todo" complete - Then I should not see "visible context" + When I mark "visible todo" as complete And I should see "" - And I should see "visible todo" in the completed todos container + And I should see "visible todo" in the completed container - Scenarios: + Scenarios: | page | empty message | | tag page for "starred" | Currently there are no deferred or pending actions | - | context page for "visible context" | Currently there are no deferred or pending actions | - | project page for "visible project" | Currently there are no deferred or pending actions | + | "visible project" project | Currently there are no deferred or pending actions | @selenium @wip Scenario Outline: I can mark a completed todo active and it will update empty messages @@ -74,7 +107,7 @@ Feature: Edit a next action from every page When I mark the complete todo "visible todo" active Then I should see "visible context" And I should see "" - And I should see "visible todo" in context container for "visible context" + And I should see "visible todo" in the context container for "visible context" And I should not see "" Scenarios: diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb new file mode 100644 index 00000000..03c8d308 --- /dev/null +++ b/features/step_definitions/container_steps.rb @@ -0,0 +1,53 @@ +Then /^I should not see the context "([^"]*)"$/ do |context_name| + context = @current_user.contexts.find_by_name(context_name) + context.should_not be_nil + wait_for :timeout => 5 do + !selenium.is_visible("xpath=//div[@id='c#{context.id}']") + end +end + +Then /^I should not see the container for context "([^"]*)"$/ do |context_name| + Then "I should not see the context \"#{context_name}\"" +end + +Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name| + Then "I should not see the context \"#{context_name}\"" +end + +Then /^I should see the container for context "([^"]*)"$/ do |context_name| + context = @current_user.contexts.find_by_name(context_name) + context.should_not be_nil + + xpath = "xpath=//div[@id='c#{context.id}']" + + selenium.wait_for_element(xpath, :timeout_in_seconds => 5) + selenium.is_visible(xpath).should be_true +end + +Then /^the container for the context "([^"]*)" should be visible$/ do |context_name| + Then "I should see the container for context \"#{context_name}\"" +end + +Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_description, context_name| + context = @current_user.contexts.find_by_name(context_name) + context.should_not be_nil + todo = @current_user.todos.find_by_description(todo_description) + todo.should_not be_nil + + xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']" + selenium.wait_for_element(xpath, :timeout_in_seconds => 5) + selenium.is_visible(xpath).should be_true +end + +Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_description, project_name| + todo = @current_user.todos.find_by_description(todo_description) + todo.should_not be_nil + + project = @current_user.projects.find_by_name(project_name) + project.should_not be_nil + + xpath = "//div[@id='p#{project.id}items']//div[@id='line_todo_#{todo.id}']" + + selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5) + selenium.is_visible(xpath).should be_true +end \ No newline at end of file diff --git a/features/step_definitions/generic_steps.rb b/features/step_definitions/generic_steps.rb index be22dcdc..a7568a57 100644 --- a/features/step_definitions/generic_steps.rb +++ b/features/step_definitions/generic_steps.rb @@ -28,40 +28,8 @@ Then /^I should see the empty message in the deferred container$/ do end end -Then /^I should not see the context "([^"]*)"$/ do |context_name| - context = @current_user.contexts.find_by_name(context_name) - wait_for :timeout => 5 do - !selenium.is_visible("xpath=//div[@id='c#{context.id}']") - end -end - Then /^I should see an error flash message saying "([^"]*)"$/ do |message| xpath = "//div[@id='message_holder']/h4[@id='flash']" text = response.selenium.get_text("xpath=#{xpath}") text.should == message end - -Then /^I should see "([^"]*)" in context container for "([^"]*)"$/ do |todo_description, context_name| - context = @current_user.contexts.find_by_name(context_name) - context.should_not be_nil - todo = @current_user.todos.find_by_description(todo_description) - todo.should_not be_nil - - xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']" - selenium.wait_for_element(xpath, :timeout_in_seconds => 5) - selenium.is_visible(xpath).should be_true -end - -Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_description, project_name| - todo = @current_user.todos.find_by_description(todo_description) - todo.should_not be_nil - - project = @current_user.projects.find_by_name(project_name) - project.should_not be_nil - - xpath = "//div[@id='p#{project.id}items']//div[@id='line_todo_#{todo.id}']" - - selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5) - selenium.is_visible(xpath).should be_true -end - diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb new file mode 100644 index 00000000..93ede4be --- /dev/null +++ b/features/step_definitions/todo_create_steps.rb @@ -0,0 +1,83 @@ +When /^I submit a new action with description "([^"]*)"$/ do |description| + fill_in "todo[description]", :with => description + submit_next_action_form +end + +When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| + fill_in "todo[description]", :with => description + fill_in "tag_list", :with => tags + + # fill_in does not seem to work when the field is prefilled with something. Empty the field first + clear_context_name_from_next_action_form + fill_in "todo_context_name", :with => context_name + submit_next_action_form +end + +When /^I submit a new deferred action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| + fill_in "todo[description]", :with => description + + clear_context_name_from_next_action_form + fill_in "todo_context_name", :with => context_name + + fill_in "tag_list", :with => tags + fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week) + submit_next_action_form +end + +When /^I submit a new deferred action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name| + fill_in "todo[description]", :with => description + + clear_project_name_from_next_action_form + clear_context_name_from_next_action_form + + fill_in "todo_project_name", :with => project_name + fill_in "todo_context_name", :with => context_name + fill_in "tag_list", :with => tags + fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week) + + submit_next_action_form +end + +When /^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name| + fill_in "todo[description]", :with => description + + clear_project_name_from_next_action_form + clear_context_name_from_next_action_form + + fill_in "todo_project_name", :with => project_name + fill_in "todo_context_name", :with => context_name + fill_in "tag_list", :with => tags + + submit_next_action_form +end + +When /^I submit a new action with description "([^"]*)" in the context "([^"]*)"$/ do |description, context_name| + fill_in "todo[description]", :with => description + + clear_context_name_from_next_action_form + fill_in "todo_context_name", :with => context_name + + submit_next_action_form +end + +When /^I submit multiple actions with using$/ do |multiple_actions| + fill_in "todo[multiple_todos]", :with => multiple_actions + submit_multiple_next_action_form +end + +When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags| + fill_in "todo[multiple_todos]", :with => descriptions + fill_in "multi_todo_project_name", :with => project_name + fill_in "multi_todo_context_name", :with => context_name + fill_in "multi_tag_list", :with => tags +end + +When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags| + When "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\"" + submit_multiple_next_action_form +end + +When /^I submit the new multiple actions form with$/ do |multi_line_descriptions| + fill_in "todo[multiple_todos]", :with => multi_line_descriptions + submit_multiple_next_action_form +end diff --git a/features/step_definitions/todo_edit_steps.rb b/features/step_definitions/todo_edit_steps.rb new file mode 100644 index 00000000..d3ac64ee --- /dev/null +++ b/features/step_definitions/todo_edit_steps.rb @@ -0,0 +1,36 @@ +When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo_name, new_value| + todo = @current_user.todos.find_by_description(todo_name) + todo.should_not be_nil + + open_edit_form_for(todo) + selenium.type("css=form.edit_todo_form input[name=#{field_name}]", new_value) + submit_edit_todo_form(todo) +end + +When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |context_old_name, context_new_name| + When "I change the context_name field of \"#{context_old_name}\" to \"#{context_new_name}\"" +end + +When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description| + todo = @current_user.todos.find_by_description(action_description) + todo.should_not be_nil + open_edit_form_for(todo) + fill_in "due_todo_#{todo.id}", :with => format_date(todo.created_at + 1.day) + submit_edit_todo_form(todo) +end + +When /^I edit the due date of "([^"]*)" to next month$/ do |action_description| + todo = @current_user.todos.find_by_description(action_description) + todo.should_not be_nil + open_edit_form_for(todo) + fill_in "due_todo_#{todo.id}", :with => format_date(todo.created_at + 1.month) + submit_edit_todo_form(todo) +end + +When /^I clear the due date of "([^"]*)"$/ do |action_description| + todo = @current_user.todos.find_by_description(action_description) + todo.should_not be_nil + open_edit_form_for(todo) + selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery) + submit_edit_todo_form(todo) +end diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index acedd92c..d0f27b4a 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -71,116 +71,35 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na end end -When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo_name, new_value| - todo = @current_user.todos.find_by_description(todo_name) - todo.should_not be_nil - - open_edit_form_for(todo) - selenium.type("css=form.edit_todo_form input[name=#{field_name}]", new_value) - submit_edit_todo_form(todo) -end - -When /^I submit a new action with description "([^"]*)"$/ do |description| - fill_in "todo[description]", :with => description - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| - fill_in "todo[description]", :with => description - fill_in "tag_list", :with => tags - - # fill_in does not seem to work when the field is prefilled with something. Empty the field first - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - submit_next_action_form -end - -When /^I submit a new deferred action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| - fill_in "todo[description]", :with => description - - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - - fill_in "tag_list", :with => tags - fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week) - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name| - fill_in "todo[description]", :with => description - - clear_project_name_from_next_action_form - clear_context_name_from_next_action_form - - fill_in "todo_project_name", :with => project_name - fill_in "todo_context_name", :with => context_name - fill_in "tag_list", :with => tags - - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" in the context "([^"]*)"$/ do |description, context_name| - fill_in "todo[description]", :with => description - - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - - submit_next_action_form -end - -When /^I submit multiple actions with using$/ do |multiple_actions| - fill_in "todo[multiple_todos]", :with => multiple_actions - submit_multiple_next_action_form -end - -When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags| - fill_in "todo[multiple_todos]", :with => descriptions - fill_in "multi_todo_project_name", :with => project_name - fill_in "multi_todo_context_name", :with => context_name - fill_in "multi_tag_list", :with => tags -end - -When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags| - When "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\"" - submit_multiple_next_action_form -end - -When /^I submit the new multiple actions form with$/ do |multi_line_descriptions| - fill_in "todo[multiple_todos]", :with => multi_line_descriptions - submit_multiple_next_action_form -end - -When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description| - todo = @current_user.todos.find_by_description(action_description) - todo.should_not be_nil - open_edit_form_for(todo) - fill_in "due_todo_#{todo.id}", :with => format_date(todo.created_at + 1.day) - submit_edit_todo_form(todo) -end - -When /^I edit the due date of "([^"]*)" to next month$/ do |action_description| - todo = @current_user.todos.find_by_description(action_description) - todo.should_not be_nil - open_edit_form_for(todo) - fill_in "due_todo_#{todo.id}", :with => format_date(todo.created_at + 1.month) - submit_edit_todo_form(todo) -end - -When /^I clear the due date of "([^"]*)"$/ do |action_description| - todo = @current_user.todos.find_by_description(action_description) - todo.should_not be_nil - open_edit_form_for(todo) - selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery) - submit_edit_todo_form(todo) -end - When /^I mark "([^"]*)" as complete$/ do |action_description| - # TODO: generalize. this currently only works for projects wrt xpath todo = @current_user.todos.find_by_description(action_description) todo.should_not be_nil + check "mark_complete_#{todo.id}" + + todo_container = "fail" # fail this test if @source_view is wrong + todo_container = "p#{todo.project_id}items" if @source_view=="project" + todo_container = "c#{todo.context_id}items" if @source_view=="context" || @source_view=="todos" || @source_view=="tag" + + # container should be there + selenium.is_element_present("//div[@id='#{todo_container}']").should be_true + wait_for :timeout => 5 do - !selenium.is_element_present("//div[@id='p#{todo.project.id}items']//div[@id='line_todo_#{todo.id}']") + !selenium.is_element_present("//div[@id='#{todo_container}']//div[@id='line_todo_#{todo.id}']") + end + # note that animations could be running after finishing this +end + +When /^I mark "([^"]*)" as uncompleted$/ do |action_description| + # TODO: generalize. this currently only works for context wrt xpath + todo = @current_user.todos.find_by_description(action_description) + todo.should_not be_nil + + check "mark_complete_#{todo.id}" + + xpath="//div[@id='c#{todo.context_id}items']//div[@id='line_todo_#{todo.id}']" + wait_for :timeout => 5 do + selenium.is_element_present(xpath) end # note that animations could be running after finishing this end @@ -198,6 +117,10 @@ When /^I delete the action "([^"]*)"$/ do |action_description| end end +When /^I delete the todo "([^"]*)"$/ do |action_description| + When "I delete the action \"#{action_description}\"" +end + Then /^I should see ([0-9]+) todos$/ do |count| count.to_i.downto 1 do |i| match_xpath "div[" @@ -224,24 +147,6 @@ Then /^the number of actions should be (\d+)$/ do |count| @current_user.todos.count.should == count.to_i end -Then /^the container for the context "([^"]*)" should be visible$/ do |context_name| - context = @current_user.contexts.find_by_name(context_name) - context.should_not be_nil - xpath = "xpath=//div[@id=\"c#{context.id}\"]" - selenium.wait_for_element(xpath, :timeout_in_seconds => 5) - selenium.is_visible(xpath).should be_true -end - -Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name| - context = @current_user.contexts.find_by_name(context_name) - context.should_not be_nil - - wait_for_ajax - - xpath = "xpath=//div[@id=\"c#{context.id}\"]" - selenium.is_element_present(xpath).should be_false -end - Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name| selenium.get_confirmation.should == "New context '#{context_name}' will be also created. Are you sure?" end diff --git a/features/support/paths.rb b/features/support/paths.rb index 3ec5f54e..3d195d23 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -7,11 +7,14 @@ module NavigationHelpers # def path_to(page_name) options = @mobile_interface ? {:format => :m} : {} + @source_view = nil case page_name when /the home\s?page/ + @source_view = "todos" root_path(options) when /the statistics page/ + @source_view = "stats" stats_path(options) when /the signup page/ signup_path(options) @@ -20,8 +23,10 @@ module NavigationHelpers when /the notes page/ notes_path(options) when /the contexts page/ + @source_view = "contexts" contexts_path(options) when /the projects page/ + @source_view = "projects" projects_path(options) when /the manage users page/ users_path(options) @@ -44,15 +49,20 @@ module NavigationHelpers when /the feeds page/ feeds_path(options) when /the context page for "([^\"]*)" for user "([^\"]*)"/i + @source_view = "context" context_path(User.find_by_login($2).contexts.find_by_name($1), options) when /the context page for "([^\"]*)"/i + @source_view = "context" context_path(@current_user.contexts.find_by_name($1), options) when /the "([^\"]*)" project for user "([^\"]*)"/i + @source_view = "project" project_path(User.find_by_login($2).projects.find_by_name($1), options) when /the "([^\"]*)" project/i + @source_view = "project" @project = @current_user.projects.find_by_name($1) project_path(@project, options) when /the tag page for "([^"]*)"/i + @source_view = "tag" tag_path($1, options) # Add more mappings here.