backlog 0.35.5 → 0.36.2

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.
Files changed (150) hide show
  1. data/Gemfile +19 -0
  2. data/Gemfile~ +4 -0
  3. data/History.txt +25 -0
  4. data/Rakefile +3 -3
  5. data/app/controllers/{application.rb → application_controller.rb} +1 -2
  6. data/app/controllers/backlogs_controller.rb +0 -16
  7. data/app/controllers/search_controller.rb +0 -2
  8. data/app/controllers/user_controller.rb +7 -7
  9. data/app/controllers/work_locks_controller.rb +2 -2
  10. data/app/controllers/works_controller.rb +23 -23
  11. data/app/helpers/application_helper.rb +9 -6
  12. data/app/helpers/backlogs_helper.rb +1 -1
  13. data/app/helpers/periods_helper.rb +1 -1
  14. data/app/models/backlog.rb +13 -10
  15. data/app/models/period.rb +0 -5
  16. data/app/models/sidebar.rb +1 -0
  17. data/app/models/task.rb +4 -10
  18. data/app/models/user.rb +5 -6
  19. data/app/models/user_notify.rb +0 -1
  20. data/app/models/work.rb +20 -25
  21. data/app/models/works_report_filter.rb +4 -4
  22. data/app/views/backlogs/_buttons.rhtml +1 -1
  23. data/app/views/backlogs/_form.rhtml +5 -9
  24. data/app/views/layouts/_left_top.rhtml +0 -1
  25. data/app/views/periods/_form.rhtml +1 -1
  26. data/app/views/search/results.rhtml +1 -12
  27. data/app/views/task_notify/{invite_en.rhtml → invite.en.html.erb} +0 -0
  28. data/app/views/task_notify/{invite_no.rhtml → invite.no.html.erb} +0 -0
  29. data/app/views/tasks/_task.rhtml +49 -50
  30. data/app/views/tasks/edit.rhtml +4 -4
  31. data/app/views/tasks/start_work.rjs +1 -1
  32. data/app/views/user/_edit.rhtml +1 -1
  33. data/app/views/user/change_password.rhtml +1 -1
  34. data/app/views/user/edit.rhtml +4 -4
  35. data/app/views/user/signup.rhtml +2 -2
  36. data/app/views/user_notify/{change_password_en.rhtml → change_password.en.html.erb} +0 -0
  37. data/app/views/user_notify/{change_password_no.rhtml → change_password.no.html.erb} +0 -0
  38. data/app/views/user_notify/{forgot_password_en.rhtml → forgot_password.en.html.erb} +0 -0
  39. data/app/views/user_notify/{forgot_password_no.rhtml → forgot_password.no.html.erb} +0 -0
  40. data/app/views/user_notify/{monitoring_en.rhtml → monitoring.en.html.erb} +0 -0
  41. data/app/views/user_notify/{monitoring_no.rhtml → monitoring.no.html.erb} +0 -0
  42. data/app/views/user_notify/{monitoring_invitation_en.rhtml → monitoring_invitation.en.html.erb} +0 -0
  43. data/app/views/user_notify/{monitoring_invitation_no.rhtml → monitoring_invitation.no.html.erb} +0 -0
  44. data/app/views/user_notify/{signup_en.rhtml → signup.en.html.erb} +0 -0
  45. data/app/views/user_notify/{signup_no.rhtml → signup.no.html.erb} +0 -0
  46. data/app/views/work_lock_notify/{lock_en.rhtml → lock.en.html.erb} +0 -0
  47. data/app/views/work_lock_notify/{lock_no.rhtml → lock.no.html.erb} +0 -0
  48. data/app/views/work_lock_notify/{nag_en.rhtml → nag.en.html.erb} +0 -0
  49. data/app/views/work_lock_notify/{nag_no.rhtml → nag.no.html.erb} +0 -0
  50. data/app/views/works/_form.rhtml +6 -6
  51. data/app/views/works/_new_row.rhtml +6 -6
  52. data/app/views/works/_row.rhtml +2 -2
  53. data/app/views/works/daily_work_sheet.rhtml +1 -1
  54. data/app/views/works/list.rhtml +6 -6
  55. data/app/views/works/list_excel.rhtml +8 -4
  56. data/app/views/works/timeliste.rhtml +14 -14
  57. data/app/views/works/update_row.rjs +1 -1
  58. data/app/views/works/weekly_work_sheet.rhtml +5 -5
  59. data/app/views/works/weekly_work_sheet_details.rhtml +5 -5
  60. data/config/boot.rb +108 -27
  61. data/config/database.yml +3 -26
  62. data/config/environment.rb +4 -12
  63. data/config/environments/development.rb +0 -1
  64. data/config/initializers/jdbc.rb +7 -0
  65. data/config/initializers/mongrel.rb +83 -0
  66. data/config/locales/en.yml +189 -0
  67. data/config/locales/no.yml +192 -0
  68. data/config/preinitializer.rb +20 -0
  69. data/cruise_build.sh +10 -0
  70. data/cruise_config.rb +1 -1
  71. data/db/migrate/20100720124707_merge_work_account_into_backlog.rb +74 -0
  72. data/db/schema.rb +93 -127
  73. data/lib/class_table_inheritance.rb +53 -11
  74. data/lib/tasks/jdbc.rake +8 -0
  75. data/lib/user_system.rb +5 -1
  76. data/public/javascripts/controls.js +76 -79
  77. data/public/javascripts/dragdrop.js +166 -167
  78. data/public/javascripts/effects.js +174 -168
  79. data/public/javascripts/prototype.js +470 -334
  80. data/public/stylesheets/mwrt002.css +6 -6
  81. data/script/dbconsole +3 -0
  82. data/test/fixtures/backlogs.yml +2 -2
  83. data/test/fixtures/work_lock_subscriptions.yml +2 -2
  84. data/test/fixtures/works.yml +6 -6
  85. data/test/functional/absences_controller_test.rb +1 -1
  86. data/test/functional/backlogs_controller_test.rb +4 -4
  87. data/test/functional/customers_controller_test.rb +1 -1
  88. data/test/functional/dashboard_controller_test.rb +1 -1
  89. data/test/functional/estimates_controller_test.rb +1 -1
  90. data/test/functional/groups_controller_test.rb +1 -1
  91. data/test/functional/parties_controller_test.rb +1 -1
  92. data/test/functional/periods_controller_test.rb +1 -1
  93. data/test/functional/public_holidays_controller_test.rb +1 -1
  94. data/test/functional/search_controller_test.rb +1 -1
  95. data/test/functional/task_files_controller_test.rb +1 -1
  96. data/test/functional/tasks_controller_test.rb +6 -6
  97. data/test/functional/user_controller_test.rb +3 -2
  98. data/test/functional/welcome_controller_test.rb +1 -1
  99. data/test/functional/work_locks_controller_test.rb +1 -1
  100. data/test/functional/works_controller_test.rb +11 -11
  101. data/test/test_helper.rb +2 -2
  102. data/test/unit/absence_test.rb +1 -1
  103. data/test/unit/configuration_test.rb +1 -1
  104. data/test/unit/customer_test.rb +1 -1
  105. data/test/unit/estimate_test.rb +1 -1
  106. data/test/unit/group_test.rb +1 -1
  107. data/test/unit/party_test.rb +1 -1
  108. data/test/unit/period_test.rb +1 -1
  109. data/test/unit/public_holiday_test.rb +1 -1
  110. data/test/unit/task_file_test.rb +1 -1
  111. data/test/unit/task_test.rb +1 -1
  112. data/test/unit/user_test.rb +1 -1
  113. data/test/unit/work_lock_subscription_test.rb +1 -1
  114. data/test/unit/work_lock_test.rb +1 -1
  115. data/test/unit/work_test.rb +8 -8
  116. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +3 -3
  117. data/vendor/plugins/assert_cookie/lib/assert_cookie.rb +2 -2
  118. data/vendor/plugins/auto_complete/README +23 -0
  119. data/vendor/plugins/auto_complete/Rakefile +22 -0
  120. data/vendor/plugins/auto_complete/init.rb +2 -0
  121. data/vendor/plugins/auto_complete/lib/auto_complete.rb +47 -0
  122. data/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +143 -0
  123. data/vendor/plugins/auto_complete/test/auto_complete_test.rb +67 -0
  124. data/vendor/plugins/backlog_jira/init.rb +4 -0
  125. data/vendor/plugins/backlog_jira/{tasks → lib/tasks}/backlog_jira_tasks.rake +0 -0
  126. data/vendor/plugins/has_history/{tasks → lib/tasks}/has_history_tasks.rake +0 -0
  127. metadata +745 -817
  128. data/#SearchRequest.xml# +0 -3443
  129. data/app/controllers/application.rb~ +0 -207
  130. data/app/controllers/work_accounts_controller.rb +0 -58
  131. data/app/helpers/work_accounts_helper.rb +0 -2
  132. data/app/models/work_account.rb +0 -18
  133. data/app/models/work_lock_subscription.rb +0 -3
  134. data/app/views/work_accounts/_form.rhtml +0 -16
  135. data/app/views/work_accounts/_name_list.rhtml +0 -5
  136. data/app/views/work_accounts/_title.rhtml +0 -5
  137. data/app/views/work_accounts/edit.rhtml +0 -12
  138. data/app/views/work_accounts/list.rhtml +0 -31
  139. data/app/views/work_accounts/new.rhtml +0 -10
  140. data/app/views/work_accounts/show.rhtml +0 -50
  141. data/config/environments/localization_environment.rb +0 -10
  142. data/jira.log +0 -98246
  143. data/lang/en.yaml +0 -147
  144. data/lang/localizations.yaml +0 -2
  145. data/lang/no.yaml +0 -146
  146. data/lib/localization.rb +0 -88
  147. data/test/fixtures/work_accounts.yml +0 -7
  148. data/test/functional/work_accounts_controller_test.rb +0 -94
  149. data/test/unit/localization_test.rb +0 -47
  150. data/test/unit/work_account_test.rb +0 -10
@@ -1,5 +1,4 @@
1
1
  class Period < ActiveRecord::Base
2
- include Localization
3
2
  extend UserSystem
4
3
  include UserSystem
5
4
 
@@ -158,10 +157,6 @@ class Period < ActiveRecord::Base
158
157
  not backlogs.find {|backlog| backlog.track_todo?}.nil?
159
158
  end
160
159
 
161
- def track_work?
162
- not backlogs.find {|backlog| backlog.work_account}.nil?
163
- end
164
-
165
160
  def track_times?
166
161
  not backlogs.find {|backlog| backlog.track_times?}.nil?
167
162
  end
@@ -2,6 +2,7 @@ require 'action_view/helpers/url_helper'
2
2
 
3
3
  class Sidebar
4
4
  include ActionView::Helpers::UrlHelper
5
+ include ActionView::Helpers::TagHelper
5
6
  include ERB::Util
6
7
 
7
8
  def initialize(controller)
@@ -13,7 +13,6 @@ class Task < ActiveRecord::Base
13
13
  belongs_to :period
14
14
  belongs_to :ancestor_task, :class_name => 'Task', :foreign_key => 'previous_task_id'
15
15
  belongs_to :customer
16
- belongs_to :work_account
17
16
  has_many :descendant_tasks, :class_name => 'Task', :foreign_key => 'previous_task_id', :dependent => :destroy
18
17
  has_many :estimates, :order => 'created_at', :dependent => :destroy
19
18
  has_many :works, :order => 'completed_at', :dependent => :destroy
@@ -284,11 +283,11 @@ class Task < ActiveRecord::Base
284
283
  end
285
284
 
286
285
  def track_done?
287
- not root_task.backlog.work_account.nil?
286
+ backlog.track_done?
288
287
  end
289
-
288
+
290
289
  def track_times?
291
- work_account && work_account.track_times?
290
+ backlog.try :track_times?
292
291
  end
293
292
 
294
293
  def track_todo?
@@ -321,11 +320,6 @@ class Task < ActiveRecord::Base
321
320
  old_backlog || root_task.old_backlog
322
321
  end
323
322
 
324
- alias_method :old_work_account, :work_account
325
- def work_account
326
- self.old_work_account || (parent ? parent.work_account : backlog.work_account)
327
- end
328
-
329
323
  def depth
330
324
  root_task = self
331
325
  depth = 0
@@ -386,7 +380,7 @@ class Task < ActiveRecord::Base
386
380
  end
387
381
 
388
382
  new_work.user = current_user
389
- new_work.work_account_id = work_account.id
383
+ new_work.backlog_id = backlog.id
390
384
  new_work.save!
391
385
  works << new_work
392
386
  end
@@ -39,7 +39,7 @@ class User < Party
39
39
  validates_length_of :role, :allow_nil => true, :maximum => 40
40
40
 
41
41
  validates_length_of :security_token, :allow_nil => true, :maximum => 40
42
- validates_inclusion_of :deleted, :in => [true, false], :allow_nil => true, :message => ActiveRecord::Errors.default_error_messages[:blank]
42
+ validates_inclusion_of :deleted, :in => [true, false], :allow_nil => true, :message => I18n.translate('activerecord.errors.messages')[:blank]
43
43
 
44
44
  def initialize(attributes = nil)
45
45
  super
@@ -61,12 +61,11 @@ class User < Party
61
61
  # not the regular authenticate call)
62
62
  logger.info "Attempting authorization of #{id} with #{token}"
63
63
  u = find(:first, :conditions => ["id = ? AND security_token = ?", id, token])
64
- if u
65
- logger.info "Authenticated by token: #{u.inspect}"
66
- else
67
- logger.info "Not authenticated" if u.nil?
64
+ if u.nil? || u.token_expired?
65
+ logger.info "Not authenticated"
66
+ return nil
68
67
  end
69
- return nil if (u.nil? or u.token_expired?)
68
+ logger.info "Authenticated by token: #{u.inspect}"
70
69
  u.update_attribute :verified, true
71
70
  return u
72
71
  end
@@ -1,5 +1,4 @@
1
1
  class UserNotify < ActionMailer::Base
2
- include Localization
3
2
 
4
3
  def signup(user, password, url=nil)
5
4
  setup_email(user)
@@ -4,11 +4,11 @@ class Work < ActiveRecord::Base
4
4
 
5
5
  belongs_to :task
6
6
  belongs_to :user
7
- belongs_to :work_account
7
+ belongs_to :backlog
8
8
  belongs_to :customer
9
9
 
10
10
  validates_associated :task
11
- validates_presence_of :work_account
11
+ validates_presence_of :backlog
12
12
  validates_presence_of :started_on
13
13
  validates_presence_of :start_time, :if => :track_times?
14
14
 
@@ -17,13 +17,8 @@ class Work < ActiveRecord::Base
17
17
  self.invoice = true if self.invoice.nil?
18
18
  end
19
19
 
20
- alias_method :old_work_account, :work_account
21
- def work_account
22
- self.old_work_account || (task && task.work_account)
23
- end
24
-
25
20
  def track_times?
26
- work_account && work_account.track_times?
21
+ backlog && backlog.track_times?
27
22
  end
28
23
 
29
24
  # Return an array with an array of works per day:
@@ -49,23 +44,23 @@ class Work < ActiveRecord::Base
49
44
 
50
45
  # Return a hash with work accounts as keys an array of work hours totals per day as values:
51
46
  # {
52
- # <#WorkAccount#1> => [ 8, 7, 9, 12, 4, nil, nil],
53
- # <#WorkAccount#2> => [nil, 1, nil, nil, 4, nil, nil],
54
- # <#WorkAccount#3> => [nil, nil, nil, nil, nil, 4, 3],
47
+ # <#Backlog#1> => [ 8, 7, 9, 12, 4, nil, nil],
48
+ # <#Backlog#2> => [nil, 1, nil, nil, 4, nil, nil],
49
+ # <#Backlog#3> => [nil, nil, nil, nil, nil, 4, 3],
55
50
  # ]
56
- def self.works_for_week_by_work_account(year, week_no, user = current_user)
51
+ def self.works_for_week_by_backlog(year, week_no, user = current_user)
57
52
  first_date = Date.commercial(year, week_no, 1)
58
53
  last_date = first_date + 6
59
54
  works = find(:all, :conditions => "user_id #{user ? " = #{user.id}" : "IS NULL"} AND started_on BETWEEN '#{first_date}' AND '#{last_date}'", :order => 'completed_at, started_on, start_time')
60
55
  result = {}
61
56
  works.each do |work|
62
57
  day_of_week = work.started_on.cwday - 1
63
- result[work.work_account] ||= []
64
- result[work.work_account][day_of_week] ||= BigDecimal('0')
65
- result[work.work_account][day_of_week] += work.hours
58
+ result[work.backlog] ||= []
59
+ result[work.backlog][day_of_week] ||= BigDecimal('0')
60
+ result[work.backlog][day_of_week] += work.hours
66
61
  end
67
- result.values.each {|work_account_totals| work_account_totals[6] ||= nil}
68
- result.values.each {|work_account_totals| (0..6).each {|i| work_account_totals[i] = nil if work_account_totals[i] == 0}}
62
+ result.values.each {|backlog_totals| backlog_totals[6] ||= nil}
63
+ result.values.each {|backlog_totals| (0..6).each {|i| backlog_totals[i] = nil if backlog_totals[i] == 0}}
69
64
  result
70
65
  end
71
66
 
@@ -78,24 +73,24 @@ class Work < ActiveRecord::Base
78
73
  first = Date.commercial(year, week_no, 1)
79
74
  last = first + 6
80
75
  works = find(:all, :conditions => "completed_at IS NOT NULL AND started_on BETWEEN '#{first}' AND '#{last}'", :order => 'started_on, start_time, completed_at')
81
- totals_per_work_account = {}
82
- works.map{|w| w.work_account}.uniq.each do |work_account|
83
- totals_per_work_account[work_account.id] = [[], []]
76
+ totals_per_backlog = {}
77
+ works.map{|w| w.backlog}.uniq.each do |backlog|
78
+ totals_per_backlog[backlog.id] = [[], []]
84
79
  (0..6).each do |day|
85
- works_for_day = works.select {|work| (work.work_account == work_account) && (work.started_on == (first + day)) && ((user.nil? && work.user_id.nil?) || (user && work.user_id == user.id)) }
80
+ works_for_day = works.select {|work| (work.backlog == backlog) && (work.started_on == (first + day)) && ((user.nil? && work.user_id.nil?) || (user && work.user_id == user.id)) }
86
81
  invoice_works_for_day = works_for_day.select {|work| work.invoice? }
87
82
  internal_works_for_day = works_for_day.select {|work| !work.invoice? }
88
83
 
89
84
  invoice_day_total = invoice_works_for_day.reduce(BigDecimal('0')){|total, work| total += work.hours}
90
85
  internal_day_total = internal_works_for_day.reduce(BigDecimal('0')){|total, work| total += work.hours}
91
- totals_per_work_account[work_account.id][0] << invoice_day_total
92
- totals_per_work_account[work_account.id][1] << internal_day_total
86
+ totals_per_backlog[backlog.id][0] << invoice_day_total
87
+ totals_per_backlog[backlog.id][1] << internal_day_total
93
88
  end
94
89
  end
95
- totals_per_work_account.reject! do |work_account_id, day_totals|
90
+ totals_per_backlog.reject! do |backlog_id, day_totals|
96
91
  !day_totals[0].find{|day_total| day_total > 0} && !day_totals[1].find{|day_total| day_total > 0}
97
92
  end
98
- totals_per_work_account
93
+ totals_per_backlog
99
94
  end
100
95
 
101
96
  def self.find_work_for_day(date, user = current_user)
@@ -1,18 +1,18 @@
1
1
  class WorksReportFilter < ReportFilter
2
- attr_reader :work_account_id
2
+ attr_reader :backlog_id
3
3
  attr_reader :invoice
4
4
  attr_reader :user_id
5
5
 
6
6
  def initialize(attributes)
7
- @work_account_id = nil
7
+ @backlog_id = nil
8
8
  @invoice = nil
9
9
  @user_id = nil
10
10
 
11
11
  if attributes
12
12
  attributes = attributes.clone
13
13
 
14
- work_account_id_param = attributes.delete(:work_account_id)
15
- @work_account_id = work_account_id_param.to_i if work_account_id_param && work_account_id_param.size > 0
14
+ backlog_id_param = attributes.delete(:backlog_id)
15
+ @backlog_id = backlog_id_param.to_i if backlog_id_param && backlog_id_param.size > 0
16
16
 
17
17
  invoice_param = attributes.delete(:invoice)
18
18
  @invoice = invoice_param == 'true' if invoice_param && invoice_param.size > 0
@@ -1,4 +1,4 @@
1
1
  <%=image_link_to 'arrow_up.png', l(:backlogs), :action => :list %>
2
2
  <%=image_detour_to('clipboard.png', l(:edit), :controller => 'backlogs', :action => :edit, :id => @backlog) unless controller.action_name == 'edit' %>
3
- <%=image_detour_to('hammer.png', l(:work), :controller => 'backlogs', :action => :works, :id => @backlog) %>
3
+ <%=image_detour_to('hammer.png', l(:work), :controller => 'works', :action => :list, :report_filter => {:backlog_id => @backlog.id}) %>
4
4
  <%=detour_to(image_tag(url_for("add.png"), :alt => l(:add_task), :title => l(:add_task), :class => 'image-submit'), :controller => 'tasks', :action => 'new', :task => {:backlog_id => @backlog.id} ) %>
@@ -6,6 +6,11 @@
6
6
 
7
7
  <h3>Options</h3>
8
8
 
9
+ <p>
10
+ <%= check_box 'backlog', 'track_times' %>
11
+ <label for="backlog_track_times"><%=l :track_times%></label>
12
+ </p>
13
+
9
14
  <p>
10
15
  <%= check_box 'backlog', 'track_todo' %>
11
16
  <label for="backlog_track_todo"><%=l :track_todo%></label>
@@ -31,15 +36,6 @@
31
36
  <label for="backlog_enable_users"><%=l :enable_users%></label>
32
37
  </p>
33
38
 
34
- <p>
35
- <label for="backlog_work_account"><%=l :work_account%></label><br/>
36
- <%=select 'backlog', 'work_account_id', [['', '']] + @work_accounts.map {|wa| [wa.name, wa.id]}.sort %>
37
- <% if @backlog.work_account %>
38
- <%=image_detour_to('work_account.png', "#{l(:work_account)} #{@backlog.work_account.name}", {:controller => 'work_accounts', :action => :edit, :id => @backlog.work_account}, {:class => 'image-submit', :style => 'vertical-align: bottom'}) %>
39
- <% end %>
40
- <%=detour_to l(:new_work_account), :controller => 'work_accounts', :action => :new %>
41
- </p>
42
-
43
39
  <!--[eoform:task]-->
44
40
 
45
41
 
@@ -6,7 +6,6 @@
6
6
 
7
7
  <% if user? %>
8
8
  | <%= link_to l(:backlogs), :controller => 'backlogs', :action => :list %>
9
- | <%= link_to l(:work_accounts), :controller => 'work_accounts', :action => :list %>
10
9
  | <%= link_to l(:log_out), :controller => 'user', :action => :logout %>
11
10
  <% else %>
12
11
  | <%= detour_to l(:log_in), :controller => 'user', :action => :login %>
@@ -7,7 +7,7 @@
7
7
  <%= select 'period', 'party_id', (@period.party ? [] : [['', '']]) + @parties.map{|party| [party.name, party.id]}, {}, :onchange => "form.action = '#{url_for :action => :new}'; form.submit();" %>
8
8
  <% else %>
9
9
  <label for="period_party_id"><%=l @period.party.class.name.downcase.to_s%></label>:
10
- <%= hidden_field 'period', 'party_id' %><%=detour_to h(@period.party.name), :controller => @period.party.type.name.downcase.pluralize, :action => :edit, :id => @period.party%>
10
+ <%= hidden_field 'period', 'party_id' %><%=detour_to h(@period.party.name), :controller => @period.party.type.to_s.downcase.pluralize, :action => :edit, :id => @period.party%>
11
11
  <% end %>
12
12
  <% if @period.party %>
13
13
  <%=image_detour_to(@period.party.icon, "#{l(@period.party.to_sym)} #{@period.party.name}", :controller => @period.party.controller, :action => :edit, :id => @period.party) %>
@@ -1,4 +1,4 @@
1
- <% @page_title = l(:search_results_for, @search) %>
1
+ <% @page_title = l(:search_results_for, :query => @search) %>
2
2
 
3
3
  <div id="lfeature">
4
4
  <div class="btitle">
@@ -11,17 +11,6 @@
11
11
  </ul>
12
12
  </div>
13
13
 
14
- <div id="rfeature">
15
- <div class="btitle">
16
- <h4><%=l(:work_accounts) %></h4>
17
- </div>
18
- <ul>
19
- <% @work_accounts.each do |work_account| %>
20
- <li><%=link_to work_account.name, :controller => 'work_accounts', :action => :edit, :id => work_account%></li>
21
- <% end %>
22
- </ul>
23
- </div>
24
-
25
14
  <div id="lfeature">
26
15
  <div class="btitle">
27
16
  <h4><%=l(:tasks) %></h4>
@@ -1,26 +1,25 @@
1
- <% @task = task %>
2
- <li id="task_<%=@task.id%>"<%=' class="tasks" onmouseover="this.style.border=\'1px solid black\'" onmouseout="this.style.border=\'1px solid transparent\'"' if active && (@task.period.nil? || @task.period.active_or_future?) && (not @task.work_started?) %><%=' class="highlight"' if highlight_task %><%=' style="display: none"' if hidden %>>
1
+ <li id="task_<%=task.id%>"<%=' class="tasks" onmouseover="this.style.border=\'1px solid black\'" onmouseout="this.style.border=\'1px solid transparent\'"' if active && (task.period.nil? || task.period.active_or_future?) && (not task.work_started?) %><%=' class="highlight"' if highlight_task %><%=' style="display: none"' if hidden %>>
3
2
  <div style="float: left" style="border: 0px">
4
- <% if @task.enable_subtasks? && active && (@task.period.nil? || @task.period.active_or_future?) %>
5
- <% form_tag({:controller => 'tasks', :action => :specify, :id => @task}) do %>
6
- <%=image_button_to('add.png', l(:specify), {:controller => 'tasks', :action => :specify, :id => @task.id},
7
- :style => "margin-left: #{@task.depth * 2}em") %>
3
+ <% if task.enable_subtasks? && active && (task.period.nil? || task.period.active_or_future?) %>
4
+ <% form_tag({:controller => 'tasks', :action => :specify, :id => task}) do %>
5
+ <%=image_button_to('add.png', l(:specify), {:controller => 'tasks', :action => :specify, :id => task.id},
6
+ :style => "margin-left: #{task.depth * 2}em") %>
8
7
  <% end %>
9
8
  <% else %>
10
9
  <%=image_tag 'blank.png', :class => 'image-submit', :style => "margin-left: 0em; padding: 0px" %>
11
10
  <% end %>
12
11
  </div>
13
12
  <div style="float: left" style="border: 3px solid red">
14
- <%=resolution_image(@task.resolution) if @task.finished_at %>
13
+ <%=resolution_image(task.resolution) if task.finished_at %>
15
14
  </div>
16
- <div id="task_<%=@task.id%>_id" class="task_id">
17
- <%=detour_to "##{@task.id}", :controller => 'tasks', :action => :edit, :id => @task.id, :style => 'border: 0px; margin: 0px; padding: 0px' if @task.position || @task.depth == 0 %>
15
+ <div id="task_<%=task.id%>_id" class="task_id">
16
+ <%=detour_to "##{task.id}", :controller => 'tasks', :action => :edit, :id => task.id, :style => 'border: 0px; margin: 0px; padding: 0px' if task.position || task.depth == 0 %>
18
17
  </div>
19
- <div id="task_<%=@task.id%>_description" class="task_description">
20
- <b><%=h(@task.description)%></b>
18
+ <div id="task_<%=task.id%>_description" class="task_description">
19
+ <b><%=h(task.description)%></b>
21
20
  <% if show_backlog %>
22
21
  <br/>
23
- <%=l :backlog%>: <%=detour_to(h(@task.backlog.name), :controller => 'backlogs', :action => :show, :id => @task.backlog) %>
22
+ <%=l :backlog%>: <%=detour_to(h(task.backlog.name), :controller => 'backlogs', :action => :show, :id => task.backlog) %>
24
23
  <% end %>
25
24
  </div>
26
25
 
@@ -28,15 +27,15 @@
28
27
 
29
28
  <div style="float: right" style="border: 1px solid black">
30
29
  <div class="task_start">
31
- <% if active && @task.loggable? -%>
32
- <% if @task.work_started? -%>
33
- <% remote_form_for(:work, :url => {:controller => 'works', :action => 'update_time', :id => @task.started_work}) do |f| %>
30
+ <% if active && task.loggable? -%>
31
+ <% if task.work_started? -%>
32
+ <% remote_form_for(:work, :url => {:controller => 'works', :action => 'update_time', :id => task.started_work}) do |f| %>
34
33
  <%=submit_tag('checkmark', :value => l(:save), :style => 'display: none')%>
35
- <%=f.text_field 'start_time', :id => "work_#{@task.started_work.id}_start_time", :tabindex => i+1, :value => (@task.started_work.start_time ? @task.started_work.start_time.strftime('%H:%M') : ''),
34
+ <%=f.text_field 'start_time', :id => "work_#{task.started_work.id}_start_time", :tabindex => i+1, :value => (task.started_work.start_time ? task.started_work.start_time.strftime('%H:%M') : ''),
36
35
  :class => :task_time, :maxlength => 5 %>
37
36
  <% end %>
38
- <% elsif @task.track_times? && (@task.period_id.nil? || @task.period.active?) %>
39
- <%=image_link_to_remote 'hammer.png', l(:start_work), with_detour({:controller => 'tasks', :action => :start_work, :id => @task.id}), nil, true %>
37
+ <% elsif task.track_times? && (task.period_id.nil? || task.period.active?) %>
38
+ <%=image_link_to_remote 'hammer.png', l(:start_work), {:url => with_detour({:controller => 'tasks', :action => :start_work, :id => task.id})}, nil, true %>
40
39
  <% else -%>
41
40
  &nbsp;
42
41
  <% end -%>
@@ -45,65 +44,65 @@
45
44
  <% end -%>
46
45
  </div>
47
46
  <div class="task_end_work">
48
- <% if active && @task.loggable? && @task.work_started? -%>
49
- <% form_tag({:controller => 'works', :action => 'update', :id => @task.started_work}) do %>
50
- <%= image_detour_to('ernes_stop.png', l(:end_work), {:controller => 'tasks', :action => :end_work, :id => @task.id}, nil, true) %>
47
+ <% if active && task.loggable? && task.work_started? -%>
48
+ <% form_tag({:controller => 'works', :action => 'update', :id => task.started_work}) do %>
49
+ <%= image_detour_to('ernes_stop.png', l(:end_work), {:controller => 'tasks', :action => :end_work, :id => task.id}, nil, true) %>
51
50
  <% end -%>
52
51
  <% else %>
53
52
  &nbsp;
54
53
  <% end -%>
55
54
  </div>
56
- <div class="task_done" align="<%=active && @task.loggable? && @task.track_done? ? 'left' : 'right'%>">
57
- <% if @task.track_done? || @task.total_done != 0 %>
58
- <% if @task.loggable? || @task.finished_at -%>
59
- <% unless !@task.track_done? || @task.track_times? || @task.work_started? || @task.finished_at -%>
60
- <% form_tag({:controller => 'works', :action => (@task.work_started? ? :edit : :create), :id => @task.started_work}) do %>
61
- <%=hidden_field('work', 'task_id', :value => @task.id)%>
55
+ <div class="task_done" align="<%=active && task.loggable? && task.track_done? ? 'left' : 'right'%>">
56
+ <% if task.track_done? || task.total_done != 0 %>
57
+ <% if task.loggable? || task.finished_at -%>
58
+ <% unless !task.track_done? || task.track_times? || task.work_started? || task.finished_at -%>
59
+ <% form_tag({:controller => 'works', :action => (task.work_started? ? :edit : :create), :id => task.started_work}) do %>
60
+ <%=hidden_field('work', 'task_id', :value => task.id)%>
62
61
  <%=submit_tag('checkmark', :value => l(:save), :style => 'display: none')%>
63
- <%=text_field 'work', 'hours', :tabindex => i+1, :id => "#{@task.id}_done",
62
+ <%=text_field 'work', 'hours', :tabindex => i+1, :id => "#{task.id}_done",
64
63
  :class => :task_hours, :maxlength => 4,
65
64
  :ondblclick => "form.elements[1].style.display = 'inline';this.style.display = 'none'" -%>
66
65
  <% end -%>
67
66
  <% end -%>
68
- <%=t @task.total_done if @task.total_done != 0%>
67
+ <%=t task.total_done if task.total_done != 0%>
69
68
  <% end -%>
70
69
  <% end -%>
71
70
  </div>
72
71
  <div class="task_todo">
73
- <% if active && @task.loggable? -%>
74
- <% if @task.track_todo? -%>
75
- <% if @task.period.nil? || @task.period.active_or_future? -%>
76
- <% remote_form_for(:estimate, :url => {:action => :update_task_estimate, :id => @task}) do |f| -%>
77
- <%=f.text_field :todo, :tabindex => i+2, :id => "task_#{@task.id}_todo", :value => @task.todo, :class => :task_hours, :maxlength => 4 %>
72
+ <% if active && task.loggable? -%>
73
+ <% if task.track_todo? -%>
74
+ <% if task.period.nil? || task.period.active_or_future? -%>
75
+ <% remote_form_for(:estimate, :url => {:action => :update_task_estimate, :id => task}) do |f| -%>
76
+ <%=f.text_field :todo, :tabindex => i+2, :id => "task_#{task.id}_todo", :value => task.todo, :class => :task_hours, :maxlength => 4 %>
78
77
  <% end -%>
79
78
  <% else -%>
80
- <%=@task.todo %>
79
+ <%=task.todo %>
81
80
  <% end -%>
82
81
  <% else %>
83
- <% if !@task.work_started? && (@task.period.nil? || @task.period.active?) %>
84
- <%=image_link_to_remote('checkmark.png', l(:complete), {:action => :finish_task, :id => @task}, nil, true)%>
82
+ <% if !task.work_started? && (task.period.nil? || task.period.active?) %>
83
+ <%=image_link_to_remote('checkmark.png', l(:complete), {:url => {:action => :finish_task, :id => task}}, nil, true)%>
85
84
  <% end -%>
86
85
  <% end -%>
87
86
  <% end -%>
88
87
  </div>
89
88
  <div class="task_buttons">
90
- <% if @task.active? -%>
91
- <% if @task.loggable? -%>
92
- <% unless @task.work_started? -%>
93
- <% if @task.backlog.enable_users? %>
94
- <% if @task.users.include?(current_user) %>
95
- <%=image_link_to_remote('grab.png', l(:release_task), with_detour({:controller => 'tasks', :action => :release, :id => @task}), nil, true)%>
89
+ <% if task.active? -%>
90
+ <% if task.loggable? -%>
91
+ <% unless task.work_started? -%>
92
+ <% if task.backlog.enable_users? %>
93
+ <% if task.users.include?(current_user) %>
94
+ <%=image_link_to_remote('grab.png', l(:release_task), {:url => with_detour({:controller => 'tasks', :action => :release, :id => task})}, nil, true)%>
96
95
  <% else %>
97
- <%=image_link_to_remote('grab_gray.png', "#{l:grab_task} #{" (#{l :not_grabbed})" if @task.users.empty?}", with_detour({:controller => 'tasks', :action => :grab, :id => @task}), nil, true)%>
96
+ <%=image_link_to_remote('grab_gray.png', "#{l:grab_task} #{" (#{l :not_grabbed})" if task.users.empty?}", {:url => with_detour({:controller => 'tasks', :action => :grab, :id => task})}, nil, true)%>
98
97
  <% end %>
99
98
  <% end %>
100
- <%=image_link_to_remote('arrow_right.png', l(:move_to_next_period), {:action => :move_task_to_next_period, :id => @task}, nil, true) if @task.backlog.enable_periods? || @task.period_id%>
101
- <%=image_link_to_remote('ernes_stop.png', l(:abort), {:action => :abort_task, :id => @task}, nil, true)%>
99
+ <%=image_link_to_remote('arrow_right.png', l(:move_to_next_period), {:url => {:action => :move_task_to_next_period, :id => task}}, nil, true) if task.backlog.enable_periods? || task.period_id%>
100
+ <%=image_link_to_remote('ernes_stop.png', l(:abort), {:url => {:action => :abort_task, :id => task}}, nil, true)%>
102
101
  <% end -%>
103
102
  <% end -%>
104
- <% elsif (@task.period.nil? || (not @task.period.passed?)) && @task.leaf? -%>
105
- <% form_tag({:controller => 'tasks', :action => 'update', :id => @task}) do -%>
106
- <%=image_link_to_remote('eraser.png', l(:reopen), {:action => :reopen_task, :id => @task}, nil, true) %>
103
+ <% elsif (task.period.nil? || (not task.period.passed?)) && task.leaf? -%>
104
+ <% form_tag({:controller => 'tasks', :action => 'update', :id => task}) do -%>
105
+ <%=image_link_to_remote('eraser.png', l(:reopen), {:url => {:action => :reopen_task, :id => task}}, nil, true) %>
107
106
  <% end -%>
108
107
  <% end -%>
109
108
  </div>
@@ -112,6 +111,6 @@
112
111
  </li>
113
112
 
114
113
  <% for subtask in task.children %>
115
- <%=render :partial => '/tasks/task', :locals => { :task => subtask, :i => i, :active => active, :highlight_task => subtask == @selected_task, :update => update } if (active && subtask.active?) || (!active && subtask.completed?) %>
114
+ <%=render :partial => '/tasks/task', :locals => { :task => subtask, :i => i, :active => active, :hidden => false, :show_backlog => false, :highlight_task => subtask == @selected_task, :update => update } if (active && subtask.active?) || (!active && subtask.completed?) %>
116
115
  <% i += 1 %>
117
116
  <% end %>