backlog 0.36.2 → 0.37.1
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/Gemfile +16 -4
- data/Gemfile.lock +130 -0
- data/History.txt +17 -0
- data/README.txt +0 -2
- data/Rakefile +17 -7
- data/app/controllers/absences_controller.rb +1 -2
- data/app/controllers/application_controller.rb +13 -14
- data/app/controllers/application_controller.rb.rails2 +186 -0
- data/app/controllers/estimates_controller.rb +1 -1
- data/app/controllers/groups_controller.rb +3 -1
- data/app/controllers/periods_controller.rb +61 -50
- data/app/controllers/{backlogs_controller.rb → projects_controller.rb} +35 -35
- data/app/controllers/search_controller.rb +2 -2
- data/app/controllers/tasks_controller.rb +11 -11
- data/app/controllers/user_controller.rb +6 -4
- data/app/controllers/welcome_controller.rb +4 -4
- data/app/controllers/work_locks_controller.rb +2 -2
- data/app/controllers/works_controller.rb +31 -31
- data/app/helpers/application_helper.rb +2 -2
- data/app/helpers/application_helper.rb.rails2 +118 -0
- data/app/helpers/periods_helper.rb +3 -3
- data/app/helpers/{backlogs_helper.rb → projects_helper.rb} +5 -5
- data/app/helpers/user_helper.rb +2 -2
- data/app/{models → mailers}/user_notify.rb +1 -0
- data/app/models/absence.rb +2 -2
- data/{lib → app/models}/clock.rb +0 -0
- data/app/models/estimate.rb +2 -2
- data/app/models/party.rb +1 -2
- data/app/models/period.rb +17 -18
- data/app/models/{backlog.rb → project.rb} +2 -2
- data/app/models/sidebar.rb +2 -2
- data/app/models/task.rb +28 -28
- data/app/models/user.rb +5 -4
- data/app/models/work.rb +29 -23
- data/app/models/work_lock_nagger.rb +1 -1
- data/app/models/works_report_filter.rb +4 -4
- data/app/views/customers/_name_list.rhtml +1 -1
- data/app/views/layouts/_headers.rhtml +2 -1
- data/app/views/layouts/_left_top.rhtml +32 -29
- data/app/views/layouts/_shortcuts.rhtml +15 -9
- data/app/views/layouts/_shortcuts_js.rhtml +4 -4
- data/app/views/layouts/mwrt002.html.erb +44 -0
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_show_active.rhtml +3 -3
- data/app/views/periods/_title.rhtml +1 -1
- data/app/views/{backlogs → projects}/_buttons.rhtml +4 -4
- data/app/views/projects/_form.rhtml +44 -0
- data/app/views/projects/_name_list.rhtml +5 -0
- data/app/views/projects/edit.rhtml +14 -0
- data/app/views/{backlogs → projects}/finish_task.rjs +0 -0
- data/app/views/projects/list.rhtml +16 -0
- data/app/views/{backlogs → projects}/move_task_to_period.rjs +0 -0
- data/app/views/{backlogs → projects}/new.rhtml +1 -1
- data/app/views/{backlogs → projects}/reopen_task.rjs +0 -0
- data/app/views/{backlogs → projects}/show.rhtml +6 -6
- data/app/views/search/results.rhtml +3 -3
- data/app/views/tasks/_backlog_header.rhtml +4 -4
- data/app/views/tasks/_completed.rhtml +2 -2
- data/app/views/tasks/_form.rhtml +13 -13
- data/app/views/tasks/_task.rhtml +10 -10
- data/app/views/tasks/edit.rhtml +1 -1
- data/app/views/tasks/list.rhtml +3 -3
- data/app/views/tasks/list_started.rhtml +4 -4
- data/app/views/tasks/start_work.rjs +1 -1
- data/app/views/user/login.rhtml +1 -1
- data/app/views/user/signup.rhtml +1 -1
- data/app/views/user/welcome.rhtml +1 -1
- data/app/views/works/_description_list.rhtml +1 -1
- data/app/views/works/_form.rhtml +5 -5
- data/app/views/works/_new_row.rhtml +8 -8
- data/app/views/works/_row.rhtml +1 -1
- data/app/views/works/_task_id_list.rhtml +1 -1
- data/app/views/works/daily_work_sheet.rhtml +1 -1
- data/app/views/works/list.rhtml +5 -5
- data/app/views/works/list_excel.rhtml +2 -2
- data/app/views/works/timeliste.rhtml +14 -14
- data/app/views/works/weekly_work_sheet.rhtml +5 -5
- data/app/views/works/weekly_work_sheet_details.rhtml +5 -5
- data/backlog.gemspec +44 -0
- data/bin/backlog +5 -1
- data/config.ru +4 -0
- data/config/application.rb +10 -0
- data/config/boot.rb +12 -116
- data/config/database.yml +3 -6
- data/config/database.yml~ +17 -0
- data/config/environment.rb +28 -49
- data/config/environments/development.rb +24 -20
- data/config/environments/development.rb.rails2 +26 -0
- data/config/environments/production.rb +26 -22
- data/config/environments/test.rb +20 -15
- data/config/environments/user_environment.rb +1 -1
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/jdbc.rb +1 -1
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/locales/en.yml +22 -11
- data/config/locales/no.yml +1 -0
- data/config/routes.rb +4 -5
- data/cruise_build.sh +6 -2
- data/db/migrate/004_add_period.rb +22 -22
- data/db/migrate/015_add_user_option.rb +5 -19
- data/db/migrate/017_increase_backlog_name_limit.rb +10 -0
- data/db/migrate/021_create_work_accounts.rb +0 -2
- data/db/migrate/20101006092700_rename_backlogs_to_projects.rb +22 -0
- data/db/migrate/20101006092700_rename_backlogs_to_projects.rb~ +22 -0
- data/db/schema.rb +27 -30
- data/db/seeds.rb +7 -0
- data/lib/array_helper.rb +0 -8
- data/lib/class_table_inheritance.rb +8 -7
- data/lib/tasks/backup.rake +3 -3
- data/lib/tasks/jdbc.rake +2 -2
- data/lib/version_from_history.rb +1 -1
- data/public/404.html +23 -7
- data/public/422.html +26 -0
- data/public/500.html +23 -6
- data/public/images/rails.png +0 -0
- data/public/javascripts/controls.js +5 -3
- data/public/javascripts/dragdrop.js +7 -6
- data/public/javascripts/effects.js +8 -13
- data/public/javascripts/prototype.js +3381 -1700
- data/public/javascripts/rails.js +175 -0
- data/public/robots.txt +5 -1
- data/script/rails +6 -0
- data/test/client/login.rb +0 -2
- data/test/client/login_test.rb +1 -1
- data/test/client/setup.rb +25 -24
- data/test/fixtures/{backlogs.yml → projects.yml} +2 -2
- data/test/fixtures/tasks.yml +9 -9
- data/test/fixtures/work_lock_subscriptions.yml +2 -2
- data/test/fixtures/works.yml +7 -7
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/{backlogs_controller_test.rb → projects_controller_test.rb} +22 -21
- data/test/functional/search_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +17 -17
- data/test/functional/user_controller_test.rb +16 -21
- data/test/functional/welcome_controller_test.rb +4 -3
- data/test/functional/works_controller_test.rb +5 -5
- data/test/integration/user_system_test.rb +1 -1
- data/test/mocks/test/clock.rb +1 -1
- data/test/performance/browsing_test.rb +9 -0
- data/test/performance/common.rb +1 -1
- data/test/test_helper.rb +23 -6
- data/test/test_helper.rb~ +121 -0
- data/test/unit/user_test.rb +3 -3
- data/test/unit/work_test.rb +7 -7
- data/vendor/plugins/assert_cookie/lib/assert_cookie.rb +0 -2
- data/vendor/plugins/{foreign_key_migrations → dynamic_form}/MIT-LICENSE +1 -1
- data/vendor/plugins/dynamic_form/README +13 -0
- data/vendor/plugins/dynamic_form/Rakefile +10 -0
- data/vendor/plugins/dynamic_form/dynamic_form.gemspec +12 -0
- data/vendor/plugins/dynamic_form/init.rb +1 -0
- data/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
- data/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +8 -0
- data/vendor/plugins/dynamic_form/lib/dynamic_form.rb +5 -0
- data/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
- data/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
- data/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
- data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +432 -0
- data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
- data/vendor/plugins/rails_time/test/debug.log +1 -0
- data/vendor/plugins/{redhillonrails_core → verification}/MIT-LICENSE +1 -1
- data/vendor/plugins/verification/README +34 -0
- data/vendor/plugins/verification/Rakefile +22 -0
- data/vendor/plugins/verification/init.rb +3 -0
- data/vendor/plugins/verification/lib/action_controller/verification.rb +132 -0
- data/vendor/plugins/verification/test/test_helper.rb +18 -0
- data/vendor/plugins/verification/test/verification_test.rb +270 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +1 -1
- metadata +115 -134
- data/Gemfile~ +0 -4
- data/History.txt~ +0 -961
- data/LICENSE_LOCALIZATION +0 -20
- data/README_LOCALIZATION +0 -61
- data/README_RAILS +0 -180
- data/app/views/backlogs/_form.rhtml +0 -44
- data/app/views/backlogs/_name_list.rhtml +0 -5
- data/app/views/backlogs/edit.rhtml +0 -14
- data/app/views/backlogs/list.rhtml +0 -16
- data/app/views/layouts/mwrt002.rhtml +0 -43
- data/config/initializers/mongrel.rb +0 -83
- data/config/preinitializer.rb +0 -20
- data/config/warble.rb~ +0 -84
- data/db/migrate/017_insert_datek_projects.rb +0 -98
- data/lib/change_column_null_migration_fix.rb +0 -15
- data/no_test.rb~ +0 -6
- data/public/dispatch.cgi +0 -10
- data/public/dispatch.fcgi +0 -24
- data/public/dispatch.rb +0 -10
- data/script/about +0 -3
- data/script/breakpointer +0 -3
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/plugin +0 -3
- data/script/process/inspector +0 -3
- data/script/process/reaper +0 -3
- data/script/process/spawner +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/test/client/login.rb~ +0 -33
- data/test/mocks/test/user_notify.rb +0 -16
- data/vendor/plugins/foreign_key_migrations/CHANGELOG +0 -103
- data/vendor/plugins/foreign_key_migrations/README +0 -87
- data/vendor/plugins/foreign_key_migrations/about.yml +0 -5
- data/vendor/plugins/foreign_key_migrations/init.rb +0 -1
- data/vendor/plugins/foreign_key_migrations/install.rb +0 -1
- data/vendor/plugins/foreign_key_migrations/lib/foreign_key_migrations.rb +0 -3
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb +0 -22
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb +0 -22
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb +0 -28
- data/vendor/plugins/lightwindow_helper/README +0 -33
- data/vendor/plugins/lightwindow_helper/assets/images/ajax-loading.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/arrow-down.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/arrow-up.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/black-70.png +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/black.png +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/nextlabel.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/images/prevlabel.gif +0 -0
- data/vendor/plugins/lightwindow_helper/assets/javascripts/lightwindow.js +0 -1921
- data/vendor/plugins/lightwindow_helper/assets/stylesheets/lightwindow.css +0 -376
- data/vendor/plugins/lightwindow_helper/init.rb +0 -1
- data/vendor/plugins/lightwindow_helper/install.rb +0 -7
- data/vendor/plugins/lightwindow_helper/lib/lightwindow_helper.rb +0 -31
- data/vendor/plugins/redhillonrails_core/CHANGELOG +0 -150
- data/vendor/plugins/redhillonrails_core/README +0 -124
- data/vendor/plugins/redhillonrails_core/init.rb +0 -19
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +0 -54
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +0 -31
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +0 -21
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +0 -26
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +0 -11
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +0 -74
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +0 -8
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +0 -99
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +0 -16
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +0 -9
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +0 -27
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +0 -27
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +0 -47
- data/vendor/plugins/transactional_migrations/CHANGELOG +0 -9
- data/vendor/plugins/transactional_migrations/MIT-LICENSE +0 -20
- data/vendor/plugins/transactional_migrations/README +0 -15
- data/vendor/plugins/transactional_migrations/about.yml +0 -5
- data/vendor/plugins/transactional_migrations/init.rb +0 -1
- data/vendor/plugins/transactional_migrations/lib/red_hill_consulting/transactional_migrations/active_record/migration.rb +0 -19
|
@@ -2,7 +2,7 @@ class TasksController < ApplicationController
|
|
|
2
2
|
skip_before_filter :populate_layout, :except => [:edit, :grab, :list_started, :move_down, :move_to_bottom, :move_to_top, :move_up, :new, :specify]
|
|
3
3
|
|
|
4
4
|
verify :method => :post, :except => [ :invite, :new, :show, :edit, :grab, :list_started, :move_to_next_period, :notes],
|
|
5
|
-
|
|
5
|
+
:redirect_to => { :controller => 'projects' }
|
|
6
6
|
|
|
7
7
|
def list_started
|
|
8
8
|
@tasks = Task.find_started
|
|
@@ -14,8 +14,8 @@ class TasksController < ApplicationController
|
|
|
14
14
|
redirect_to params if request.post?
|
|
15
15
|
params[:task].delete :file if params[:task]
|
|
16
16
|
@task = Task.new params[:task]
|
|
17
|
-
@task.
|
|
18
|
-
@
|
|
17
|
+
@task.project_id ||= @task.period && @task.period.most_frequent_project
|
|
18
|
+
@projects = Project.find(:all, :order => 'name')
|
|
19
19
|
@periods = Period.find_active_or_future
|
|
20
20
|
@customers = Customer.find(:all)
|
|
21
21
|
end
|
|
@@ -39,11 +39,11 @@ class TasksController < ApplicationController
|
|
|
39
39
|
if @task.period
|
|
40
40
|
back_or_redirect_to :controller => 'periods', :action => 'show', :id => @task.period, :task => @task.id
|
|
41
41
|
else
|
|
42
|
-
back_or_redirect_to :controller => '
|
|
42
|
+
back_or_redirect_to :controller => 'projects', :action => :edit, :id => @task.project, :task => @task.id
|
|
43
43
|
end
|
|
44
44
|
else
|
|
45
45
|
populate_layout
|
|
46
|
-
@
|
|
46
|
+
@projects = Project.find(:all, :order => 'name')
|
|
47
47
|
@periods = Period.find_active_or_future
|
|
48
48
|
@customers = Customer.find(:all)
|
|
49
49
|
render :action => 'new'
|
|
@@ -52,15 +52,15 @@ class TasksController < ApplicationController
|
|
|
52
52
|
|
|
53
53
|
def edit
|
|
54
54
|
@task ||= Task.find(params[:id])
|
|
55
|
-
@task.
|
|
55
|
+
@task.project_id = params[:task][:project_id] if params[:task] && params[:task][:project_id]
|
|
56
56
|
@task.period_id = params[:task][:period_id] if params[:task] && params[:task][:period_id]
|
|
57
57
|
@periods = Period.find_active_or_future
|
|
58
|
-
@
|
|
58
|
+
@projects = Project.find(:all, :order => 'name')
|
|
59
59
|
@customers = Customer.find(:all)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def update
|
|
63
|
-
redirect_to(:controller => '
|
|
63
|
+
redirect_to(:controller => 'projects', :action => :index) unless params[:id]
|
|
64
64
|
if params[:task] && params[:task][:description] == ''
|
|
65
65
|
destroy
|
|
66
66
|
return
|
|
@@ -83,7 +83,7 @@ class TasksController < ApplicationController
|
|
|
83
83
|
if @task.period_id != nil
|
|
84
84
|
@task.remove_from_list
|
|
85
85
|
@task.period = nil
|
|
86
|
-
new_pos = @task.
|
|
86
|
+
new_pos = @task.project.tasks.count(:conditions => 'period_id IS NULL AND parent_id IS NULL') + 1
|
|
87
87
|
params[:task].delete(:period_id)
|
|
88
88
|
params[:task][:position] = new_pos
|
|
89
89
|
end
|
|
@@ -119,7 +119,7 @@ class TasksController < ApplicationController
|
|
|
119
119
|
if @task.period
|
|
120
120
|
back_or_redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task => @task.id
|
|
121
121
|
else
|
|
122
|
-
back_or_redirect_to :controller => '
|
|
122
|
+
back_or_redirect_to :controller => 'projects', :action => :show, :id => @task.project, :task => @task.id
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
end
|
|
@@ -178,7 +178,7 @@ class TasksController < ApplicationController
|
|
|
178
178
|
task.remove_from_list
|
|
179
179
|
task.position = nil
|
|
180
180
|
task.parent_id = target_task.parent_id
|
|
181
|
-
task.
|
|
181
|
+
task.project_id = target_task.project_id
|
|
182
182
|
task.period_id = target_task.period_id
|
|
183
183
|
end
|
|
184
184
|
task.insert_at target_task.position
|
|
@@ -32,9 +32,11 @@ class UserController < ApplicationController
|
|
|
32
32
|
key = @user.generate_security_token
|
|
33
33
|
url = url_for(:action => 'welcome')
|
|
34
34
|
url += "?user[id]=#{@user.id}&key=#{key}"
|
|
35
|
-
UserNotify.
|
|
35
|
+
UserNotify.signup(@user, params['user']['password'], url).deliver
|
|
36
36
|
flash[:notice] = 'Signup successful! Please check your registered email account to verify your account registration and continue with the login.'
|
|
37
37
|
redirect_to :action => 'login'
|
|
38
|
+
else
|
|
39
|
+
logger.error @user.extra_columns_for_users.errors.full_messages
|
|
38
40
|
end
|
|
39
41
|
end
|
|
40
42
|
rescue Exception => ex
|
|
@@ -197,7 +199,7 @@ class UserController < ApplicationController
|
|
|
197
199
|
# Generate a template user for certain actions on get
|
|
198
200
|
def generate_blank_form
|
|
199
201
|
case request.method
|
|
200
|
-
when
|
|
202
|
+
when 'GET'
|
|
201
203
|
@user = User.new
|
|
202
204
|
if cookie = cookies['autologin']
|
|
203
205
|
cookie_value = cookie[0]
|
|
@@ -226,7 +228,7 @@ class UserController < ApplicationController
|
|
|
226
228
|
@sick_days_with_doctors_leave = absences.select {|a| a.reason == 'SICK_WITH_DOCTOR'}
|
|
227
229
|
@sick_days_with_doctors_leave.map! {|a| a.on}
|
|
228
230
|
case request.method
|
|
229
|
-
when
|
|
231
|
+
when 'GET'
|
|
230
232
|
render
|
|
231
233
|
return true
|
|
232
234
|
end
|
|
@@ -242,7 +244,7 @@ class UserController < ApplicationController
|
|
|
242
244
|
|
|
243
245
|
def populate_layout
|
|
244
246
|
@sidebars = [
|
|
245
|
-
{ :id => 1, :title => "Welcome to
|
|
247
|
+
{ :id => 1, :title => "Welcome to Project", :content => '<p>Welcome to Project, a project support application targeted at collecting, planning, and completing tasks.</p><p>Project also offers history tracking and a graphical presentation of burn down charts.</p>' }
|
|
246
248
|
]
|
|
247
249
|
end
|
|
248
250
|
|
|
@@ -5,8 +5,8 @@ class WelcomeController < ApplicationController
|
|
|
5
5
|
redirect_to :controller => 'tasks', :action => :list_started
|
|
6
6
|
return
|
|
7
7
|
end
|
|
8
|
-
if
|
|
9
|
-
redirect_to :controller => '
|
|
8
|
+
if Project.count == 0
|
|
9
|
+
redirect_to :controller => 'projects', :action => :new
|
|
10
10
|
return
|
|
11
11
|
end
|
|
12
12
|
active_periods = Period.find(:all).select {|period| period.active?(true)}
|
|
@@ -22,8 +22,8 @@ class WelcomeController < ApplicationController
|
|
|
22
22
|
redirect_to :controller => 'periods', :action => :show, :id => most_urgent_period
|
|
23
23
|
return
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
redirect_to :controller => '
|
|
25
|
+
most_urgent_project = Project.find(:first, :order => :id)
|
|
26
|
+
redirect_to :controller => 'projects', :action => :show, :id => most_urgent_project.id
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
end
|
|
@@ -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
|
-
|
|
60
|
+
project_subscribers = Work.works_for_week(@year, @week).flatten.compact.map {|w| w.project}.uniq.map {|wa| wa.work_lock_subscribers}.flatten.uniq
|
|
61
61
|
user_subscribers = current_user.work_lock_subscribers
|
|
62
|
-
notify_users = (
|
|
62
|
+
notify_users = (project_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
|
-
|
|
17
|
+
project_name = (params[:project_id] && Project.find(params[:project_id]).name) || l(:all_accounts)
|
|
18
18
|
@report_filter = WorksReportFilter.new(params[:report_filter])
|
|
19
|
-
@report_filter.title = "#{l :hours} for #{
|
|
19
|
+
@report_filter.title = "#{l :hours} for #{project_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
|
|
21
|
+
@works = Work.paginate :conditions => ["started_on BETWEEN ? AND ? #{'AND project_id = ?' if @report_filter.project_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.project_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
|
-
@
|
|
24
|
+
@projects = Project.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,21 +41,21 @@ class WorksController < ApplicationController
|
|
|
41
41
|
@work.user = user
|
|
42
42
|
end
|
|
43
43
|
@estimate ||= Estimate.new(params[:estimate])
|
|
44
|
-
@
|
|
44
|
+
@projects = Project.find(:all, :order => :name)
|
|
45
45
|
@tasks = Task.find_open
|
|
46
46
|
@users = User.find(:all)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def create
|
|
50
50
|
if params[:work]
|
|
51
|
-
|
|
51
|
+
project_name = params[:work].delete(:project_name)
|
|
52
52
|
task_description = params[:work].delete(:task_description)
|
|
53
|
-
if
|
|
54
|
-
|
|
55
|
-
task =
|
|
53
|
+
if project_name && project_name.size > 0 && task_description && task_description.size > 0
|
|
54
|
+
project = Project.find_by_name(project_name)
|
|
55
|
+
task = project.tasks_with_children.find{|t| t.description == task_description}
|
|
56
56
|
params[:work][:task_id] = task.id if task
|
|
57
57
|
end
|
|
58
|
-
|
|
58
|
+
convert_project_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
|
|
98
|
-
account_name = params[:work].delete :
|
|
97
|
+
def convert_project_param
|
|
98
|
+
account_name = params[:work].delete :project_name
|
|
99
99
|
if account_name && account_name.size > 0
|
|
100
|
-
account =
|
|
101
|
-
params[:work][:
|
|
100
|
+
account = Project.find_by_name account_name
|
|
101
|
+
params[:work][:project_id] = account.id
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
|
-
private :
|
|
104
|
+
private :convert_project_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
|
-
@
|
|
122
|
+
@projects = Project.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
|
-
@
|
|
151
|
+
@projects = Project.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
|
-
@
|
|
222
|
+
@projects = Project.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
|
-
@
|
|
242
|
+
@projects = Work.works_for_week_by_project(@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
|
-
@
|
|
254
|
+
@work_totals_per_project = 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
|
|
261
|
-
@accounts =
|
|
260
|
+
def auto_complete_for_work_project_name
|
|
261
|
+
@accounts = Project.find(:all,
|
|
262
262
|
:conditions => [ 'LOWER(name) LIKE ?',
|
|
263
|
-
'%' + params[:work][:
|
|
263
|
+
'%' + params[:work][:project_name].downcase + '%' ],
|
|
264
264
|
:order => 'name ASC',
|
|
265
265
|
:limit => 16)
|
|
266
|
-
render :partial => '/
|
|
266
|
+
render :partial => '/projects/name_list'
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
def auto_complete_for_work_customer_name
|
|
@@ -275,13 +275,13 @@ class WorksController < ApplicationController
|
|
|
275
275
|
render :partial => '/customers/name_list'
|
|
276
276
|
end
|
|
277
277
|
|
|
278
|
-
def
|
|
279
|
-
@
|
|
278
|
+
def auto_complete_for_work_project_name
|
|
279
|
+
@projects = Project.find(:all,
|
|
280
280
|
:conditions => [ 'LOWER(name) LIKE ?',
|
|
281
|
-
'%' + params[:work][:
|
|
281
|
+
'%' + params[:work][:project_name].downcase + '%' ],
|
|
282
282
|
:order => 'name ASC',
|
|
283
283
|
:limit => 16)
|
|
284
|
-
render :partial => '/
|
|
284
|
+
render :partial => '/projects/name_list'
|
|
285
285
|
end
|
|
286
286
|
|
|
287
287
|
def auto_complete_for_work_task_id
|
|
@@ -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
|
|
310
|
+
:conditions => [ 'LOWER(description) LIKE ? AND project_id = ?', '%' + params[:description].downcase + '%', params[:project_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
|
|
317
|
+
:conditions => [ 'LOWER(description) LIKE ? AND project_id <> ?', '%' + params[:description].downcase + '%', params[:project_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
|
-
|
|
344
|
+
convert_project_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])
|
|
@@ -41,7 +41,7 @@ module ApplicationHelper
|
|
|
41
41
|
def image_link_to_remote(image_source, title, link_options, image_options = nil, post = false)
|
|
42
42
|
image_options ||= {:class => 'image-submit'}
|
|
43
43
|
image_options.update :alt => title, :title => title
|
|
44
|
-
link_to_remote image_tag(image_source, image_options), link_options, post ? {:method => :post} :
|
|
44
|
+
link_to_remote image_tag(image_source, image_options), :url => link_options, :html => post ? {:remote => true, :method => :post} : {:remote => true}
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def detour?
|
|
@@ -57,7 +57,7 @@ module ApplicationHelper
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def l(value, *args)
|
|
60
|
-
|
|
60
|
+
t(value, *args) if value.is_a?(Symbol)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def t(time_as_float, *args)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
require 'url_for_fix'
|
|
2
|
+
|
|
3
|
+
module ApplicationHelper
|
|
4
|
+
include UserSystem
|
|
5
|
+
include UrlForFix
|
|
6
|
+
|
|
7
|
+
def image_button_to(image_source, title, options, html_options = {})
|
|
8
|
+
image_submit_tag image_source, {:class => 'image-submit', :alt => title, :title => title,
|
|
9
|
+
:id => "#{title}_#{options[:id]}", :name => title,
|
|
10
|
+
:onclick => "form.action='#{url_for(options)}'"}.update(html_options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def detour_to(title, options, html_options = nil)
|
|
14
|
+
link_to title, with_detour(options), html_options
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def with_detour(options)
|
|
18
|
+
detour_options = {:detour => params.reject {|k, v| [:detour, :return_from_detour].include? k.to_sym}}.update(options)
|
|
19
|
+
if options[:layout]== false
|
|
20
|
+
if params[:action] !~ /_no_layout$/
|
|
21
|
+
detour_options[:detour].update({:action => params[:action] + '_no_layout'})
|
|
22
|
+
end
|
|
23
|
+
elsif params[:action] =~ /_no_layout$/
|
|
24
|
+
detour_options[:detour].update({:action => params[:action][0..-11]})
|
|
25
|
+
end
|
|
26
|
+
detour_options
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def image_detour_to(image_source, title, url_options, image_options = nil, post = false)
|
|
30
|
+
image_options ||= {:class => 'image-submit'}
|
|
31
|
+
image_options.update :alt => title, :title => title
|
|
32
|
+
detour_to image_tag(image_source, image_options), url_options, post ? {:method => :post} : nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def image_link_to(image_source, title, url_options, image_options = nil, post = false)
|
|
36
|
+
image_options ||= {:class => 'image-submit'}
|
|
37
|
+
image_options.update :alt => title, :title => title
|
|
38
|
+
link_to image_tag(image_source, image_options), url_options, post ? {:method => :post} : nil
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def image_link_to_remote(image_source, title, link_options, image_options = nil, post = false)
|
|
42
|
+
image_options ||= {:class => 'image-submit'}
|
|
43
|
+
image_options.update :alt => title, :title => title
|
|
44
|
+
link_to_remote image_tag(image_source, image_options), link_options, post ? {:method => :post} : nil
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def detour?
|
|
48
|
+
not session[:detours].nil?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def back_or_link_to(title, options = nil)
|
|
52
|
+
if session[:detours]
|
|
53
|
+
options = {:return_from_detour => true}.update(session[:detours].last)
|
|
54
|
+
logger.debug "linked return from detour: #{options}"
|
|
55
|
+
end
|
|
56
|
+
link_to(title, options) if options
|
|
57
|
+
end
|
|
58
|
+
|
|
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)
|
|
65
|
+
return '' unless time_as_float
|
|
66
|
+
time_as_float = BigDecimal(time_as_float.to_s) unless time_as_float.is_a? BigDecimal
|
|
67
|
+
"#{time_as_float.to_i}:#{'%02d' % (time_as_float.frac * 60).round}"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def h(object)
|
|
71
|
+
if object.is_a? Time
|
|
72
|
+
object.strftime '%Y-%m-%d %H:%M:%S'
|
|
73
|
+
else
|
|
74
|
+
super object
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def resolution_image(resolution)
|
|
79
|
+
image_file = case resolution
|
|
80
|
+
when Task::COMPLETED
|
|
81
|
+
'checkmark.png'
|
|
82
|
+
when Task::POSTPONED
|
|
83
|
+
'arrow_right.png'
|
|
84
|
+
when Task::MOVED
|
|
85
|
+
'arrow_right.png'
|
|
86
|
+
when Task::ABORTED
|
|
87
|
+
'ernes_stop.png'
|
|
88
|
+
else
|
|
89
|
+
raise "Unknown resolution " + resolution
|
|
90
|
+
end
|
|
91
|
+
image_tag image_file, :title => l(resolution.downcase)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def display_notice(page)
|
|
95
|
+
if flash[:notice]
|
|
96
|
+
page.replace_html :notice, flash[:notice]
|
|
97
|
+
page.visual_effect(:appear, :notice)
|
|
98
|
+
page.visual_effect(:highlight, :notice)
|
|
99
|
+
flash.discard
|
|
100
|
+
else
|
|
101
|
+
page.visual_effect(:fade, :notice)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def record(page, script)
|
|
106
|
+
page.call("#{script};//")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def insert(page, content, selector, position = :top)
|
|
110
|
+
escaped_content = content.gsub("\n", '').gsub("'", "\\\\'")
|
|
111
|
+
record(page, "new Insertion.#{position.to_s.capitalize}($$('#{selector}').first(), '#{escaped_content}')")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def update_task(page)
|
|
115
|
+
page["task_#{@task.id}"].replace render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => false })
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
end
|