backlog 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.6.6 2007-08-07
2
+
3
+ * Improved task lists in backlog edit view.
4
+
1
5
  == 0.6.5 2007-08-07
2
6
 
3
7
  * Fixed authentication error for burn down chart
@@ -96,7 +96,7 @@ class ApplicationController < ActionController::Base
96
96
 
97
97
  def pop_detour
98
98
  detour = session[:detours].pop
99
- puts "popped detour: #{detour} #{session[:detours].size} more"; STDOUT.flush
99
+ puts "popped detour: #{detour.inspect} #{session[:detours].size} more"; STDOUT.flush
100
100
  if session[:detours].empty?
101
101
  session[:detours] = nil
102
102
  end
@@ -65,7 +65,7 @@ class BacklogsController < ApplicationController
65
65
  end
66
66
  end
67
67
  @tasks = planned_tasks + unplanned_tasks
68
- @completed_tasks = @backlog.tasks.select {|t| t.finished_at}.sort {|t1, t2| t1.finished_at <=> t2.finished_at}
68
+ @completed_tasks = @backlog.tasks.select {|t| t.finished_at}.sort {|t1, t2| t2.finished_at <=> t1.finished_at}
69
69
  end
70
70
 
71
71
  def edit_no_layout
@@ -54,11 +54,23 @@ class TasksController < ApplicationController
54
54
  return
55
55
  end
56
56
  @task = Task.find(params[:id])
57
- unless @task.period.active?
57
+ unless (@task.period && @task.period.active?) || (params[:task] && params[:task][:period_id] && Period.find(params[:task][:period_id]).active?)
58
58
  @task.errors.add(:period_id, "You may not update a task in an inactive period. Move the task to an active period first.")
59
- redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => @task.id
59
+ back_or_redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => @task.id
60
60
  return
61
61
  end
62
+ if params[:task] && params[:task][:period_id]
63
+ if params[:task][:period_id] != ''
64
+ if params[:task][:period_id].to_i != @task.period_id
65
+ params[:task][:position] = Period.find(params[:task][:period_id]).tasks.size
66
+ end
67
+ else
68
+ if @task.period_id != nil
69
+ @task.period = nil
70
+ params[:task][:position] = @task.backlog.tasks.count(:conditions => 'period_id IS NULL') + 1
71
+ end
72
+ end
73
+ end
62
74
  if params[:task] && @task.update_attributes(params[:task])
63
75
  flash[:notice] = 'Task was successfully updated.'
64
76
  if params[:task][:todo] && params[:task][:todo].to_i == 0
@@ -66,15 +78,15 @@ class TasksController < ApplicationController
66
78
  next_task = @task.lower_item || @task.higher_item
67
79
  @task.finish Task::COMPLETED, true, user
68
80
  @task.save
69
- redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => next_task ? next_task.id : nil
81
+ back_or_redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => next_task ? next_task.id : nil
70
82
  else
71
- redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => @task.id
83
+ back_or_redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => @task.id
72
84
  end
73
85
  else
74
86
  if @task.finished_at
75
87
  reopen
76
88
  else
77
- redirect_to :controller => 'periods', :action => 'show', :id => @task.period, :task => @task.id
89
+ back_or_redirect_to :controller => 'periods', :action => 'show', :id => @task.period, :task => @task.id
78
90
  end
79
91
  end
80
92
  else
@@ -119,7 +131,12 @@ class TasksController < ApplicationController
119
131
 
120
132
  def move_to
121
133
  task = Task.find(params[:id][5..-1])
134
+ if params[:period_id] && params[:period_id].to_i != task.period_id
135
+ task.remove_from_list
136
+ task.period_id = params[:period_id]
137
+ end
122
138
  task.insert_at params[:position]
139
+ task.save!
123
140
  back_or_redirect_to :controller => 'periods', :action => :show_nolayout, :id => task.period, :task => task.id
124
141
  end
125
142
 
@@ -149,14 +166,14 @@ class TasksController < ApplicationController
149
166
  params[:period_id] = task.period.lower_item && task.period.lower_item.id
150
167
  move_to_period(true)
151
168
  else
152
- detour_to :action => :edit, :id => task
169
+ redirect_to :action => :edit, :id => task
153
170
  end
154
171
  end
155
172
 
156
173
  def finish
157
174
  @task = Task.find(params[:id])
158
175
  @task.finish(Task::COMPLETED, true)
159
- redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task_id => @task.id
176
+ back_or_redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task_id => @task.id
160
177
  end
161
178
 
162
179
  def abort
@@ -174,7 +191,7 @@ class TasksController < ApplicationController
174
191
  def start_work
175
192
  task = Task.find(params[:id])
176
193
  task.start_work
177
- redirect_to :controller => 'periods', :action => :show, :id => task.period, :task => task.id
194
+ back_or_redirect_to :controller => 'periods', :action => :show, :id => task.period, :task => task.id
178
195
  end
179
196
 
180
197
  def end_work
@@ -27,8 +27,7 @@ class Task < ActiveRecord::Base
27
27
  #validates_uniqueness_of :description, :scope => :backlog_id, :if => Proc.new {|task| task.backlog_id && task.previous_task_id.nil?}
28
28
  validates_uniqueness_of :description, :scope => :period_id, :if => :period_id
29
29
  validates_uniqueness_of :position, :scope => :period_id, :if => :period_id, :allow_nil => true
30
- validates_uniqueness_of :position, :scope => :parent_id, :if => :parent_id, :allow_nil => true
31
- validates_uniqueness_of :position, :scope => :backlog_id, :if => Proc.new {|task| task.period_id.nil? && task.parent_id.nil?}, :allow_nil => true
30
+ validates_uniqueness_of :position, :scope => [:period_id, :backlog_id], :if => Proc.new {|task| task.period_id.nil?}, :allow_nil => true
32
31
 
33
32
  def validate
34
33
  if self.parent_id && (self.period_id || self.backlog_id)
@@ -10,7 +10,7 @@
10
10
  <% current_period = nil %>
11
11
  <% for @task in tasks %>
12
12
  <% if @task.period != current_period %>
13
- <tr><th colspan="6"><%=@task.period ? h(@task.period.name) : l(:unplanned_tasks)%></th></tr>
13
+ <tr><th colspan="6"><%=link_to (@task.period ? h(@task.period.name) : l(:unplanned_tasks)), :controller => 'periods', :action => :show, :id => @task.period%></th></tr>
14
14
  <%= render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :track_times => tasks.find {|t|t.period && t.period.active?}} %>
15
15
  <% current_period = @task.period %>
16
16
  <% end %>
@@ -10,4 +10,14 @@
10
10
 
11
11
  <div id="maincontent">
12
12
  <%=render :partial => 'tasks', :locals => {:tasks => @tasks}%>
13
+
14
+ <div class="mainblock">
15
+ <div class="btitle">
16
+ <h4><%=l(:completed_tasks) %></h4>
17
+ </div>
18
+
19
+ <%=render :partial => '/tasks/completed', :locals => {:i => 1} %>
20
+ </div>
21
+
13
22
  </div>
23
+
@@ -11,20 +11,5 @@
11
11
  <h4><%=l(:completed_tasks) %></h4>
12
12
  </div>
13
13
 
14
- <table class="input">
15
- <tr>
16
- <th/>
17
- <th align="left"><%=l :resolution %></th>
18
- <th><%=l :task %></th>
19
- <% if @period.track_work? -%>
20
- <th></th>
21
- <th><%=l :done %></th>
22
- <% end %>
23
- </tr>
24
- <% for task in @completed_tasks %>
25
- <%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task } %>
26
- <% i += 1 %>
27
- <% end %>
28
- </table>
29
-
14
+ <%=render :partial => '/tasks/completed', :locals => {:i => i} %>
30
15
  </div>
