mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-21 21:40:48 +02:00
replace new repeating todo form with jquery dialog. And some refactoring
This commit is contained in:
parent
4b6aff5502
commit
6aa8b8d2f9
9 changed files with 228 additions and 195 deletions
|
@ -991,64 +991,93 @@ var RecurringTodosPage = {
|
|||
$('#recurring_edit_'+this).hide();
|
||||
});
|
||||
},
|
||||
reset_radio: function () {
|
||||
$('input:radio[name="recurring_todo[recurring_period]"]')[0].checked = true;
|
||||
},
|
||||
toggle_overlay: function () {
|
||||
var overlay_element = document.getElementById("overlay");
|
||||
overlay_element.style.visibility = (overlay_element.style.visibility == "visible") ? "hidden" : "visible";
|
||||
},
|
||||
setup_behavior: function() {
|
||||
/* cancel button on new recurring todo form */
|
||||
$("#recurring_todo_new_action_cancel").live('click', function(){
|
||||
$('#recurring-todo-form-new-action input:text:first').focus();
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
$('#recurring_daily').show();
|
||||
RecurringTodosPage.toggle_overlay();
|
||||
});
|
||||
/* cancel button on edit recurring todo form */
|
||||
$("#recurring_todo_edit_action_cancel").live('click', function(){
|
||||
$('#recurring-todo-form-edit-action input:text:first').focus();
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
$('#recurring_daily').show();
|
||||
RecurringTodosPage.toggle_overlay();
|
||||
});
|
||||
/* change recurring period radio input on edit form */
|
||||
$("#recurring_edit_period input").live('click', function(){
|
||||
RecurringTodosPage.hide_all_edit_recurring();
|
||||
$('#recurring_edit_'+this.id.split('_')[5]).show();
|
||||
});
|
||||
/* change recurring period radio input on new form */
|
||||
$("#recurring_period input").live('click', function(){
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
$('#recurring_'+this.id.split('_')[4]).show();
|
||||
});
|
||||
/* add new recurring todo plus-button in sidebar */
|
||||
$("#add-new-recurring-todo").live('click', function(){
|
||||
$('#new-recurring-todo').show();
|
||||
$('#edit-recurring-todo').hide();
|
||||
RecurringTodosPage.toggle_overlay();
|
||||
});
|
||||
/* submit form when editing a recurring todo */
|
||||
$("#recurring_todo_edit_action_submit").live('click', function (ev) {
|
||||
/* add new recurring todo plus-button in sidebar */
|
||||
$("#add-new-recurring-todo").live('click', function(){
|
||||
$( "#new-recurring-todo" ).dialog( "open" );
|
||||
});
|
||||
|
||||
/* setup dialog for new repeating action */
|
||||
$( "#new-recurring-todo" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 690,
|
||||
width: 750,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Create": function() {
|
||||
submit_with_ajax_and_block_element('form.#recurring-todo-form-new-action', $(this));
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
show: "fade",
|
||||
hide: "fade",
|
||||
close: function() {
|
||||
$('#recurring-todo-form-new-action input:text:first').focus();
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
RecurringTodosPage.reset_radio();
|
||||
$('#recurring_daily').show();
|
||||
}
|
||||
});
|
||||
|
||||
/* change recurring period radio input on new form */
|
||||
$("#recurring_period input").live('click', function(){
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
$('#recurring_'+this.id.split('_')[4]).show();
|
||||
});
|
||||
|
||||
/* setup dialog for new repeating action */
|
||||
$( "#edit-recurring-todo" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 690,
|
||||
width: 750,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Create": function() {
|
||||
submit_with_ajax_and_block_element('form#recurring-todo-form-edit-action', $(this));
|
||||
return false;
|
||||
});
|
||||
/* submit form for new recurring todo */
|
||||
$("#recurring_todo_new_action_submit").live('click', function (ev) {
|
||||
submit_with_ajax_and_block_element('form.#recurring-todo-form-new-action', $(this));
|
||||
return false;
|
||||
});
|
||||
/* set behavior for edit recurring todo */
|
||||
$(".item-container a.edit_icon").live('click', function (ev){
|
||||
get_with_ajax_and_block_element(this.href, $(this).parents(".item-container"));
|
||||
return false;
|
||||
});
|
||||
/* delete button to delete a todo from the list */
|
||||
$('.item-container a.delete_icon').live('click', function(evt){
|
||||
var confirm_message = $(this).attr("x_confirm_message")
|
||||
if(confirm(confirm_message)){
|
||||
delete_with_ajax_and_block_element(this.href, $(this).parents('.project'));
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
show: "fade",
|
||||
hide: "fade",
|
||||
close: function() {
|
||||
$('#recurring-todo-form-edit-action input:text:first').focus();
|
||||
RecurringTodosPage.hide_all_recurring();
|
||||
RecurringTodosPage.reset_radio();
|
||||
$('#recurring_daily').show();
|
||||
}
|
||||
});
|
||||
|
||||
/* change recurring period radio input on edit form */
|
||||
$("#recurring_edit_period input").live('click', function(){
|
||||
RecurringTodosPage.hide_all_edit_recurring();
|
||||
$('#recurring_edit_'+this.id.split('_')[5]).show();
|
||||
});
|
||||
|
||||
/* set behavior for edit recurring todo */
|
||||
$(".item-container a.edit_icon").live('click', function (ev){
|
||||
get_with_ajax_and_block_element(this.href, $(this).parents(".item-container"));
|
||||
return false;
|
||||
});
|
||||
|
||||
/* delete button to delete a todo from the list */
|
||||
$('.item-container a.delete_icon').live('click', function(evt){
|
||||
var confirm_message = $(this).attr("x_confirm_message")
|
||||
if(confirm(confirm_message)){
|
||||
delete_with_ajax_and_block_element(this.href, $(this).parents('.project'));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,26 +203,6 @@ a.show_successors:hover, a.link_to_successors:hover {background-image: url(../im
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#overlay {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 102;
|
||||
text-align: center;
|
||||
background-image:url("../images/trans70.png");
|
||||
}
|
||||
|
||||
#overlay #new-recurring-todo, #overlay #edit-recurring-todo {
|
||||
width:750px;
|
||||
background-color: #fff;
|
||||
border:1px solid #000;
|
||||
padding: 15px;
|
||||
margin: 70px auto;
|
||||
}
|
||||
|
||||
.recurring_container {
|
||||
padding: 0px 5px 0px 5px;
|
||||
border: 1px solid #999;
|
||||
|
@ -278,8 +258,8 @@ a.show_successors:hover, a.link_to_successors:hover {background-image: url(../im
|
|||
#navlist a:hover { color: #CCC; }
|
||||
|
||||
#develop-notify-bar {
|
||||
line-height:0.5;
|
||||
background-image: url(/images/construction.gif);
|
||||
line-height:0.5;
|
||||
background-image: url(/images/construction.gif);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue