mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
start fixing sorting of projects
This commit is contained in:
parent
f284617513
commit
2c47b27a87
8 changed files with 33 additions and 18 deletions
2
app/views/projects/actionize.js.erb
Normal file
2
app/views/projects/actionize.js.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
new_html = "<%= escape_javascript(render(:partial => 'project_listing', :collection => @projects)) %>";
|
||||
$("#list-<%=@state%>-projects").html(new_html);
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
list_id = "list-#{@state}-projects"
|
||||
page.replace_html list_id,
|
||||
:partial => 'project_listing',
|
||||
:collection => @projects
|
||||
page.sortable list_id, get_listing_sortable_options(list_id)
|
||||
|
||||
2
app/views/projects/alphabetize.js.erb
Normal file
2
app/views/projects/alphabetize.js.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
new_html = "<%= escape_javascript(render(:partial => 'project_listing', :collection => @projects)) %>";
|
||||
$("#list-<%=@state%>-projects").html(new_html);
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
list_id = "list-#{@state}-projects"
|
||||
page.replace_html list_id,
|
||||
:partial => 'project_listing',
|
||||
:collection => @projects
|
||||
page.sortable list_id, get_listing_sortable_options(list_id)
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ Feature: Manage the list of projects
|
|||
|
||||
In order to keep tracks and manage of all my projects
|
||||
As a Tracks user
|
||||
I want to manage the list of projects
|
||||
I want to manage my list of projects
|
||||
|
||||
Background:
|
||||
Given the following user record
|
||||
|
|
@ -79,5 +79,17 @@ Feature: Manage the list of projects
|
|||
And I submit a new project with name "finish cucumber tests" and select take me to the project
|
||||
Then I should be on the "finish cucumber tests" project page
|
||||
|
||||
@selenium, @wip
|
||||
Scenario: Sorting the project alphabetically
|
||||
Scenario: Sorting the project by number of task
|
||||
When I go to the projects page
|
||||
Then the project "manage me" should be above the project "a project name starting with a"
|
||||
When I sort the list alphabetically
|
||||
Then the project "a project name starting with a" should be above the project "manage me"
|
||||
|
||||
@selenium, @wip
|
||||
Scenario: Sorting the project by number of task
|
||||
Given I have a project "test" with 2 todos
|
||||
When I go to the projects page
|
||||
Then the project "manage me" should be above the project "test"
|
||||
When I sort the list by number of tasks
|
||||
Then the project "test" should be above the project "manage me"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_
|
|||
|
||||
selenium.mouse_down_at(drag_project_handle_xpath,"2,2")
|
||||
selenium.mouse_move_at(drop_project_container_xpath,coord_string)
|
||||
# selenium.mouse_over(drop_project_container_xpath)
|
||||
# no need to simulate mouse_over for this test
|
||||
selenium.mouse_up_at(drop_project_container_xpath,coord_string)
|
||||
end
|
||||
|
||||
|
|
@ -38,6 +38,17 @@ When /^I submit a new project with name "([^"]*)" and select take me to the proj
|
|||
selenium.wait_for_page_to_load(5000) # follow the redirect
|
||||
end
|
||||
|
||||
When /^I sort the list alphabetically$/ do
|
||||
click_link "Alphabetically"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order."
|
||||
|
||||
end
|
||||
|
||||
When /^I sort the list by number of tasks$/ do
|
||||
click_link "By number of tasks"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
|
||||
high_id = @current_user.projects.find_by_name(project_high).id
|
||||
low_id = @current_user.projects.find_by_name(project_low).id
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ if ENV["RAILS_ENV"] == "selenium"
|
|||
config.application_environment = :selenium
|
||||
# use only if you run a separate rails test server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.application_port = 3001
|
||||
config.application_port = 3001
|
||||
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
# use only if you run a separate selenium server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.selenium_server_address = "localhost"
|
||||
config.selenium_server_address = "localhost"
|
||||
# config.selenium_server_port = "4444"
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ $(document).ready(function() {
|
|||
if(confirm('Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order.')){
|
||||
alphaSort = $(this).parents('.alpha_sort');
|
||||
alphaSort.block({message:null});
|
||||
$.post(this.href, {}, function(){alphaSort.unblock()}, 'script');
|
||||
$.post(this.href, {async: true}, function(){alphaSort.unblock()}, 'script');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue