mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 15:50:13 +01:00
get further testing tunning for projects
This commit is contained in:
parent
7c9102453c
commit
cde8ad35fd
8 changed files with 94 additions and 49 deletions
|
|
@ -1,28 +1,27 @@
|
||||||
<% project = project_listing
|
<%
|
||||||
|
project = project_listing
|
||||||
suppress_drag_handle ||= false
|
suppress_drag_handle ||= false
|
||||||
suppress_edit_button ||= false
|
suppress_edit_button ||= false
|
||||||
-%>
|
-%>
|
||||||
<div id="<%= dom_id(project, "container") %>" class="list">
|
<div id="<%= dom_id(project, "container") %>" class="list">
|
||||||
<div id="<%= dom_id(project) %>" class="project sortable_row" style="display:''">
|
<div id="<%= dom_id(project) %>" class="project sortable_row" style="display:block">
|
||||||
|
|
||||||
<% unless suppress_drag_handle -%>
|
<% unless suppress_drag_handle -%>
|
||||||
<div class="position">
|
<div class="position">
|
||||||
<span class="handle"><%= t('common.drag_handle') %></span>
|
<span class="handle"><%= t('common.drag_handle') %></span>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<div class="data">
|
<div class="data">
|
||||||
<%= link_to_project( project ) %><%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %>
|
<%= link_to_project( project ) %><%= " (" + count_undone_todos_and_notes_phrase(project,"actions") + ")" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<span class="grey"><%= project.current_state.to_s.upcase %></span>
|
<span class="grey"><%= project.current_state.to_s.upcase %></span>
|
||||||
|
|
||||||
<%= link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project'), :class=>"delete_item")) %>
|
<%= link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project'), :class=>"delete_item")) %>
|
||||||
|
<%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
|
||||||
<% unless suppress_edit_button -%>
|
|
||||||
<%= link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="<%= dom_id(project, 'edit') %>" class="edit-form" style="display:none;">
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="<%= dom_id(project, 'edit') %>" class="edit-form" style="display:none;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
newHtml = "<%= escape_javascript(render(:partial => 'project_form', :locals => { :project_form => @project })) %>"
|
newHtml = "<%= escape_javascript(render(:partial => 'project_form', :locals => { :project_form => @project })) %>"
|
||||||
$('div#<%=dom_id(@project, 'edit')%>').html(newHtml);
|
|
||||||
$('div#<%=dom_id(@project)%>').hide();
|
$('div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
||||||
$('div#<%=dom_id(@project, 'edit')%>').show(500);
|
$('div#<%=dom_id(@project, 'edit')%>').html(newHtml);
|
||||||
$('input.project-name').focus();
|
$('div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
|
||||||
|
$('input.project-name').focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
remove_project();
|
remove_project();
|
||||||
add_project();
|
add_project();
|
||||||
<% else -%>
|
<% else -%>
|
||||||
replace_project();
|
replace_project_form_with_updated_project();
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
update_sortable();
|
update_sortable();
|
||||||
|
|
@ -59,12 +59,12 @@ function update_sidebar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_sortable() {
|
function update_sortable() {
|
||||||
<%#* page.sortable "list-#{@project.state}-projects", get_listing_sortable_options("list-#{@project.state}-projects")%>
|
<%#* page.sortable "list-#{@project.state}-projects", get_listing_sortable_options("list-#{@project.state}-projects")-%>
|
||||||
console.log("Pending: update_sortable() on update project");
|
console.log("Pending: update_sortable() on update project");
|
||||||
}
|
}
|
||||||
|
|
||||||
function replace_project() {
|
function replace_project_form_with_updated_project() {
|
||||||
$('#<%=dom_id(@project, 'container')%>').fadeOut(500, function() {
|
$('#<%=dom_id(@project, 'container')%>').fadeOut(250, function() {
|
||||||
$('#<%=dom_id(@project, 'container')%>').html(html_for_project_listing());
|
$('#<%=dom_id(@project, 'container')%>').html(html_for_project_listing());
|
||||||
$('#<%=dom_id(@project, 'container')%>').fadeIn(500);
|
$('#<%=dom_id(@project, 'container')%>').fadeIn(500);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ Feature: Edit a project
|
||||||
Given the following user record
|
Given the following user record
|
||||||
| login | password | is_admin |
|
| login | password | is_admin |
|
||||||
| testuser | secret | false |
|
| testuser | secret | false |
|
||||||
And I have logged in as "testuser" with password "secret"
|
|
||||||
And there exists a project "manage me" for user "testuser"
|
And there exists a project "manage me" for user "testuser"
|
||||||
|
And I have logged in as "testuser" with password "secret"
|
||||||
|
|
||||||
@selenium
|
@selenium
|
||||||
Scenario: I can describe the project using markup
|
Scenario: I can describe the project using markup
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ Feature: Manage the list of projects
|
||||||
Given the following user record
|
Given the following user record
|
||||||
| login | password | is_admin |
|
| login | password | is_admin |
|
||||||
| testuser | secret | false |
|
| testuser | secret | false |
|
||||||
And I have logged in as "testuser" with password "secret"
|
|
||||||
And there exists a project "manage me" for user "testuser"
|
And there exists a project "manage me" for user "testuser"
|
||||||
And there exists a project "upgrade jquery" for user "testuser"
|
And there exists a project "upgrade jquery" for user "testuser"
|
||||||
And there exists a project "a project name starting with a" for user "testuser"
|
And there exists a project "a project name starting with a" for user "testuser"
|
||||||
|
And I have logged in as "testuser" with password "secret"
|
||||||
|
|
||||||
Scenario: The list of project contain all projects
|
Scenario: The list of project contain all projects
|
||||||
When I go to the projects page
|
When I go to the projects page
|
||||||
|
|
@ -38,13 +38,16 @@ Feature: Manage the list of projects
|
||||||
And the badge should show 2
|
And the badge should show 2
|
||||||
And the project list badge for "active" projects should show 2
|
And the project list badge for "active" projects should show 2
|
||||||
|
|
||||||
@selenium
|
@selenium, @wip
|
||||||
Scenario: Changing project state will move project to other state list
|
Scenario: Changing project state will move project to other state list
|
||||||
When I go to the projects page
|
When I go to the projects page
|
||||||
Then the project "manage me" should be in state list "active"
|
Then the project "manage me" should be in state list "active"
|
||||||
|
And the project list badge for "active" projects should show 3
|
||||||
When I edit the project state of "manage me" to "hidden"
|
When I edit the project state of "manage me" to "hidden"
|
||||||
Then the project "manage me" should not be in state list "active"
|
Then the project "manage me" should not be in state list "active"
|
||||||
And the project "manage me" should be in state list "hidden"
|
And the project "manage me" should be in state list "hidden"
|
||||||
|
And the project list badge for "active" projects should show 2
|
||||||
|
And the project list badge for "hidden" projects should show 1
|
||||||
|
|
||||||
Scenario: Dragging a project to change list order of projects
|
Scenario: Dragging a project to change list order of projects
|
||||||
Scenario: Adding a new project
|
Scenario: Adding a new project
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,20 @@ When /^I delete project "([^"]*)"$/ do |project_name|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
|
||||||
|
project = @current_user.projects.find_by_name(project_name)
|
||||||
|
project.should_not be_nil
|
||||||
|
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
|
||||||
|
response.should_not have_xpath(xpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name|
|
||||||
|
project = @current_user.projects.find_by_name(project_name)
|
||||||
|
project.should_not be_nil
|
||||||
|
xpath = "//div[@id='list-#{state_name}-projects-container']//div[@id='project_#{project.id}']"
|
||||||
|
response.should have_xpath(xpath)
|
||||||
|
end
|
||||||
|
|
||||||
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
|
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
|
||||||
selenium.get_text("css=span##{state_name}-projects-count").should == count
|
selenium.get_text("css=span##{state_name}-projects-count").should == count
|
||||||
end
|
end
|
||||||
|
|
@ -42,8 +42,8 @@ end
|
||||||
|
|
||||||
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
|
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
|
||||||
click_link "link_edit_project_#{@project.id}"
|
click_link "link_edit_project_#{@project.id}"
|
||||||
|
selenium.wait_for_element("xpath=//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
|
||||||
# no need to wait for the form because the AJAX loading should not be async!
|
|
||||||
fill_in "project[name]", :with => new_title
|
fill_in "project[name]", :with => new_title
|
||||||
|
|
||||||
# changed to make sure selenium waits until the saving has a result either
|
# changed to make sure selenium waits until the saving has a result either
|
||||||
|
|
@ -61,6 +61,28 @@ When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_n
|
||||||
When "I edit the project name to \"#{project_new_name}\""
|
When "I edit the project name to \"#{project_new_name}\""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, state_name|
|
||||||
|
project = @current_user.projects.find_by_name(project_name)
|
||||||
|
project.should_not be_nil
|
||||||
|
|
||||||
|
click_link "link_edit_project_#{project.id}"
|
||||||
|
selenium.wait_for_element("xpath=//div[@id='edit_project_#{project.id}']/form//button[@id='submit_project_#{project.id}']")
|
||||||
|
|
||||||
|
choose "project_state_#{state_name}"
|
||||||
|
|
||||||
|
# changed to make sure selenium waits until the saving has a result either
|
||||||
|
# positive or negative. Was: :element=>"flash", :text=>"Project saved"
|
||||||
|
# we may need to change it back if you really need a positive outcome, i.e.
|
||||||
|
# this step needs to fail if the project was not saved successfully
|
||||||
|
selenium.click "submit_project_#{project.id}",
|
||||||
|
:wait_for => :text,
|
||||||
|
:text => /(Project saved|1 error prohibited this project from being saved)/
|
||||||
|
|
||||||
|
selenium.wait_for_element("list-#{state_name}-projects-container")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
|
Then /^I should see the bold text "([^\"]*)" in the project description$/ do |bold|
|
||||||
xpath="//div[@class='project_description']/p/strong"
|
xpath="//div[@class='project_description']/p/strong"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,21 +312,6 @@ function enable_rich_interaction(){
|
||||||
field_touched = false;
|
field_touched = false;
|
||||||
|
|
||||||
$('h2#project_name').editable(save_project_name, {style: 'padding:0px', submit: "OK"});
|
$('h2#project_name').editable(save_project_name, {style: 'padding:0px', submit: "OK"});
|
||||||
|
|
||||||
/* set behavior for edit project settings link */
|
|
||||||
$("a.project_edit_settings").live('click', function (ev) {
|
|
||||||
$.ajax({
|
|
||||||
url: this.href,
|
|
||||||
async: true,
|
|
||||||
project_dom_id: 'project_'+this.id,
|
|
||||||
dataType: 'script',
|
|
||||||
beforeSend: function() {$(this.project_dom_id).block({message: null});},
|
|
||||||
complete:function() {$(this.project_dom_id).unblock(); enable_rich_interaction();}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("form.edit-project-form button.positive").live('click', function (ev) { $('form.edit-project-form').ajaxSubmit({type: 'POST', async: false}); return false; });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Auto-refresh */
|
/* Auto-refresh */
|
||||||
|
|
@ -475,11 +460,12 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.edit-form a.negative').live('click', function(){
|
/* for edit project form and edit todo form */
|
||||||
$(this).parents('.container').find('.item-show').show();
|
$('.edit-form a.negative').live('click', function(){
|
||||||
$(this).parents('.container').find('.project').show();
|
$(this).parents('.edit-form').fadeOut(200, function () {
|
||||||
$(this).parents('.edit-form').hide();
|
$(this).parents('.list').find('.project').fadeIn(500);
|
||||||
});
|
$(this).parents('.container').find('.item-show').fadeIn(500);
|
||||||
|
})});
|
||||||
|
|
||||||
/* add behavior to clear the date both buttons for show_from and due */
|
/* add behavior to clear the date both buttons for show_from and due */
|
||||||
$(".date_clear").live('click', function() {
|
$(".date_clear").live('click', function() {
|
||||||
|
|
@ -588,19 +574,36 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* set behavior for edit project settings link in projects list page and project page */
|
||||||
|
$("a.project_edit_settings").live('click', function (ev) {
|
||||||
|
$.ajax({
|
||||||
|
url: this.href,
|
||||||
|
async: true,
|
||||||
|
project_dom_elem: $(this).parent().parent(),
|
||||||
|
dataType: 'script',
|
||||||
|
beforeSend: function() {this.project_dom_elem.block({message: null});},
|
||||||
|
complete:function() {this.project_dom_elem.unblock(); enable_rich_interaction();}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$("form.edit-project-form button.positive").live('click', function (ev) {
|
||||||
|
$('form.edit-project-form').ajaxSubmit({
|
||||||
|
type: 'POST',
|
||||||
|
async: true,
|
||||||
|
buttons_dom_elem: $(this),
|
||||||
|
beforeSend: function() {
|
||||||
|
this.buttons_dom_elem.block({message: null});}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
$('#toggle_project_new').click(function(evt){
|
$('#toggle_project_new').click(function(evt){
|
||||||
TracksForm.toggle('toggle_project_new', 'project_new', 'project-form',
|
TracksForm.toggle('toggle_project_new', 'project_new', 'project-form',
|
||||||
'« Hide form', 'Hide new project form',
|
'« Hide form', 'Hide new project form',
|
||||||
'Create a new project »', 'Add a project');
|
'Create a new project »', 'Add a project');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".project-list .edit-form a.negative").live('click', function(evt){
|
|
||||||
evt.preventDefault();
|
|
||||||
$(this).parents('.list').find('.project').show();
|
|
||||||
$(this).parents('.edit-form').hide();
|
|
||||||
$(this).parents('.edit-form').find('form').clearForm();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".add_note_link a").live('click', function(){
|
$(".add_note_link a").live('click', function(){
|
||||||
$('#new-note').show();
|
$('#new-note').show();
|
||||||
$('#new-note form').clearForm();
|
$('#new-note form').clearForm();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue