add checkbox to multiple action form to make all actions dependent on each other (sequential)

for people wanting sequential projects

Signed-off-by: Reinier Balt <lrbalt@gmail.com>
This commit is contained in:
Reinier Balt 2011-09-14 15:25:15 +02:00
parent a332f8f557
commit 2f42fad7c9
7 changed files with 970 additions and 951 deletions

View file

@ -174,7 +174,10 @@ class TodosController < ApplicationController
tag_list = params[:tag_list]
@sequential = !params[:todos_sequential].blank? && params[:todos_sequential]=='true'
@todos = []
@predecessor = nil
params[:todo][:multiple_todos].split("\n").map do |line|
unless line.blank?
@todo = current_user.todos.build(
@ -182,12 +185,20 @@ class TodosController < ApplicationController
@todo.project_id = @project_id
@todo.context_id = @context_id
@saved = @todo.save
if @predecessor && @saved && @sequential
@todo.add_predecessor(@predecessor)
@todo.block!
end
unless (@saved == false) || tag_list.blank?
@todo.tag_with(tag_list)
@todo.tags.reload
end
@todos << @todo
@not_done_todos << @todo if @new_context_created
@predecessor = @todo
end
end

View file

@ -22,6 +22,9 @@
<%= text_field_tag "multi_tag_list", @default_tags, :name=>:tag_list, :size => 30, :tabindex => next_tab_index %>
<%= content_tag("div", "", :id => "tag_list_auto_complete", :class => "auto_complete") %>
<%= check_box_tag('todos_sequential', 'true', false, {:tabindex => next_tab_index}) %>
<label for="todos_sequential"><%= t('shared.make_actions_dependent') %></label>
<div class="submit_box">
<div class="widgets">
<button type="submit" class="positive" id="todo_multi_new_action_submit" tabindex="<%= next_tab_index%>">