@@ -579,12 +579,20 class ProjectsController < ApplicationController | |||||
579 | @month_from = 1 |
|
579 | @month_from = 1 | |
580 | end |
|
580 | end | |
581 | else |
|
581 | else | |
582 |
@month_from ||= |
|
582 | @month_from ||= Date.today.month | |
583 |
@year_from ||= |
|
583 | @year_from ||= Date.today.year | |
584 | end |
|
584 | end | |
585 |
|
585 | |||
586 | @zoom = (params[:zoom].to_i > 0 and params[:zoom].to_i < 5) ? params[:zoom].to_i : 2 |
|
586 | zoom = (params[:zoom] || User.current.pref[:gantt_zoom]).to_i | |
587 | @months = (params[:months].to_i > 0 and params[:months].to_i < 25) ? params[:months].to_i : 6 |
|
587 | @zoom = (zoom > 0 && zoom < 5) ? zoom : 2 | |
|
588 | months = (params[:months] || User.current.pref[:gantt_months]).to_i | |||
|
589 | @months = (months > 0 && months < 25) ? months : 6 | |||
|
590 | ||||
|
591 | # Save gantt paramters as user preference (zoom and months count) | |||
|
592 | if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months])) | |||
|
593 | User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months | |||
|
594 | User.current.preference.save | |||
|
595 | end | |||
588 |
|
596 | |||
589 | @date_from = Date.civil(@year_from, @month_from, 1) |
|
597 | @date_from = Date.civil(@year_from, @month_from, 1) | |
590 | @date_to = (@date_from >> @months) - 1 |
|
598 | @date_to = (@date_from >> @months) - 1 |
General Comments 0
You need to be logged in to leave comments.
Login now