backlog 0.17.4 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.17.5 2008-01-15
2
+
3
+ === Fixes
4
+
5
+ * Fixed various ordering bugs.
6
+ * Fixed ajax for finishing and reopening tasks.
7
+
1
8
  == 0.17.4 2008-01-14
2
9
 
3
10
  === Features
@@ -96,7 +96,7 @@ class BacklogsController < ApplicationController
96
96
  @success, flash[:notice] = false, "Estimate was not numeric"
97
97
  end
98
98
  if @task.finished?
99
- load_tasks(@task.period)
99
+ load_tasks(@task.backlog)
100
100
  render :action => 'finish_task', :layout => false
101
101
  else
102
102
  render :template => '/tasks/update_estimate', :layout => false
@@ -162,7 +162,7 @@ class BacklogsController < ApplicationController
162
162
  params.keys.find {|k| k =~ /active_tasks_(.*)/}
163
163
  period_id = $1
164
164
  if period_id
165
- period = Period.find(period_id)
165
+ period = period_id.empty? ? nil : Period.find(period_id)
166
166
  tasks = params["active_tasks_#{period_id}"].select {|id| not id.empty?}
167
167
  tasks.each_with_index do |id,idx|
168
168
  task = Task.find(id)
@@ -1,8 +1,9 @@
1
1
  module BacklogsHelper
2
2
  def remove_active_task(page)
3
3
  page.visual_effect :blind_up, "task_#{@task.id}"
4
- if not @tasks.find {|t| t.period_id == @task.period_id}
5
- page["task_#{@task.id}"].ancestors.first.ancestors.first.remove
4
+ last_in_period = @tasks.find {|t| t.period_id == @task.period_id}.nil?
5
+ if last_in_period
6
+ page.remove "active_period_#{@task.period_id}"
6
7
  else
7
8
  page.remove "task_#{@task.id}"
8
9
  end
@@ -14,21 +15,20 @@ module BacklogsHelper
14
15
  end
15
16
 
16
17
  def add_finished_task(page)
18
+ list_tag_id = "completed_tasks_#{@task.period_id}"
17
19
  tasks_in_period = @completed_tasks.select {|t| t.period_id == @task.period_id}
18
20
  work_done = ! tasks_in_period.find {|t| t.total_done != 0}.nil?
19
- not_first = tasks_in_period.size > 1
20
- if not_first
21
- page.select("#completed_tasks_#{@task.period_id} tr").first.remove
22
- page.select("#completed_tasks_#{@task.period_id} tr").first.remove
23
- else
24
- page.insert_html :top, "completed_tasks", "<table id=\"completed_tasks_#{@task.period_id}\" class=\"input\" />"
21
+ first = tasks_in_period.size == 1
22
+ if first
23
+ period_tag_id = "completed_period_#{@task.period_id}"
24
+ page.insert_html :top, :completed_tasks, "<div id=\"#{period_tag_id}\ />"
25
+ page.insert_html :top, period_tag_id, "<ul id=\"#{list_tag_id}\" class=\"task_list\" />"
26
+ page.insert_html :top, period_tag_id, :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done}
27
+ page.insert_html :top, period_tag_id, :partial => '/tasks/period_header', :locals => {:period => @task.period}
25
28
  end
26
29
 
27
- page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false, :show_backlog => false}
30
+ page.insert_html :top, list_tag_id, :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false, :show_backlog => false}
28
31
  page.visual_effect :appear, "task_#{@task.id}"
29
-
30
- page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done}
31
- page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/period_header', :locals => {:period => @task.period}
32
32
  end
33
33
 
34
34
  def remove_finished_task(page)
@@ -36,26 +36,33 @@ module BacklogsHelper
36
36
  page.remove "task_#{@task.id}"
37
37
 
38
38
  unless @completed_tasks.find {|t| t.period_id == @task.period_id}
39
- page["completed_tasks_#{@task.period_id}"].remove
39
+ page["completed_period_#{@task.period_id}"].remove
40
40
  end
41
41
  end
42
42
 
43
43
  def add_active_task(page)
44
+ list_tag_id = "active_tasks_#{@task.period_id}"
44
45
  tasks_in_period = @tasks.select{|t| t.period_id == @task.period_id}
45
46
  first_in_period = tasks_in_period.size == 1
46
47
  if first_in_period
