get some wip cucumber tests running

This commit is contained in:
Reinier Balt 2011-04-14 16:26:16 +02:00
parent 1372bb110e
commit c0115eacd7
11 changed files with 273 additions and 179 deletions

View file

@ -107,6 +107,7 @@ class TodosController < ApplicationController
end end
@todo.reload if @saved @todo.reload if @saved
@todo_was_created_deferred = @todo.deferred?
respond_to do |format| respond_to do |format|
format.html { redirect_to :action => "index" } format.html { redirect_to :action => "index" }
@ -415,7 +416,8 @@ class TodosController < ApplicationController
@original_item_due = @todo.due @original_item_due = @todo.due
@context_id = @todo.context_id @context_id = @todo.context_id
@project_id = @todo.project_id @project_id = @todo.project_id
@todo_was_destroyed_from_deferred_state = @todo.deferred?
# activate successors if they only depend on this todo # activate successors if they only depend on this todo
activated_successor_count = 0 activated_successor_count = 0
@pending_to_activate = [] @pending_to_activate = []

View file

@ -354,11 +354,11 @@ module TodosHelper
source_view do |page| source_view do |page|
page.project { 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" return "p#{todo.project_id}empty-nd"
} }
page.tag { 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 "hidden-empty-nd" if @todo.hidden?
return "c#{todo.context_id}empty-nd" return "c#{todo.context_id}empty-nd"
} }

View file

@ -31,8 +31,10 @@ function insert_new_context_with_new_todo() {
function add_todo_to_existing_context() { function add_todo_to_existing_context() {
<% if source_view_is_one_of(:todo, :deferred, :tag) -%> <% if source_view_is_one_of(:todo, :deferred, :tag) -%>
$('#c<%= @todo.context_id %>').fadeIn(500, function() {}); <% unless source_view_is_one_of(:todo, :tag) && @todo.deferred? -%>
$('#no_todos_in_view').slideUp(100); $('#c<%= @todo.context_id %>').fadeIn(500, function() {});
$('#no_todos_in_view').slideUp(100);
<% end -%>
<% end -%> <% end -%>
$('#<%=empty_container_msg_div_id%>').hide(); $('#<%=empty_container_msg_div_id%>').hide();
$('#<%=item_container_id(@todo)%>').append(html_for_new_todo()); $('#<%=item_container_id(@todo)%>').append(html_for_new_todo());

View file

@ -31,18 +31,20 @@ function show_empty_messages() {
} }
function remove_todo_from_page() { 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 # remove context with deleted todo
-%> -%>
$('#c<%=@todo.context_id%>').fadeOut(1000, function() { $('#c<%=@todo.context_id%>').fadeOut(400, function() {
$('#<%=dom_id(@todo)%>').remove(); $('#<%=dom_id(@todo)%>').remove();
}); });
<% else <%= show_empty_message_in_source_container -%>
<% else
# remove only the todo # 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(); $('#<%=dom_id(@todo)%>').remove();
}); });
<% end -%> <% end -%>
} }

View file

@ -20,11 +20,44 @@ Feature: Edit a next action from every page
When I delete the action "delete me" When I delete the action "delete me"
Then I should not see "delete me" Then I should not see "delete me"
Scenario: Removing the last todo in context will hide context # delete, edit @selenium
Given this is a pending scenario 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 @selenium
Given this is a pending scenario 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 <page>
Then I should not see "<empty message>"
And I should see "first action"
When I delete the todo "first action"
Then I should not see "<empty message>"
When I delete the todo "second action"
Then I should see "<empty message>"
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 @selenium
Scenario Outline: I can mark an active todo complete and it will update empty messages 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 | | tag page for "starred" | No actions found |
| context page for "visible context" | Currently there are no incomplete actions in this context | | 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 Scenario Outline: I can mark a deferred todo complete and it will update empty messages
When I go to the <page> # 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 <page> # not for home page or context because it does not show deferred todos
Then I should see "<empty message>" Then I should see "<empty message>"
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" Then I should see "visible todo"
And I should not see "<empty message>" And I should not see "<empty message>"
When I mark "visible todo" complete When I mark "visible todo" as complete
Then I should not see "visible context"
And I should see "<empty message>" And I should see "<empty message>"
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 | | page | empty message |
| tag page for "starred" | Currently there are no deferred or pending actions | | 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 | | "visible project" project | Currently there are no deferred or pending actions |
| project page for "visible project" | Currently there are no deferred or pending actions |
@selenium @wip @selenium @wip
Scenario Outline: I can mark a completed todo active and it will update empty messages 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 When I mark the complete todo "visible todo" active
Then I should see "visible context" Then I should see "visible context"
And I should see "<empty completed message>" And I should see "<empty completed message>"
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 "<empty message>" And I should not see "<empty message>"
Scenarios: Scenarios:

View file

@ -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

View file

@ -28,40 +28,8 @@ Then /^I should see the empty message in the deferred container$/ do
end end
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| Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
xpath = "//div[@id='message_holder']/h4[@id='flash']" xpath = "//div[@id='message_holder']/h4[@id='flash']"
text = response.selenium.get_text("xpath=#{xpath}") text = response.selenium.get_text("xpath=#{xpath}")
text.should == message text.should == message
end 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

View file

@ -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

View file

@ -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

View file

@ -71,116 +71,35 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
end end
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| 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 = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil todo.should_not be_nil
check "mark_complete_#{todo.id}" 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 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 end
# note that animations could be running after finishing this # note that animations could be running after finishing this
end end
@ -198,6 +117,10 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
end end
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| Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i| count.to_i.downto 1 do |i|
match_xpath "div[" 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 @current_user.todos.count.should == count.to_i
end 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| 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?" selenium.get_confirmation.should == "New context '#{context_name}' will be also created. Are you sure?"
end end

View file

@ -7,11 +7,14 @@ module NavigationHelpers
# #
def path_to(page_name) def path_to(page_name)
options = @mobile_interface ? {:format => :m} : {} options = @mobile_interface ? {:format => :m} : {}
@source_view = nil
case page_name case page_name
when /the home\s?page/ when /the home\s?page/
@source_view = "todos"
root_path(options) root_path(options)
when /the statistics page/ when /the statistics page/
@source_view = "stats"
stats_path(options) stats_path(options)
when /the signup page/ when /the signup page/
signup_path(options) signup_path(options)
@ -20,8 +23,10 @@ module NavigationHelpers
when /the notes page/ when /the notes page/
notes_path(options) notes_path(options)
when /the contexts page/ when /the contexts page/
@source_view = "contexts"
contexts_path(options) contexts_path(options)
when /the projects page/ when /the projects page/
@source_view = "projects"
projects_path(options) projects_path(options)
when /the manage users page/ when /the manage users page/
users_path(options) users_path(options)
@ -44,15 +49,20 @@ module NavigationHelpers
when /the feeds page/ when /the feeds page/
feeds_path(options) feeds_path(options)
when /the context page for "([^\"]*)" for user "([^\"]*)"/i when /the context page for "([^\"]*)" for user "([^\"]*)"/i
@source_view = "context"
context_path(User.find_by_login($2).contexts.find_by_name($1), options) context_path(User.find_by_login($2).contexts.find_by_name($1), options)
when /the context page for "([^\"]*)"/i when /the context page for "([^\"]*)"/i
@source_view = "context"
context_path(@current_user.contexts.find_by_name($1), options) context_path(@current_user.contexts.find_by_name($1), options)
when /the "([^\"]*)" project for user "([^\"]*)"/i when /the "([^\"]*)" project for user "([^\"]*)"/i
@source_view = "project"
project_path(User.find_by_login($2).projects.find_by_name($1), options) project_path(User.find_by_login($2).projects.find_by_name($1), options)
when /the "([^\"]*)" project/i when /the "([^\"]*)" project/i
@source_view = "project"
@project = @current_user.projects.find_by_name($1) @project = @current_user.projects.find_by_name($1)
project_path(@project, options) project_path(@project, options)
when /the tag page for "([^"]*)"/i when /the tag page for "([^"]*)"/i
@source_view = "tag"
tag_path($1, options) tag_path($1, options)
# Add more mappings here. # Add more mappings here.