gantt.rb.diff

Yuki Kita, 2010-06-30 23:06

Download (1.45 KB)

View differences:

lib/redmine/helpers/gantt.rb (working copy)
33 33
            @month_from = 1
34 34
          end
35 35
        else
36
          @month_from ||= Date.today.month
37
          @year_from ||= Date.today.year
36
          @month_from ||= (User.current.pref[:gantt_month] || Date.today.month)
37
          @year_from ||= (User.current.pref[:gantt_year] || Date.today.year)
38 38
        end
39 39
        
40 40
        zoom = (options[:zoom] || User.current.pref[:gantt_zoom]).to_i
......
43 43
        @months = (months > 0 && months < 25) ? months : 6
44 44
        
45 45
        # Save gantt parameters as user preference (zoom and months count)
46
        if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months]))
47
          User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months
48
          User.current.preference.save
46
        pref = User.current.pref
47
        if User.current.logged? && (@zoom != pref[:gantt_zoom] || @months != pref[:gantt_months] || @month_from != pref[:gantt_month] || @year_from != pref[:year_from])
48
          pref[:gantt_zoom], pref[:gantt_months], pref[:gantt_month], pref[:year_from] = @zoom, @months, @month_from, @year_from
49
          pref.save
49 50
        end
50 51
        
51 52
        @date_from = Date.civil(@year_from, @month_from, 1)