47
- page.insert_html :top, :active_tasks, %Q{<table id="active_tasks_#{@task.period_id}" class="input" style="width: 100%;"/>}
48
- else
49
- page.select("#active_tasks_#{@task.period_id} tr").first.remove
50
- page.select("#active_tasks_#{@task.period_id} tr").first.remove
48
+ period_tag_id = "active_period_#{@task.period_id}"
49
+ period_tag = %Q{<div id="#{period_tag_id}" style="width: 100%;" />}
50
+ if @task.period.nil?
51
+ page.insert_html :bottom, :active_tasks, period_tag
52
+ elsif @task.period.higher_item.nil? || @tasks.find {|t| t.period == @task.period.higher_item}.nil?
53
+ page.insert_html :top, :active_tasks, period_tag
54
+ else
55
+ page.insert_html :after, "active_period_#{@task.period.higher_item.id}", period_tag
56
+ end
57
+ page.insert_html :top, period_tag_id, %Q{<ul id="#{list_tag_id}" class="task_list" style="width: 100%;"/>}
58
+ fields_header = render(:partial => '/tasks/fields_header', :locals => { :backlog => @task.backlog, :active => true, :track_todo => @task.backlog.track_todo?, :track_done => @task.backlog.track_done?, :track_times => tasks_in_period.find {|t|t.period && t.period.active?} } )
59
+ page.insert_html :top, period_tag_id, fields_header
60
+ page.insert_html :top, period_tag_id, render(:partial => "/tasks/period_header", :locals => {:period => @task.period})
51
61
  end
52
62
 
53
- page.insert_html(:top, "active_tasks_#{@task.period_id}", render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }))
54
-
55
- fields_header = render(:partial => '/tasks/fields_header', :locals => { :backlog => @task.backlog, :active => true, :track_todo => @task.backlog.track_todo?, :track_done => @task.backlog.track_done?, :track_times => tasks_in_period.find {|t|t.period && t.period.active?} } )
56
- page.insert_html :top, "active_tasks_#{@task.period_id}", fields_header
57
- page.insert_html :top, "active_tasks_#{@task.period_id}", render(:partial => "/tasks/period_header", :locals => {:period => @task.period})
58
-
63
+ page.insert_html(:top, list_tag_id, render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }))
64
+ record page, sortable_element_js(list_tag_id, :url => { :action => :order }, :containment => @tasks.map{|t| t.period_id}.uniq.map{|p| "active_tasks_#{p}"}, :constraint => false)
65
+
59
66
  page[:no_tasks_message].hide
60
67
 
61
68
  if @tasks.size == 1
@@ -1,11 +1,7 @@
1
1
  module PeriodsHelper
2
2
  def remove_active_task(page)
3
3
  page.visual_effect :blind_up, "task_#{@task.id}"
4
- if @tasks.find {|t| t.backlog_id == @task.backlog_id}.nil?
5
- page["task_#{@task.id}"].ancestors.first.ancestors.first.remove
6
- else
7
- page.remove "task_#{@task.id}"
8
- end
4
+ page.remove "task_#{@task.id}"
9
5
 
10
6
  if @tasks.empty?
11
7
  page.visual_effect :blind_up, "active_tasks"
@@ -18,23 +14,14 @@ module PeriodsHelper
18
14
  page.remove "task_#{@task.id}"
19
15
 
20
16
  if @last_finished
21
- page.select('#completed_tasks tr').first.remove
17
+ page.visual_effect :fade, "completed_period_#{@task.period_id}"
18
+ page.remove "completed_period_#{@task.period_id}"
19
+ page.visual_effect :fade, :completed_tasks
22
20
  end
23
- end
21
+ end
24
22
 
25
23
  def add_active_task(page)
26
- if @task.lower_item.nil? || @task.lower_item.backlog != @task.backlog
27
- page.insert_html :top, :active_tasks, '<table class="input" style="width: 100%;"/>'
28
- elsif @task.lower_item
29
- page.select('#active_tasks table tr').first.remove
30
- page.select('#active_tasks table tr').first.remove
31
- end
32
-
33
- insert(page, render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }), '#active_tasks table')
34
-
35
- fields_header = render(:partial => '/tasks/fields_header', :locals => { :backlog => @task.backlog, :active => true } )
36
- insert(page, fields_header, '#active_tasks table')
37
- insert(page, render(:partial => "/tasks/backlog_header", :locals => {:backlog => @task.backlog}), '#active_tasks table')
24
+ page.insert_html(:top, "active_tasks_#{@task.period.id}", render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }))
38
25
 
39
26
  page[:no_tasks_message].hide
40
27
 
@@ -45,18 +32,22 @@ module PeriodsHelper
45
32
  end
