summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-11 20:57:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-11 20:57:37 +0000
commitb950caa21e63b41ac61cc15750a9e146966ab9c6 (patch)
tree718e376aa6bf05ef1ee76eb35093e86424aec97c /app
parent3a0cd55622e53864a7e78e039b5d25c7208fe6a7 (diff)
downloadredmine-b950caa21e63b41ac61cc15750a9e146966ab9c6.tar.gz
redmine-b950caa21e63b41ac61cc15750a9e146966ab9c6.zip
Gantt chart:
* now starts at the current month by default * month count and zoom factor are automatically saved as user preferences git-svn-id: http://redmine.rubyforge.org/svn/trunk@829 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 5dba47a10..6e6659de7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -579,12 +579,20 @@ class ProjectsController < ApplicationController
@month_from = 1
end
else
- @month_from ||= (Date.today << 1).month
- @year_from ||= (Date.today << 1).year
+ @month_from ||= Date.today.month
+ @year_from ||= Date.today.year
end
- @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2
- @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6
+ zoom = (params[:zoom] || User.current.pref[:gantt_zoom]).to_i
+ @zoom = (zoom > 0 && zoom < 5) ? zoom : 2
+ months = (params[:months] || User.current.pref[:gantt_months]).to_i
+ @months = (months > 0 && months < 25) ? months : 6
+
+ # Save gantt paramters as user preference (zoom and months count)
+ if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months]))
+ User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months
+ User.current.preference.save
+ end
@date_from = Date.civil(@year_from, @month_from, 1)
@date_to = (@date_from >> @months) - 1