mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
add form for multiple actions
This commit is contained in:
parent
7be37eabfc
commit
26cd345cbe
3 changed files with 65 additions and 10 deletions
|
|
@ -1,17 +1,17 @@
|
|||
var TracksForm = {
|
||||
toggle: function(toggleDivId, formContainerId, formId, hideLinkText,
|
||||
toggle: function(toggleLinkId, formContainerId, formId, hideLinkText,
|
||||
hideLinkTitle, showLinkText, showLinkTitle) {
|
||||
$('#'+formContainerId).toggle();
|
||||
toggleDiv = $('#'+toggleDivId);
|
||||
toggleLink = toggleDiv.find('a');
|
||||
if (toggleDiv.hasClass('hide_form')) {
|
||||
form=$('#'+formContainerId)
|
||||
form.toggle();
|
||||
toggleLink = $('#'+toggleLinkId);
|
||||
if (!form.is(':visible')) {
|
||||
toggleLink.text(showLinkText).attr('title', showLinkTitle);
|
||||
}
|
||||
else {
|
||||
toggleLink.text(hideLinkText).attr('title', hideLinkTitle);
|
||||
$('#'+formId+' input:text:first').focus();
|
||||
}
|
||||
toggleDiv.toggleClass('hide_form');
|
||||
toggleLink.parent.toggleClass('hide_form');
|
||||
},
|
||||
hide_all_recurring: function () {
|
||||
$.each(['daily', 'weekly', 'monthly', 'yearly'], function(){
|
||||
|
|
@ -373,11 +373,30 @@ $(document).ready(function() {
|
|||
setup_container_toggles();
|
||||
|
||||
$('#toggle_action_new').click(function(){
|
||||
if ($("#todo_multi_add").is(':visible')) { /* hide multi next action form first */
|
||||
$('#todo_new_action').show();
|
||||
$('#todo_multi_add').hide();
|
||||
$('a#toggle_multi').text("Add multiple next actions");
|
||||
}
|
||||
|
||||
TracksForm.toggle('toggle_action_new', 'todo_new_action', 'todo-form-new-action',
|
||||
'« Hide form', 'Hide next action form',
|
||||
'Add a next action »', 'Add a next action');
|
||||
});
|
||||
|
||||
$('#toggle_multi').click(function(){
|
||||
if ($("#todo_multi_add").is(':visible')) {
|
||||
$('#todo_new_action').show();
|
||||
$('#todo_multi_add').hide();
|
||||
$('a#toggle_multi').text("Add multiple next actions");
|
||||
} else {
|
||||
$('#todo_new_action').hide();
|
||||
$('#todo_multi_add').show();
|
||||
$('a#toggle_multi').text("Add single next action");
|
||||
$('a#toggle_action_new').text('« Hide form');
|
||||
}
|
||||
});
|
||||
|
||||
$('.edit-form a.negative').live('click', function(){
|
||||
$(this).parents('.container').find('.item-show').show();
|
||||
$(this).parents('.container').find('.project').show();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue