mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
fix #1245 by managing pages with more than one project in a list
Update still looks ugly. I'd like to see things more seperated for project list page and review page. Todo!
This commit is contained in:
parent
af10e74017
commit
ff4a376ee9
3 changed files with 18 additions and 14 deletions
|
@ -3,8 +3,8 @@ function html_for_edit_form() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_edit_form() {
|
function show_edit_form() {
|
||||||
$('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form());
|
$('div.project-edit-current div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form());
|
||||||
$('div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
|
$('div.project-edit-current div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
|
||||||
$('div#project_name').editable('disable');
|
$('div#project_name').editable('disable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,10 @@ function set_focus() {
|
||||||
$('input.project-name').focus();
|
$('input.project-name').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function replace_project_with_edit_form() {
|
function replace_project_with_edit_form() {
|
||||||
$('div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
$('div.project-edit-current div#<%=dom_id(@project)%>').fadeOut(250, function() {
|
||||||
show_edit_form();
|
show_edit_form();
|
||||||
set_focus();
|
set_focus();
|
||||||
enable_rich_interaction();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ function update_project_list_page() {
|
||||||
ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>);
|
ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>);
|
||||||
ProjectListPage.show_or_hide_all_state_containers(<%= @show_active_projects %>, <%= @show_hidden_projects %>, <%= @show_completed_projects %>);
|
ProjectListPage.show_or_hide_all_state_containers(<%= @show_active_projects %>, <%= @show_hidden_projects %>, <%= @show_completed_projects %>);
|
||||||
TracksForm.set_project_name_and_default_project_name("<%= escape_javascript(@project.name)%>");
|
TracksForm.set_project_name_and_default_project_name("<%= escape_javascript(@project.name)%>");
|
||||||
|
$('div.project-edit-current').removeClass('project-edit-current');
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_project_page() {
|
function update_project_page() {
|
||||||
|
@ -44,7 +45,9 @@ function remove_project_edit_form() {
|
||||||
<%-
|
<%-
|
||||||
# do not remove() edit form as this will remove the DIV that is needed to replace with the new form, so only empty the DIV
|
# do not remove() edit form as this will remove the DIV that is needed to replace with the new form, so only empty the DIV
|
||||||
-%>
|
-%>
|
||||||
$('#<%=dom_id(@project, 'edit')%>').hide(500, function() {$('#<%=dom_id(@project, 'edit')%>').html("<!- empty ->");} );
|
$('#<%=dom_id(@project, 'edit')%>').hide(500, function() {
|
||||||
|
$('#<%=dom_id(@project, 'edit')%>').html("<!- empty ->");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_and_show_project_settings() {
|
function update_and_show_project_settings() {
|
||||||
|
@ -53,17 +56,18 @@ function update_and_show_project_settings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function replace_project_form_with_updated_project() {
|
function replace_project_form_with_updated_project() {
|
||||||
$('#<%=dom_id(@project, 'container')%>').fadeOut(250, function() {
|
$('div#<%=dom_id(@project, 'container')%>').each(function(index, elem) {
|
||||||
|
$(this).fadeOut(250, function() {
|
||||||
<%
|
<%
|
||||||
# first add the updated project after the old one, then remove old one
|
# first add the updated project after the old one, then remove old one.
|
||||||
# using html() does not work, because it will replace the _content_ of
|
# Using html() does not work, because it will replace the _content_ of
|
||||||
# the container instead of the container itself, i.e. you will get
|
# the container instead of the container itself, i.e. you will get
|
||||||
# a container within a container which will break drag-and-drop sorting
|
# a container within a container which will break drag-and-drop sorting
|
||||||
-%>
|
-%>
|
||||||
$('#<%=dom_id(@project, 'container')%>').after(html_for_project_listing());
|
$(this).after(html_for_project_listing());
|
||||||
$('#<%=dom_id(@project, 'container')%>').remove();
|
$(this).remove();
|
||||||
$('#<%=dom_id(@project, 'container')%>').fadeIn(500);
|
$('#<%=dom_id(@project, 'container')%>').fadeIn(500);
|
||||||
});
|
})});
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_and_re_add_project() {
|
function remove_and_re_add_project() {
|
||||||
|
|
|
@ -770,8 +770,9 @@ var ProjectListPage = {
|
||||||
|
|
||||||
/* set behavior for edit project settings link in both projects list page and project page */
|
/* set behavior for edit project settings link in both projects list page and project page */
|
||||||
$("a.project_edit_settings").live('click', function (evt) {
|
$("a.project_edit_settings").live('click', function (evt) {
|
||||||
get_with_ajax_and_block_element(this.href, $(this).parent().parent());
|
$(this).parent().parent().addClass('project-edit-current'); /* mark project in list */
|
||||||
return false;
|
get_with_ajax_and_block_element(this.href, $(this).parent().parent());
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
/* submit project form after edit */
|
/* submit project form after edit */
|
||||||
|
@ -785,6 +786,7 @@ var ProjectListPage = {
|
||||||
$('form.edit-project-form a.negative').live('click', function(){
|
$('form.edit-project-form a.negative').live('click', function(){
|
||||||
$('div#project_name').editable('enable');
|
$('div#project_name').editable('enable');
|
||||||
$(this).parents('.edit-form').fadeOut(200, function () {
|
$(this).parents('.edit-form').fadeOut(200, function () {
|
||||||
|
$(this).parents('.project-edit-current').removeClass('project-edit-current');
|
||||||
$(this).parents('.list').find('.project').fadeIn(500);
|
$(this).parents('.list').find('.project').fadeIn(500);
|
||||||
$(this).parents('.container').find('.item-show').fadeIn(500);
|
$(this).parents('.container').find('.item-show').fadeIn(500);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue