fix #1242 by fixing all the routing from the review button

This commit is contained in:
Reinier Balt 2012-03-29 16:05:17 +02:00
parent 923919e802
commit af10e74017
4 changed files with 49 additions and 3 deletions

View file

@ -74,7 +74,17 @@ class ProjectsController < ApplicationController
def set_reviewed def set_reviewed
@project.last_reviewed = Time.zone.now @project.last_reviewed = Time.zone.now
@project.save @project.save
redirect_to :action => 'show'
case @source_view
when "project"
redirect_to :action => 'show'
when "project_list"
redirect_to :action => 'index'
when "review"
redirect_to :action => 'review'
else
redirect_to :action => 'index'
end
end end
def projects_and_actions def projects_and_actions

View file

@ -40,7 +40,7 @@ project = project_form
<%=image_tag("cancel.png", :alt => "") %> <%=image_tag("cancel.png", :alt => "") %>
Cancel Cancel
</a> </a>
<a href="<%=set_reviewed_project_path(project)%>" id="<%= dom_id(project, 'reviewed') %>" class="reviewed"> <a href="<%=set_reviewed_project_path(project)+"?_source_view=#{@source_view}"%>" id="<%= dom_id(project, 'reviewed') %>" class="reviewed">
<%=image_tag("reviewed.png", :alt => "") %> <%=image_tag("reviewed.png", :alt => "") %>
Reviewed Reviewed
</a> </a>

View file

@ -34,3 +34,27 @@ Feature: Reviewing projects
Given I have an outdated project "dated_project" with 1 todos Given I have an outdated project "dated_project" with 1 todos
When I go to the review page When I go to the review page
And the badge should show 5 ## note that stalled and blocked projects are also up-to-date listed And the badge should show 5 ## note that stalled and blocked projects are also up-to-date listed
@javascript
Scenario: I can mark a project as reviewed from the projects list page
Given I have a project called "review me"
When I go to the projects page
Then I should see "review me"
When I edit project "review me" and mark the project as reviewed
Then I should be on the projects page
And I should see "review me"
@javascript
Scenario: I can mark a project as reviewed from the project page
Given I have a project called "review me"
When I go to the "review me" project
When I edit project settings and mark the project as reviewed
Then I should be on the "review me" project
@javascript
Scenario: I can mark a project as reviewed from the review page
Given I have an outdated project "review me" with 1 todos
When I go to the review page
Then I should see "review me"
When I edit project "review me" and mark the project as reviewed
Then I should be on the review page

View file

@ -164,7 +164,6 @@ When /^I edit the project settings$/ do
page.should have_xpath("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']") page.should have_xpath("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
end end
When /^I close the project settings$/ do When /^I close the project settings$/ do
@project.should_not be_nil @project.should_not be_nil
click_link "Cancel" click_link "Cancel"
@ -181,6 +180,19 @@ When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, st
end end
end end
When /^I edit project "([^"]*)" and mark the project as reviewed$/ do |project_name|
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
open_project_edit_form(project)
click_link "reviewed_project_#{project.id}"
end
When /^I edit project settings and mark the project as reviewed$/ do
open_project_edit_form(@project)
click_link "reviewed_project_#{@project.id}"
end
When /^I add a note "([^"]*)" to the project$/ do |note_body| When /^I add a note "([^"]*)" to the project$/ do |note_body|
click_link "Add a note" click_link "Add a note"
fill_in "note[body]", :with => note_body fill_in "note[body]", :with => note_body