@@ -0,0 +1,13 @@
1
+ <table class="input">
2
+ <tr>
3
+ <th/>
4
+ <th align="left"><%=l :resolution %></th>
5
+ <th><%=l :task %></th>
6
+ <th></th>
7
+ <th><%=l(:done) if (@period && @period.track_work?) || @completed_tasks.find {|t| t.track_times?} %></th>
8
+ </tr>
9
+ <% for task in @completed_tasks %>
10
+ <%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task } %>
11
+ <% i += 1 %>
12
+ <% end %>
13
+ </table>
@@ -31,7 +31,7 @@
31
31
  :class => :task_time, :maxlength => 5, :onkeypress => "handleEvent(this, event, #{@task.id})" %>
32
32
  <%= image_detour_to('ernes_stop.png', l(:end_work), {:controller => 'tasks', :action => :end_work, :id => @task.id}, nil, true) %>
33
33
  <% elsif @task.track_times? && @task.period && @task.period.active? %>
34
- <%= image_button_to 'hammer.png', l(:start_work), :controller => 'tasks', :action => :start_work, :id => @task.id %>
34
+ <%= image_detour_to 'hammer.png', l(:start_work), {:controller => 'tasks', :action => :start_work, :id => @task.id}, nil, true %>
35
35
  <% end -%>
36
36
  <% end %>
37
37
  <% end -%>
@@ -64,7 +64,7 @@
64
64
  <% end %>
65
65
  <% end -%>
66
66
  <% if (not @task.track_times?) && !@task.work_started? && @task.period && @task.period.active? %>
67
- <%= image_button_to('checkmark.png', l(:complete), :controller => 'tasks', :action => :finish, :id => @task)%>
67
+ <%= image_detour_to('checkmark.png', l(:complete), {:controller => 'tasks', :action => :finish, :id => @task}, nil, true)%>
68
68
  <% end -%>
69
69
  <% end -%>
70
70
  <% end -%>
@@ -78,7 +78,7 @@
78
78
  <%= image_detour_to('ernes_stop.png', l(:abort), {:controller => 'tasks', :action => :abort, :id => @task}, nil, true)%>
79
79
  <% end %>
80
80
  <% end %>
81
- <% elsif (not @task.period.passed?) && @task.leaf? %>
81
+ <% elsif @task.period && (not @task.period.passed?) && @task.leaf? %>
82
82
  <%=image_detour_to('/images/eraser.png', l(:reopen), {:controller => 'tasks', :action => :reopen, :id => @task}, nil, true) %>
83
83
  <% end -%>
84
84
  <% end -%>
@@ -88,7 +88,7 @@
88
88
  <% if active && (@task.period.nil? || @task.period.active_or_future?) && (not @task.work_started?) %>
89
89
  <%= draggable_element "task_#{@task.id}", :revert => true, :constraint => "'vertical'" %>
90
90
  <%= drop_receiving_element "task_#{@task.id}",
91
- :update => update, :url => options_for_detour({:controller => 'tasks', :action => "move_to", :position => @task.position, :layout => false}),
91
+ :update => update, :url => options_for_detour({:controller => 'tasks', :action => "move_to", :period_id => @task.period_id, :position => @task.position, :layout => false}),
92
92
  :accept => "tasks",
93
93
  :loading => "",
94
94
  :complete => "",
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: backlog
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.5
6
+ version: 0.6.6
7
7
  date: 2007-08-07 00:00:00 +02:00
8
8
  summary: Application to aid collecting, processing, organizing, reviewing and doing tasks.
9
9
  require_paths:
@@ -1732,6 +1732,7 @@ files:
1732
1732
  - app/views/tasks/_form.rhtml
1733
1733
  - app/views/tasks/new.rhtml
1734
1734
  - app/views/tasks/_fields_header.rhtml
1735
+ - app/views/tasks/_completed.rhtml
1735
1736
  - app/views/tasks/edit.rhtml
1736
1737
  - app/views/tasks/list_started.rhtml
1737
1738
  - app/views/tasks/_task.rhtml