46
33
 
47
34
  def add_finished_task(page)
35
+ list_tag_id = "completed_tasks_#{@task.period_id}"
48
36
  work_done = ! @completed_tasks.find {|t| t.total_done != 0}.nil?
49
37
  first_finished = @completed_tasks.find {|t| t.id != @task.id}.nil?
50
- unless first_finished
51
- page.select("#completed_tasks_#{@task.period_id} tr").first.remove
52
- else
53
- page.insert_html :top, "completed_tasks", "<table id=\"completed_tasks_#{@task.period_id}\" class=\"input\" />"
38
+ first_in_period = @completed_tasks.find {|t| t.period_id == @task.period_id && t.id != @task.id}.nil?
39
+ if first_finished
40
+ page.visual_effect :appear, "completed_tasks"
54
41
  end
55
-
56
- page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false}
42
+ if first_in_period
43
+ period_tag_id = "completed_period_#{@task.period_id}"
44
+ page.insert_html :top, "completed_tasks", %Q{<div id="#{period_tag_id}" />}
45
+ page.insert_html :top, period_tag_id, %Q{<ul id="#{list_tag_id}" class="task_list"/>}
46
+ page.insert_html :top, period_tag_id, :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done}
47
+ end
48
+ page.insert_html :top, list_tag_id, :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false}
57
49
  page.visual_effect :appear, "task_#{@task.id}"
58
50
 
59
- page.insert_html :top, "completed_tasks_#{@task.period_id}", :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false, :work_done => work_done}
60
51
  end
61
52
 
62
53
  def update_burn_down_chart(page)
data/app/models/task.rb CHANGED
@@ -142,7 +142,6 @@ class Task < ActiveRecord::Base
142
142
  end
143
143
 
144
144
  def move_to_period(new_period)
145
- raise "Period missing" unless new_period
146
145
  raise "Cannot move finished tasks" unless active?
147
146
  return self if new_period == period
148
147
 
@@ -151,10 +150,10 @@ class Task < ActiveRecord::Base
151
150
 
152
151
  if self.period
153
152
  old_todo = self.todo
154
- self.finish(new_period.party == self.period.party ? Task::POSTPONED : Task::MOVED, true)
153
+ self.finish((new_period.nil? || (new_period.party == self.period.party)) ? Task::POSTPONED : Task::MOVED, true)
155
154
  ancestor_id = self.previous_task_id || self.id
156
- existing_task = Task.find_by_period_id_and_id(new_period.id, ancestor_id)
157
- if existing_task ||= Task.find_by_period_id_and_previous_task_id(new_period.id, ancestor_id)
155
+ existing_task = Task.find_by_period_id_and_id(new_period && new_period.id, ancestor_id)
156
+ if existing_task ||= Task.find_by_period_id_and_previous_task_id(new_period && new_period.id, ancestor_id)
158
157
  raise "mismatch" unless existing_task.backlog == root_task.backlog
159
158
  raise "Mismatch" unless existing_task.period == new_period
160
159
  existing_task.open
@@ -177,7 +176,7 @@ class Task < ActiveRecord::Base
177
176
  return new_task
178
177
  end
179
178
  else
180
- self.period_id = new_period.id
179
+ self.period_id = new_period && new_period.id
181
180
  self.period = new_period
182
181
  self.insert_at(1)
183
182
  self.position = 1
@@ -4,25 +4,26 @@
4
4
  <%=render :partial => 'buttons' %><h4><%=l :tasks %></h4>
5
5
  </div>
6
6
  <div id="active_tasks"<%=' style="display: none;"' unless @tasks and not @tasks.empty? %>>
7
- <%#=render :partial => '/tasks/backlog_header', :locals => {:backlog => @backlog, :track_times => @tasks.find {|t|t.period && t.period.active?}} %>
8
7
  <%i = 0 %>
9
8
  <% periods = @tasks.map {|t| t.period}.uniq %>
10
- <% period_ids = periods.map {|period| "active_tasks_#{period ? period.id : ''}"} %>
9
+ <% list_ids = periods.map {|period| "active_tasks_#{period && period.id}"} %>
11
10
  <%for period in periods %>
12
11
  <% tasks_in_period = @tasks.select {|t| t.period_id == (period && period.id)} %>
13
12
  <% work_done = !tasks_in_period.find{|t| t.total_done > 0}.nil? %>
13
+ <div id="active_period_<%=period && period.id%>">
14
14
  <%=render :partial => '/tasks/period_header', :locals => {:period => period} if @backlog.enable_periods %>
15
- <%=render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => true, :track_times => tasks_in_period.find {|t|t.period && t.period.active?}, :work_done => work_done} %>
16
- <ul id="active_tasks_<%=period ? period.id : '' %>" class="task_list">
15
+ <%=render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => true, :track_todo => @backlog.track_todo?, :track_done => @backlog.track_done?, :track_times => tasks_in_period.find {|t|t.period && t.period.active?}, :work_done => work_done} %>
16
+ <ul id="active_tasks_<%=period && period.id%>" class="task_list">
17
17
  <%for @task in tasks_in_period %>
18
18
  <%=render :partial => '/tasks/task/', :locals => {:task => @task, :i => i += 1, :active => true, :highlight_task => false, :update => :maincontent, :show_backlog => false, :hidden => false} %>
19
19
  <%end %>
20
20
  </ul>
21
- <% end %>
22
- <%for period in periods %>
23
- <%=sortable_element "active_tasks_#{period ? period.id : ''}", :url => { :action => :order }, :containment => period_ids, :constraint => false %>
21
+ </div>
24
22
  <% end %>
25
23
  </div>
24
+ <%for list_id in list_ids %>
25
+ <%=sortable_element list_id, :url => { :action => :order }, :containment => list_ids, :constraint => false %>
26
+ <% end %>
26
27
  <p id="no_tasks_message"<%=' style="display: none;"' if @tasks and not @tasks.empty? %>>
27
28
  <%=l :no_pending_tasks_in_backlog %>
28
29
  </p>
@@ -37,7 +37,6 @@ function handleEvent(field, event, id) {
37
37
  <ul id="active_tasks_<%=@period.id%>" class="task_list">
38
38
  <% for task in @tasks -%>
39
39
  <%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => true, :highlight_task => task == @selected_task, :update => :spotlight, :show_backlog => true, :hidden => false } %>
40
- <%#=render :partial => '/tasks/backlog_header', :locals => { :backlog => task.backlog, :track_times => task.backlog.track_done? && @tasks.find {|t|t.period && t.period.active?} } %>
41
40
  <% i += 1 %>
42
41
  <% end -%>
43
42
  </ul>
@@ -1,14 +1,16 @@
1
- <div id="completed_tasks" style="margin: 0px; border: 0px; padding: 0px">
1
+ <div id="completed_tasks" style="margin: 0px; border: 0px; padding: 0px; <%='display: none' if @completed_tasks.empty?%>">
2
2
  <% @completed_tasks.map {|t| t.period}.uniq.each do |period| %>
3
- <ul id="completed_tasks_<%=period ? period.id : ''%>" class="input" style="width: 100%; list-style-type: none; margin: 0px; border: 0px; padding: 0px">
4
3
  <% tasks_in_period = @completed_tasks.select {|t| t.period == period} %>
5
4
  <% work_done = !tasks_in_period.find{|t| t.total_done != 0}.nil? %>
6
- <%=render :partial => '/tasks/period_header', :locals => {:period => period} unless @completed_tasks.map(&:period).uniq.size == 1 %>
7
- <%=render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => false, :track_times => false, :work_done => work_done} %>
8
- <% @completed_tasks.select {|t| t.period == period}.each do |task| %>
9
- <%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task, :hidden => false } %>
10
- <% i += 1 %>
11
- <% end %>
12
- </ul>
5
+ <div id="completed_period_<%=period && period.id%>">
6
+ <%=render :partial => '/tasks/period_header', :locals => {:period => period} unless @completed_tasks.map(&:period).uniq.size == 1 %>
7
+ <%=render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => false, :track_times => false, :work_done => work_done} %>
8
+ <ul id="completed_tasks_<%=period && period.id%>" class="task_list" style="width: 100%;">
9
+ <% @completed_tasks.select {|t| t.period == period}.each do |task| %>
10
+ <%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task, :hidden => false } %>
11
+ <% i += 1 %>
12
+ <% end %>
13
+ </ul>
14
+ </div>
13
15
  <% end %>
14
16
  </div>
@@ -47,6 +47,7 @@ class BacklogsControllerTest < Test::Unit::TestCase
47
47
 
48
48
  assert_not_nil assigns(:backlog)
49
49
  assert assigns(:backlog).valid?
50
+ assert_not_nil assigns(:tasks)
50
51
  end
51
52
 
52
53
  def test_new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.4
4
+ version: 0.17.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-14 00:00:00 +01:00
12
+ date: 2008-01-15 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency