diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-06 16:40:33 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-06 16:40:33 +0000 |
commit | b748455d96644968303fb0a3777a93e6de80d0aa (patch) | |
tree | d9c8953af6aa5d6384918b20ec21b35db5f71a36 /app/views/projects | |
parent | 7eb64715595abded9e5ef4bcbc06aa203c6f23a8 (diff) | |
download | redmine-b748455d96644968303fb0a3777a93e6de80d0aa.tar.gz redmine-b748455d96644968303fb0a3777a93e6de80d0aa.zip |
Added fragment caching for calendar and gantt views
git-svn-id: http://redmine.rubyforge.org/svn/trunk@515 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/projects')
-rw-r--r-- | app/views/projects/calendar.rhtml | 4 | ||||
-rw-r--r-- | app/views/projects/gantt.rhtml | 71 |
2 files changed, 41 insertions, 34 deletions
diff --git a/app/views/projects/calendar.rhtml b/app/views/projects/calendar.rhtml index c63365b6c..2a53831fe 100644 --- a/app/views/projects/calendar.rhtml +++ b/app/views/projects/calendar.rhtml @@ -1,3 +1,4 @@ +<% cache(:year => @year, :month => @month, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %> <h2><%= l(:label_calendar) %></h2> <% form_tag do %> @@ -87,4 +88,5 @@ end %> <%= image_tag 'arrow_from.png' %> <%= l(:text_tip_task_begin_day) %><br /> <%= image_tag 'arrow_to.png' %> <%= l(:text_tip_task_end_day) %><br /> -<%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br />
\ No newline at end of file +<%= image_tag 'arrow_bw.png' %> <%= l(:text_tip_task_begin_end_day) %><br /> +<% end %> diff --git a/app/views/projects/gantt.rhtml b/app/views/projects/gantt.rhtml index 6359f0429..317fd993d 100644 --- a/app/views/projects/gantt.rhtml +++ b/app/views/projects/gantt.rhtml @@ -1,3 +1,28 @@ +<% zoom = 1 +@zoom.times { zoom = zoom * 2 } + +subject_width = 330 +header_heigth = 18 + +headers_height = header_heigth +show_weeks = false +show_days = false + +if @zoom >1 + show_weeks = true + headers_height = 2*header_heigth + if @zoom > 2 + show_days = true + headers_height = 3*header_heigth + end +end + +g_width = (@date_to - @date_from + 1)*zoom +g_height = [(20 * @events.length + 6)+150, 206].max +t_height = g_height + headers_height +%> + +<% cache(:year => @year_from, :month => @month_from, :months => @months, :zoom => @zoom, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %> <div class="contextual"> <%= l(:label_export_to) %> <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :output => 'pdf'}, :class => 'icon icon-pdf' %> @@ -47,30 +72,6 @@ </table> <% end %> -<% zoom = 1 -@zoom.times { zoom = zoom * 2 } - -subject_width = 330 -header_heigth = 18 - -headers_height = header_heigth -show_weeks = false -show_days = false - -if @zoom >1 - show_weeks = true - headers_height = 2*header_heigth - if @zoom > 2 - show_days = true - headers_height = 3*header_heigth - end -end - -g_width = (@date_to - @date_from + 1)*zoom -g_height = [(20 * @events.length + 6)+150, 206].max -t_height = g_height + headers_height -%> - <table width="100%" style="border:0; border-collapse: collapse;"> <tr> <td style="width:<%= subject_width %>px;"> @@ -173,14 +174,6 @@ end %> <% # -# Today red line -# -if Date.today >= @date_from and Date.today <= @date_to %> - <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div> -<% end %> - -<% -# # Tasks # top = headers_height + 10 @@ -226,6 +219,18 @@ top = headers_height + 10 <% end %> <% top = top + 20 end %> + +<% end # cache +%> + +<% +# +# Today red line (excluded from cache) +# +if Date.today >= @date_from and Date.today <= @date_to %> + <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;"> </div> +<% end %> + </div> </td> </tr> @@ -236,4 +241,4 @@ end %> <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> </tr> -</table>
\ No newline at end of file +</table> |