mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-18 16:20:12 +01:00
implement js to add and remove precedessors (dependencies)
This commit is contained in:
parent
e0dae50dfa
commit
92fdef2b1b
3 changed files with 44 additions and 1 deletions
|
|
@ -36,6 +36,16 @@
|
||||||
|
|
||||||
<label for="predecessor_list"><%= Todo.human_attribute_name('predecessors')%></label>
|
<label for="predecessor_list"><%= Todo.human_attribute_name('predecessors')%></label>
|
||||||
<%= text_field_tag "predecessor_list", nil, :size => 30, :tabindex => 8 %>
|
<%= text_field_tag "predecessor_list", nil, :size => 30, :tabindex => 8 %>
|
||||||
|
|
||||||
|
<div class="predecessor_add_button_box">
|
||||||
|
<input class="predecessor_add_button" type="button" value="Add"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="selected_predecessors">
|
||||||
|
<ul id="predecessor_ul" style="display:none">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<%= source_view_tag( @source_view ) %>
|
<%= source_view_tag( @source_view ) %>
|
||||||
<%= hidden_field_tag :_tag_name, @tag_name.underscore.gsub(/\s+/,'_') if source_view_is :tag %>
|
<%= hidden_field_tag :_tag_name, @tag_name.underscore.gsub(/\s+/,'_') if source_view_is :tag %>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,21 @@ var TracksForm = {
|
||||||
submit_with_ajax_and_block_element('form#todo-form-multi-new-action', $(this));
|
submit_with_ajax_and_block_element('form#todo-form-multi-new-action', $(this));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('input[class=predecessor_add_button]').live('click', function(){
|
||||||
|
var text = $('input[name=predecessor]').val();
|
||||||
|
if (text.length > 0) {
|
||||||
|
$('ul#predecessor_ul').show();
|
||||||
|
if (text.length > 35) {
|
||||||
|
text = text.substring(0,35)+"...";
|
||||||
|
}
|
||||||
|
var html = $('ul#predecessor_ul').html();
|
||||||
|
var new_li = "<li><input class=\"pred_remove_button\" type=\"button\" value=\"x\"/> "+ text + "</li>";
|
||||||
|
$('ul#predecessor_ul').html(html + new_li);
|
||||||
|
$('input[name=predecessor]').val('');
|
||||||
|
$('input[name=predecessor]').focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -342,10 +342,28 @@ div#input_box {
|
||||||
|
|
||||||
#input_box ul {list-style-type: circle; font-size: 0.9em;}
|
#input_box ul {list-style-type: circle; font-size: 0.9em;}
|
||||||
|
|
||||||
.show_from_input, .due_input, .project_input, .context_input {
|
#input_box ul#predecessor_ul {
|
||||||
|
list-style-type: none;
|
||||||
|
color: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show_from_input, .due_input, .project_input, .context_input,
|
||||||
|
.predecessor_input {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.predecessor_add_button_box {
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#input_box input.pred_remove_button {
|
||||||
|
width:1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected_predecessors {
|
||||||
|
clear:right;
|
||||||
|
}
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
float: left;
|
float: left;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue