mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10: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
|
|
@ -7,8 +7,9 @@
|
|||
-%>
|
||||
<div id="todo_new_action_container">
|
||||
|
||||
<div id="toggle_action_new" class="hide_form">
|
||||
<a title="Hide new action form" accesskey="n" href="#">« Hide form</a>
|
||||
<div id="toggle_forms" class="toggle_forms">
|
||||
<a title="Hide new action form" accesskey="n" href="#" id="toggle_action_new">« Hide form</a> |
|
||||
<a title="Toggle single/multi new action form" accesskey="m" href="#" id="toggle_multi">Add multiple next actions</a>
|
||||
</div>
|
||||
|
||||
<div id="todo_new_action" style="display:block">
|
||||
|
|
@ -28,11 +29,13 @@
|
|||
<%= text_area( "todo", "notes", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
|
||||
|
||||
<input id="default_project_name_id" name="default_project_name" type="hidden" value="<%=@initial_project_name-%>" />
|
||||
|
||||
<label for="todo_project_name">Project</label>
|
||||
<input id="todo_project_name" name="project_name" autocomplete="off" tabindex="3" size="30" type="text" value="<%= @initial_project_name %>" />
|
||||
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>
|
||||
|
||||
<input id="default_context_name_id" name="default_context_name" type="hidden" value="<%=@initial_context_name-%>" />
|
||||
|
||||
<label for="todo_context_name">Context</label>
|
||||
<input id="todo_context_name" name="context_name" autocomplete="off" tabindex="4" size="30" type="text" value="<%= @initial_context_name %>" />
|
||||
<div class="page_name_auto_complete" id="context_list" style="display:none"></div>
|
||||
|
|
@ -63,6 +66,39 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<% end # form-remote-tag -%>
|
||||
</div>
|
||||
|
||||
<div id="todo_multi_add" style="display:none">
|
||||
<form id="todo-form-multi-new-acion" class="inline-form">
|
||||
<label for="todo_notes">Multiple next actions (one on each line)</label>
|
||||
<%= text_area( "todo", "multiple_todos", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
|
||||
|
||||
<label for="todo_project_name">Project for all actions</label>
|
||||
<input id="todo_project_name" name="project_name" autocomplete="off" tabindex="3" size="30" type="text" value="<%= @initial_project_name %>" />
|
||||
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>
|
||||
|
||||
<input id="default_context_name_id" name="default_context_name" type="hidden" value="<%=@initial_context_name-%>" />
|
||||
|
||||
<label for="todo_context_name">Context for all actions</label>
|
||||
<input id="todo_context_name" name="context_name" autocomplete="off" tabindex="4" size="30" type="text" value="<%= @initial_context_name %>" />
|
||||
<div class="page_name_auto_complete" id="context_list" style="display:none"></div>
|
||||
|
||||
<label for="tag_list">Tags for all actions (sep. with commas)</label>
|
||||
<%= text_field_tag "tag_list", @default_tags, :size => 30, :tabindex => 5 %>
|
||||
<%= content_tag("div", "", :id => "tag_list_auto_complete", :class => "auto_complete") %>
|
||||
|
||||
<div class="submit_box">
|
||||
<div class="widgets">
|
||||
<button type="submit" class="positive" id="todo_multi_new_action_submit" tabindex="8">
|
||||
<%= image_tag("accept.png", :alt => "") %>Add action
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ input#go_to_project, input#context_hide {
|
|||
float: right;
|
||||
}
|
||||
|
||||
#todo-form-new-action .submit_box, #project_form .submit_box, #context_form .submit_box {
|
||||
#todo-form-new-action .submit_box, #project_form .submit_box, #context_form .submit_box, #todo-form-multi-new-acion .submit_box {
|
||||
height: 25px;
|
||||
padding: 5px 0;
|
||||
text-align: center;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue