backlog 0.35.5 → 0.36.2

Sign up to get free protection for your applications and to get access to all the features.
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
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "~> 2.3.8"
4
+ gem 'slave'
5
+ gem 'mechanize'
6
+ gem 'hpricot'
7
+ gem 'simple_workflow'
8
+
9
+ if RUBY_PLATFORM =~ /java/
10
+ gem 'jruby-openssl'
11
+ gem 'activerecord-jdbc-adapter'
12
+ gem 'activerecord-jdbcpostgresql-adapter'
13
+ else
14
+ gem 'pg'
15
+ end
16
+
17
+ group :deployment do
18
+ gem 'hoe'
19
+ end
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+ gem "nokogiri"
3
+ gem "rack", "~>1.1"
4
+ gem "rspec", :require => "spec"
@@ -1,8 +1,33 @@
1
+ == 0.36.2 2010-07-26
2
+
3
+ === Fixes
4
+
5
+ * Renamed ActionMailer template files to standard localization variants.
6
+ * Fixed ajax link to calculate hours in work form
7
+
8
+ == 0.36.1 2010-07-22
9
+
10
+ === Features
11
+
12
+ * Widened layout a bit.
13
+
14
+ == Internal
15
+
16
+ * Removed some deprecation warnings
17
+
18
+ == 0.36.0 2010-07-21
19
+
20
+ === Features
21
+
22
+ * Merged Work Account into Backlog for simpler setup and maintenance.
23
+ * Upgraded to Rails 2.3.8
24
+
1
25
  == 0.35.5 2009-02-09
2
26
 
3
27
  === Fixes
4
28
 
5
29
  * Fixed file upload for task
30
+ * Changed Excel export date format to work woth Excel.
6
31
 
7
32
  == 0.35.4 2009-01-26
8
33
 
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ Hoe.new("backlog", APP::VERSION) do |p|
24
24
  p.email = 'uwe@kubosch.no'
25
25
  p.remote_rdoc_dir = '' # Release to root
26
26
  p.changes = File.read('History.txt').scan(/^== .*?(?=^== )/m).first
27
- p.rdoc_pattern = /^(app\/(controllers|helpers|models)|lib|bin)|txt$/
27
+ # p.extra_rdoc_files = [/^(app\/(controllers|helpers|models)|lib|bin)|txt$/]
28
28
  p.clean_globs = ['doc', 'log/*']
29
29
  p.spec_extras = {
30
30
  :files => Dir['**/*'].reject{|file_name| file_name =~ /^(doc|log|pkg|tmp|WEB-INF)/},
@@ -34,8 +34,8 @@ Hoe.new("backlog", APP::VERSION) do |p|
34
34
  }
35
35
  p.need_zip = true
36
36
  p.url = 'http://rubyforge.org/projects/backlog/'
37
- p.extra_deps = [['rails', '= 1.2.4'], ['gruff', '~> 0.2.9'], ['postgres', '~> 0.7.9'],
38
- ['slave', '~> 1.2.1'], ['mechanize', '~> 0.8.4']]
37
+ p.extra_deps = [['rails', '= 2.3.8'], ['gruff', '~> 0.2.9'], ['postgres', '~> 0.7.9'],
38
+ ['slave', '~> 1.2.1'], ['mechanize', '~> 0.8.4'], ['bundler', '~> 0.9.26']]
39
39
  # ['rmagick', '~> 1.15.12'],
40
40
  p.rsync_args = "-acv --delete --exclude=wiki*"
41
41
  end
@@ -1,5 +1,4 @@
1
1
  class ApplicationController < ActionController::Base
2
- include Localization
3
2
  include UserSystem
4
3
  include ApplicationHelper
5
4
  include ActionView::Helpers::TagHelper
@@ -36,7 +35,7 @@ class ApplicationController < ActionController::Base
36
35
  private
37
36
 
38
37
  def determine_layout
39
- if request.accepts.find {|mt| mt == 'xml'}
38
+ if false && request.accepts.find {|mt| mt == 'xml'}
40
39
  'wap'
41
40
  else
42
41
  # Firefox
@@ -44,7 +44,6 @@ class BacklogsController < ApplicationController
44
44
 
45
45
  def new
46
46
  @backlog = Backlog.new
47
- @work_accounts = WorkAccount.find(:all)
48
47
  end
49
48
 
50
49
  def create
@@ -59,7 +58,6 @@ class BacklogsController < ApplicationController
59
58
 
60
59
  def edit
61
60
  @backlog = Backlog.find(params[:id])
62
- @work_accounts = WorkAccount.find(:all)
63
61
  end
64
62
 
65
63
  def edit_no_layout
@@ -174,20 +172,6 @@ class BacklogsController < ApplicationController
174
172
  render :text => 'alert("Updated sort order");'
175
173
  end
176
174
 
177
- def works
178
- backlog = Backlog.find(params[:id])
179
- @report_filter = WorksReportFilter.new(params[:report_filter])
180
- @report_filter.title = "#{l :hours} for #{backlog.name} #{@report_filter.start_on && @report_filter.start_on.strftime('%Y-%m-%d - ')}#{@report_filter.end_on && @report_filter.end_on.strftime('%Y-%m-%d')}"
181
- @works = Work.paginate :conditions => ["completed_at BETWEEN ? AND ? AND task_id IN (SELECT id FROM tasks t where t.backlog_id = ?)", @report_filter.start_on, @report_filter.end_on, backlog.id], :page => params[:page], :per_page => @report_filter.page_size
182
- @work_accounts = WorkAccount.find(:all)
183
- @users = User.find(:all)
184
- if params[:export] == 'excel'
185
- render :template => '/works/list_excel', :layout => false
186
- else
187
- render :template => '/works/list'
188
- end
189
- end
190
-
191
175
  private
192
176
 
193
177
  def load_tasks(backlog)
@@ -5,12 +5,10 @@ class SearchController < ApplicationController
5
5
  @search = params[:q]
6
6
  @backlogs = Backlog.find(:all, :conditions => ["lower(name) LIKE ?", "%#{@search.downcase}%"])
7
7
  @tasks = Task.find(:all, :conditions => ["lower(description) LIKE ? OR lower(notes) LIKE ?", "%#{@search.downcase}%", "%#{@search.downcase}%"])
8
- @work_accounts = WorkAccount.find(:all, :conditions => ["lower(name) LIKE ?", "%#{@search.downcase}%"])
9
8
  @works = Work.find(:all, :conditions => ["lower(description) LIKE ? OR lower(notes) LIKE ?", "%#{@search.downcase}%", "%#{@search.downcase}%"])
10
9
  else
11
10
  @backlogs = []
12
11
  @tasks = []
13
- @work_accounts = []
14
12
  @works = []
15
13
  end
16
14
  end
@@ -37,7 +37,7 @@ class UserController < ApplicationController
37
37
  redirect_to :action => 'login'
38
38
  end
39
39
  end
40
- rescue Exception => ex
40
+ rescue Exception => ex
41
41
  report_exception ex
42
42
  flash[:notice] = 'Error creating account: confirmation email not sent'
43
43
  end
@@ -55,14 +55,14 @@ class UserController < ApplicationController
55
55
  begin
56
56
  @user.change_password(params['user']['password'], params['user']['password_confirmation'])
57
57
  @user.save!
58
- rescue Exception => ex
58
+ rescue Exception => ex
59
59
  report_exception ex
60
60
  flash.now[:notice] = 'Your password could not be changed at this time. Please retry.'
61
61
  render and return
62
62
  end
63
63
  begin
64
64
  UserNotify.deliver_change_password(@user, params['user']['password'])
65
- rescue Exception => ex
65
+ rescue Exception => ex
66
66
  report_exception ex
67
67
  end
68
68
 
@@ -95,7 +95,7 @@ class UserController < ApplicationController
95
95
  end
96
96
  redirect_back_or_default :action => 'welcome'
97
97
  end
98
- rescue Exception => ex
98
+ rescue Exception => ex
99
99
  report_exception ex
100
100
  flash.now[:notice] = "Your password could not be emailed to #{CGI.escapeHTML(params['user']['email'])}"
101
101
  end
@@ -120,7 +120,7 @@ class UserController < ApplicationController
120
120
  else
121
121
  raise "unknown edit action"
122
122
  end
123
- rescue Exception => ex
123
+ rescue Exception => ex
124
124
  logger.warn ex
125
125
  logger.warn ex.backtrace
126
126
  end
@@ -132,7 +132,7 @@ class UserController < ApplicationController
132
132
  begin
133
133
  @user.update_attribute( :deleted, true )
134
134
  logout
135
- rescue Exception => ex
135
+ rescue Exception => ex
136
136
  flash.now[:notice] = "Error: #{ex}."
137
137
  redirect_back_or_default :action => 'welcome'
138
138
  end
@@ -153,7 +153,7 @@ class UserController < ApplicationController
153
153
  end
154
154
  @users = User.find(:all)
155
155
  end
156
-
156
+
157
157
  def toggle_work_lock_monitoring
158
158
  @user = User.find(params[:id])
159
159
  @subscriber = params[:subscriber_id] ? User.find(params[:subscriber_id]) : current_user
@@ -57,9 +57,9 @@ class WorkLocksController < ApplicationController
57
57
  @lock = WorkLock.find(:first, :conditions => ['user_id = ? AND start_on <= ? AND end_on >= ?', current_user.id, first_date, last_date])
58
58
  raise "Already locked" if @lock
59
59
  WorkLock.create! :user_id => current_user.id, :start_on => first_date, :end_on => last_date
60
- work_account_subscribers = Work.works_for_week(@year, @week).flatten.compact.map {|w| w.work_account}.uniq.map {|wa| wa.work_lock_subscribers}.flatten.uniq
60
+ backlog_subscribers = Work.works_for_week(@year, @week).flatten.compact.map {|w| w.backlog}.uniq.map {|wa| wa.work_lock_subscribers}.flatten.uniq
61
61
  user_subscribers = current_user.work_lock_subscribers
62
- notify_users = (work_account_subscribers + user_subscribers).uniq
62
+ notify_users = (backlog_subscribers + user_subscribers).uniq
63
63
  notify_users.each do |user|
64
64
  week_url = url_for :controller => 'works', :action => :weekly_work_sheet, :year => @year, :week => @week, :user_id => current_user.id
65
65
  spreadsheet_url = url_for :controller => 'works', :action => :timeliste, :year => @year, :week => @week, :user_id => current_user.id
@@ -14,14 +14,14 @@ class WorksController < ApplicationController
14
14
  :redirect_to => { :action => :list }
15
15
 
16
16
  def list
17
- work_account_name = (params[:work_account_id] && WorkAccount.find(params[:work_account_id]).name) || l(:all_accounts)
17
+ backlog_name = (params[:backlog_id] && Backlog.find(params[:backlog_id]).name) || l(:all_accounts)
18
18
  @report_filter = WorksReportFilter.new(params[:report_filter])
19
- @report_filter.title = "#{l :hours} for #{work_account_name} #{@report_filter.start_on && @report_filter.start_on.strftime('%Y-%m-%d - ')}#{@report_filter.end_on && @report_filter.end_on.strftime('%Y-%m-%d')}"
19
+ @report_filter.title = "#{l :hours} for #{backlog_name} #{@report_filter.start_on && @report_filter.start_on.strftime('%Y-%m-%d - ')}#{@report_filter.end_on && @report_filter.end_on.strftime('%Y-%m-%d')}"
20
20
  @period = params[:id] && Period.find(params[:id])
21
- @works = Work.paginate :conditions => ["started_on BETWEEN ? AND ? #{'AND work_account_id = ?' if @report_filter.work_account_id} #{@report_filter.invoice.nil? ? '' : 'AND invoice = ?'} #{@report_filter.user_id.nil? ? '' : 'AND user_id = ?'}", @report_filter.start_on, @report_filter.end_on, @report_filter.work_account_id, @report_filter.invoice, @report_filter.user_id].compact,
21
+ @works = Work.paginate :conditions => ["started_on BETWEEN ? AND ? #{'AND backlog_id = ?' if @report_filter.backlog_id} #{@report_filter.invoice.nil? ? '' : 'AND invoice = ?'} #{@report_filter.user_id.nil? ? '' : 'AND user_id = ?'}", @report_filter.start_on, @report_filter.end_on, @report_filter.backlog_id, @report_filter.invoice, @report_filter.user_id].compact,
22
22
  :page => params[:page], :per_page => @report_filter.page_size,
23
23
  :order => 'started_on, start_time, completed_at'
24
- @work_accounts = WorkAccount.find(:all, :order => :name)
24
+ @backlogs = Backlog.find(:all, :order => :name)
25
25
  @users = User.find(:all, :order => 'first_name, last_name')
26
26
  if params[:export] == 'excel'
27
27
  @works = @works.sort_by {|w| [w.user_id || 0, w.task_id || 999999, w.started_on]}
@@ -41,7 +41,7 @@ class WorksController < ApplicationController
41
41
  @work.user = user
42
42
  end
43
43
  @estimate ||= Estimate.new(params[:estimate])
44
- @work_accounts = WorkAccount.find(:all, :order => :name)
44
+ @backlogs = Backlog.find(:all, :order => :name)
45
45
  @tasks = Task.find_open
46
46
  @users = User.find(:all)
47
47
  end
@@ -55,7 +55,7 @@ class WorksController < ApplicationController
55
55
  task = backlog.tasks_with_children.find{|t| t.description == task_description}
56
56
  params[:work][:task_id] = task.id if task
57
57
  end
58
- convert_work_account_param
58
+ convert_backlog_param
59
59
  convert_customer_param
60
60
  unless convert_hours_param
61
61
  flash[:notice] = "Illegal time format"
@@ -94,14 +94,14 @@ class WorksController < ApplicationController
94
94
  end
95
95
 
96
96
 
97
- def convert_work_account_param
98
- account_name = params[:work].delete :work_account_name
97
+ def convert_backlog_param
98
+ account_name = params[:work].delete :backlog_name
99
99
  if account_name && account_name.size > 0
100
- account = WorkAccount.find_by_name account_name
101
- params[:work][:work_account_id] = account.id
100
+ account = Backlog.find_by_name account_name
101
+ params[:work][:backlog_id] = account.id
102
102
  end
103
103
  end
104
- private :convert_work_account_param
104
+ private :convert_backlog_param
105
105
 
106
106
  def convert_customer_param
107
107
  customer_name = params[:work].delete :customer_name
@@ -119,7 +119,7 @@ class WorksController < ApplicationController
119
119
  @work ||= Work.find(params[:id])
120
120
  @work.attributes = params[:work]
121
121
  @estimate = Estimate.new(params[:estimate])
122
- @work_accounts = WorkAccount.find(:all)
122
+ @backlogs = Backlog.find(:all)
123
123
  @tasks = Task.find_open
124
124
  @tasks.unshift @work.task if @work.task
125
125
  @users = User.find(:all)
@@ -148,7 +148,7 @@ class WorksController < ApplicationController
148
148
  else
149
149
  @next_field = params[:field] || 'description'
150
150
  end
151
- @work_accounts = WorkAccount.find(:all, :order => :name)
151
+ @backlogs = Backlog.find(:all, :order => :name)
152
152
  @customers = Customer.find(:all, :order => :name)
153
153
  if flash[:work]
154
154
  @new_work = flash[:work]
@@ -219,7 +219,7 @@ class WorksController < ApplicationController
219
219
  @customers = Customer.find(:all, :order => :name)
220
220
  @started_works = Task.find_started
221
221
  @new_work = flash[:work] || Work.new(@works.last && @works.last.completed_at ? {:started_at => @works.last.completed_at} : nil)
222
- @work_accounts = WorkAccount.find(:all, :order => :name)
222
+ @backlogs = Backlog.find(:all, :order => :name)
223
223
  @absence = Absence.find(:first, :conditions => {:on => @date, :user_id => @user.id})
224
224
  @public_holiday = PublicHoliday.find(:first, :conditions => {:on => @date})
225
225
  render :layout => 'wide'
@@ -239,7 +239,7 @@ class WorksController < ApplicationController
239
239
  @year = (params[:year] && params[:year].to_i) || Date.today.year
240
240
  @week = (params[:week] && params[:week].to_i) || Date.today.cweek
241
241
  @user = params[:user_id] ? User.find(params[:user_id]) : current_user
242
- @work_accounts = Work.works_for_week_by_work_account(@year, @week, @user)
242
+ @backlogs = Work.works_for_week_by_backlog(@year, @week, @user)
243
243
  @first_date = Date.commercial(@year, @week, 1)
244
244
  @last_date = @first_date + 6
245
245
  @lock = WorkLock.find_by_week(@year, @week)
@@ -251,19 +251,19 @@ class WorksController < ApplicationController
251
251
  def timeliste
252
252
  @year = (params[:year] && params[:year].to_i) || Date.today.year
253
253
  @week = (params[:week] && params[:week].to_i) || Date.today.cweek
254
- @work_totals_per_work_account = Work.work_totals_for_week(@year, @week)
254
+ @work_totals_per_backlog = Work.work_totals_for_week(@year, @week)
255
255
  headers["Content-Type"] = "application/vnd.ms-excel"
256
256
  headers["Content-Disposition"] = 'attachment; filename="export.xml"'
257
257
  render :layout => false
258
258
  end
259
259
 
260
- def auto_complete_for_work_work_account_name
261
- @accounts = WorkAccount.find(:all,
260
+ def auto_complete_for_work_backlog_name
261
+ @accounts = Backlog.find(:all,
262
262
  :conditions => [ 'LOWER(name) LIKE ?',
263
- '%' + params[:work][:work_account_name].downcase + '%' ],
263
+ '%' + params[:work][:backlog_name].downcase + '%' ],
264
264
  :order => 'name ASC',
265
265
  :limit => 16)
266
- render :partial => '/work_accounts/name_list'
266
+ render :partial => '/backlogs/name_list'
267
267
  end
268
268
 
269
269
  def auto_complete_for_work_customer_name
@@ -307,14 +307,14 @@ class WorksController < ApplicationController
307
307
  def auto_complete_for_work_description
308
308
  max = 16
309
309
  works = Work.find(:all, :select => "description, count(*) as freq",
310
- :conditions => [ 'LOWER(description) LIKE ? AND work_account_id = ?', '%' + params[:description].downcase + '%', params[:work_account_id] ],
310
+ :conditions => [ 'LOWER(description) LIKE ? AND backlog_id = ?', '%' + params[:description].downcase + '%', params[:backlog_id] ],
311
311
  :group => "description",
312
312
  :order => 'freq DESC, description ASC',
313
313
  :limit => max)
314
314
 
315
315
  if works.size < max
316
316
  works += Work.find(:all, :select => "description, count(*) as freq",
317
- :conditions => [ 'LOWER(description) LIKE ? AND work_account_id <> ?', '%' + params[:description].downcase + '%', params[:work_account_id] ],
317
+ :conditions => [ 'LOWER(description) LIKE ? AND backlog_id <> ?', '%' + params[:description].downcase + '%', params[:backlog_id] ],
318
318
  :group => "description",
319
319
  :order => 'freq DESC, description ASC',
320
320
  :limit => max - works.size)
@@ -341,7 +341,7 @@ class WorksController < ApplicationController
341
341
  def update_new_row
342
342
  @field = params[:field]
343
343
  @next_field = params[:next_field]
344
- convert_work_account_param
344
+ convert_backlog_param
345
345
  convert_customer_param
346
346
  raise "Unknown time format: #{params[:hours_time]}" unless convert_hours_param
347
347
  @work = Work.new(params[:work])
@@ -1,8 +1,6 @@
1
- require 'localization'
2
1
  require 'url_for_fix'
3
2
 
4
3
  module ApplicationHelper
5
- include Localization
6
4
  include UserSystem
7
5
  include UrlForFix
8
6
 
@@ -40,10 +38,10 @@ module ApplicationHelper
40
38
  link_to image_tag(image_source, image_options), url_options, post ? {:method => :post} : nil
41
39
  end
42
40
 
43
- def image_link_to_remote(image_source, title, url_options, image_options = nil, post = false)
41
+ def image_link_to_remote(image_source, title, link_options, image_options = nil, post = false)
44
42
  image_options ||= {:class => 'image-submit'}
45
43
  image_options.update :alt => title, :title => title
46
- link_to_remote image_tag(image_source, image_options), {:url => url_options}, post ? {:method => :post} : nil
44
+ link_to_remote image_tag(image_source, image_options), link_options, post ? {:method => :post} : nil
47
45
  end
48
46
 
49
47
  def detour?
@@ -58,7 +56,12 @@ module ApplicationHelper
58
56
  link_to(title, options) if options
59
57
  end
60
58
 
61
- def t(time_as_float)
59
+ def l(value, *args)
60
+ return t(value, *args) if value.is_a?(Symbol)
61
+ end
62
+
63
+ def t(time_as_float, *args)
64
+ return super if time_as_float.is_a?(Symbol)
62
65
  return '' unless time_as_float
63
66
  time_as_float = BigDecimal(time_as_float.to_s) unless time_as_float.is_a? BigDecimal
64
67
  "#{time_as_float.to_i}:#{'%02d' % (time_as_float.frac * 60).round}"
@@ -85,7 +88,7 @@ module ApplicationHelper
85
88
  else
86
89
  raise "Unknown resolution " + resolution
87
90
  end
88
- image_tag image_file, :title => l(@task.resolution.downcase)
91
+ image_tag image_file, :title => l(resolution.downcase)
89
92
  end
90
93
 
91
94
  def display_notice(page)
@@ -60,7 +60,7 @@ module BacklogsHelper
60
60
  page.insert_html :top, period_tag_id, render(:partial => "/tasks/period_header", :locals => {:period => @task.period})
61
61
  end
62
62
 
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 }))
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, :show_backlog => false }))
64
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
65
 
66
66
  page[:no_tasks_message].hide
@@ -21,7 +21,7 @@ module PeriodsHelper
21
21
  end
22
22
 
23
23
  def add_active_task(page)
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 }))
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, :show_backlog => false }))
25
25
 
26
26
  page[:no_tasks_message].hide
27
27
 
@@ -2,15 +2,18 @@ class Backlog < ActiveRecord::Base
2
2
  validates_presence_of :name
3
3
  validates_length_of :name, :allow_nil => false, :maximum => 64
4
4
  validates_uniqueness_of :name
5
- validates_inclusion_of :track_todo, :in => [true, false], :allow_nil => true, :message => ActiveRecord::Errors.default_error_messages[:blank]
6
- validates_inclusion_of :enable_subtasks, :in => [true, false], :allow_nil => false, :message => ActiveRecord::Errors.default_error_messages[:blank]
7
- validates_inclusion_of :enable_customer, :in => [true, false], :allow_nil => true, :message => ActiveRecord::Errors.default_error_messages[:blank]
8
- validates_inclusion_of :enable_users, :in => [true, false], :allow_nil => true, :message => ActiveRecord::Errors.default_error_messages[:blank]
5
+ validates_inclusion_of :track_todo, :in => [true, false], :allow_nil => true, :message => I18n.translate('activerecord.errors.messages')[:blank]
6
+ validates_inclusion_of :enable_subtasks, :in => [true, false], :allow_nil => false, :message => I18n.translate('activerecord.errors.messages')[:blank]
7
+ validates_inclusion_of :enable_customer, :in => [true, false], :allow_nil => true, :message => I18n.translate('activerecord.errors.messages')[:blank]
8
+ validates_inclusion_of :enable_users, :in => [true, false], :allow_nil => true, :message => I18n.translate('activerecord.errors.messages')[:blank]
9
9
 
10
- belongs_to :work_account
11
10
  belongs_to :customer
12
11
  has_many :tasks, :order => 'period_id, position', :dependent => :destroy
13
12
  has_many :unplanned_tasks, :class_name => 'Task', :conditions => 'period_id IS NULL', :order => 'position'
13
+ has_many :works, :dependent => :destroy
14
+ has_and_belongs_to_many :work_lock_subscribers, :class_name => 'User', :join_table => "work_lock_subscriptions", :foreign_key => "backlog_id", :association_foreign_key => 'subscriber_user_id'
15
+
16
+ validates_inclusion_of :track_times, :in => [true, false], :message => I18n.translate('activerecord.errors.messages')[:blank]
14
17
 
15
18
  def active_tasks
16
19
  tasks.find(:all, :conditions => "finished_at IS NULL", :order => "position")
@@ -32,15 +35,15 @@ class Backlog < ActiveRecord::Base
32
35
  end
33
36
 
34
37
  def enable_invoicing?
35
- work_account && work_account.enable_invoicing?
38
+ true
36
39
  end
37
-
40
+
38
41
  def track_done?
39
- not work_account.nil?
42
+ true
40
43
  end
41
44
 
42
- def track_times?
43
- work_account && work_account.track_times?
45
+ def total_hours
46
+ works.inject(BigDecimal('0')) {|total, work| total + work.hours}
44
47
  end
45
48
 
46
49
  end