annotate .svn/pristine/23/23389be83ae1e1f9aef946f48e6c0e1c8c6bbfb1.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children
rev   line source
Chris@1295 1 <% @gantt.view = self %>
Chris@1295 2 <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
Chris@1295 3
Chris@1295 4 <%= form_tag({:controller => 'gantts', :action => 'show',
Chris@1295 5 :project_id => @project, :month => params[:month],
Chris@1295 6 :year => params[:year], :months => params[:months]},
Chris@1295 7 :method => :get, :id => 'query_form') do %>
Chris@1295 8 <%= hidden_field_tag 'set_filter', '1' %>
Chris@1295 9 <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
Chris@1295 10 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
Chris@1295 11 <div style="<%= @query.new_record? ? "" : "display: none;" %>">
Chris@1295 12 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
Chris@1295 13 </div>
Chris@1295 14 </fieldset>
Chris@1295 15
Chris@1295 16 <p class="contextual">
Chris@1295 17 <%= gantt_zoom_link(@gantt, :in) %>
Chris@1295 18 <%= gantt_zoom_link(@gantt, :out) %>
Chris@1295 19 </p>
Chris@1295 20
Chris@1295 21 <p class="buttons">
Chris@1295 22 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
Chris@1295 23 <%= l(:label_months_from) %>
Chris@1295 24 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
Chris@1295 25 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
Chris@1295 26 <%= hidden_field_tag 'zoom', @gantt.zoom %>
Chris@1295 27
Chris@1295 28 <%= link_to_function l(:button_apply), '$("#query_form").submit()',
Chris@1295 29 :class => 'icon icon-checked' %>
Chris@1295 30 <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 },
Chris@1295 31 :class => 'icon icon-reload' %>
Chris@1295 32 </p>
Chris@1295 33 <% end %>
Chris@1295 34
Chris@1295 35 <%= error_messages_for 'query' %>
Chris@1295 36 <% if @query.valid? %>
Chris@1295 37 <%
Chris@1295 38 zoom = 1
Chris@1295 39 @gantt.zoom.times { zoom = zoom * 2 }
Chris@1295 40
Chris@1295 41 subject_width = 330
Chris@1295 42 header_heigth = 18
Chris@1295 43
Chris@1295 44 headers_height = header_heigth
Chris@1295 45 show_weeks = false
Chris@1295 46 show_days = false
Chris@1295 47
Chris@1295 48 if @gantt.zoom > 1
Chris@1295 49 show_weeks = true
Chris@1295 50 headers_height = 2 * header_heigth
Chris@1295 51 if @gantt.zoom > 2
Chris@1295 52 show_days = true
Chris@1295 53 headers_height = 3 * header_heigth
Chris@1295 54 end
Chris@1295 55 end
Chris@1295 56
Chris@1295 57 # Width of the entire chart
Chris@1295 58 g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i
Chris@1295 59 @gantt.render(:top => headers_height + 8,
Chris@1295 60 :zoom => zoom,
Chris@1295 61 :g_width => g_width,
Chris@1295 62 :subject_width => subject_width)
Chris@1295 63 g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max
Chris@1295 64 t_height = g_height + headers_height
Chris@1295 65 %>
Chris@1295 66
Chris@1295 67 <% if @gantt.truncated %>
Chris@1295 68 <p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p>
Chris@1295 69 <% end %>
Chris@1295 70
Chris@1295 71 <table style="width:100%; border:0; border-collapse: collapse;">
Chris@1295 72 <tr>
Chris@1295 73 <td style="width:<%= subject_width %>px; padding:0px;">
Chris@1295 74 <%
Chris@1295 75 style = ""
Chris@1295 76 style += "position:relative;"
Chris@1295 77 style += "height: #{t_height + 24}px;"
Chris@1295 78 style += "width: #{subject_width + 1}px;"
Chris@1295 79 %>
Chris@1295 80 <%= content_tag(:div, :style => style) do %>
Chris@1295 81 <%
Chris@1295 82 style = ""
Chris@1295 83 style += "right:-2px;"
Chris@1295 84 style += "width: #{subject_width}px;"
Chris@1295 85 style += "height: #{headers_height}px;"
Chris@1295 86 style += 'background: #eee;'
Chris@1295 87 %>
Chris@1295 88 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
Chris@1295 89 <%
Chris@1295 90 style = ""
Chris@1295 91 style += "right:-2px;"
Chris@1295 92 style += "width: #{subject_width}px;"
Chris@1295 93 style += "height: #{t_height}px;"
Chris@1295 94 style += 'border-left: 1px solid #c0c0c0;'
Chris@1295 95 style += 'overflow: hidden;'
Chris@1295 96 %>
Chris@1295 97 <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
Chris@1295 98 <%= content_tag(:div, :class => "gantt_subjects") do %>
Chris@1295 99 <%= @gantt.subjects.html_safe %>
Chris@1295 100 <% end %>
Chris@1295 101 <% end %>
Chris@1295 102 </td>
Chris@1295 103
Chris@1295 104 <td>
Chris@1295 105 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
Chris@1295 106 <%
Chris@1295 107 style = ""
Chris@1295 108 style += "width: #{g_width - 1}px;"
Chris@1295 109 style += "height: #{headers_height}px;"
Chris@1295 110 style += 'background: #eee;'
Chris@1295 111 %>
Chris@1295 112 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style, :class => "gantt_hdr") %>
Chris@1295 113
Chris@1295 114 <% ###### Months headers ###### %>
Chris@1295 115 <%
Chris@1295 116 month_f = @gantt.date_from
Chris@1295 117 left = 0
Chris@1295 118 height = (show_weeks ? header_heigth : header_heigth + g_height)
Chris@1295 119 %>
Chris@1295 120 <% @gantt.months.times do %>
Chris@1295 121 <%
Chris@1295 122 width = (((month_f >> 1) - month_f) * zoom - 1).to_i
Chris@1295 123 style = ""
Chris@1295 124 style += "left: #{left}px;"
Chris@1295 125 style += "width: #{width}px;"
Chris@1295 126 style += "height: #{height}px;"
Chris@1295 127 %>
Chris@1295 128 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
Chris@1295 129 <%= link_to h("#{month_f.year}-#{month_f.month}"),
Chris@1295 130 @gantt.params.merge(:year => month_f.year, :month => month_f.month),
Chris@1295 131 :title => "#{month_name(month_f.month)} #{month_f.year}" %>
Chris@1295 132 <% end %>
Chris@1295 133 <%
Chris@1295 134 left = left + width + 1
Chris@1295 135 month_f = month_f >> 1
Chris@1295 136 %>
Chris@1295 137 <% end %>
Chris@1295 138
Chris@1295 139 <% ###### Weeks headers ###### %>
Chris@1295 140 <% if show_weeks %>
Chris@1295 141 <%
Chris@1295 142 left = 0
Chris@1295 143 height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height)
Chris@1295 144 %>
Chris@1295 145 <% if @gantt.date_from.cwday == 1 %>
Chris@1295 146 <%
Chris@1295 147 # @date_from is monday
Chris@1295 148 week_f = @gantt.date_from
Chris@1295 149 %>
Chris@1295 150 <% else %>
Chris@1295 151 <%
Chris@1295 152 # find next monday after @date_from
Chris@1295 153 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
Chris@1295 154 width = (7 - @gantt.date_from.cwday + 1) * zoom - 1
Chris@1295 155 style = ""
Chris@1295 156 style += "left: #{left}px;"
Chris@1295 157 style += "top: 19px;"
Chris@1295 158 style += "width: #{width}px;"
Chris@1295 159 style += "height: #{height}px;"
Chris@1295 160 %>
Chris@1295 161 <%= content_tag(:div, '&nbsp;'.html_safe,
Chris@1295 162 :style => style, :class => "gantt_hdr") %>
Chris@1295 163 <% left = left + width + 1 %>
Chris@1295 164 <% end %>
Chris@1295 165 <% while week_f <= @gantt.date_to %>
Chris@1295 166 <%
Chris@1295 167 width = ((week_f + 6 <= @gantt.date_to) ?
Chris@1295 168 7 * zoom - 1 :
Chris@1295 169 (@gantt.date_to - week_f + 1) * zoom - 1).to_i
Chris@1295 170 style = ""
Chris@1295 171 style += "left: #{left}px;"
Chris@1295 172 style += "top: 19px;"
Chris@1295 173 style += "width: #{width}px;"
Chris@1295 174 style += "height: #{height}px;"
Chris@1295 175 %>
Chris@1295 176 <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
Chris@1295 177 <%= content_tag(:small) do %>
Chris@1295 178 <%= week_f.cweek if width >= 16 %>
Chris@1295 179 <% end %>
Chris@1295 180 <% end %>
Chris@1295 181 <%
Chris@1295 182 left = left + width + 1
Chris@1295 183 week_f = week_f + 7
Chris@1295 184 %>
Chris@1295 185 <% end %>
Chris@1295 186 <% end %>
Chris@1295 187
Chris@1295 188 <% ###### Days headers ####### %>
Chris@1295 189 <% if show_days %>
Chris@1295 190 <%
Chris@1295 191 left = 0
Chris@1295 192 height = g_height + header_heigth - 1
Chris@1295 193 wday = @gantt.date_from.cwday
Chris@1295 194 %>
Chris@1295 195 <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
Chris@1295 196 <%
Chris@1295 197 width = zoom - 1
Chris@1295 198 style = ""
Chris@1295 199 style += "left: #{left}px;"
Chris@1295 200 style += "top:37px;"
Chris@1295 201 style += "width: #{width}px;"
Chris@1295 202 style += "height: #{height}px;"
Chris@1295 203 style += "font-size:0.7em;"
Chris@1295 204 clss = "gantt_hdr"
Chris@1295 205 clss << " nwday" if @gantt.non_working_week_days.include?(wday)
Chris@1295 206 %>
Chris@1295 207 <%= content_tag(:div, :style => style, :class => clss) do %>
Chris@1295 208 <%= day_letter(wday) %>
Chris@1295 209 <% end %>
Chris@1295 210 <%
Chris@1295 211 left = left + width + 1
Chris@1295 212 wday = wday + 1
Chris@1295 213 wday = 1 if wday > 7
Chris@1295 214 %>
Chris@1295 215 <% end %>
Chris@1295 216 <% end %>
Chris@1295 217
Chris@1295 218 <%= @gantt.lines.html_safe %>
Chris@1295 219
Chris@1295 220 <% ###### Today red line (excluded from cache) ###### %>
Chris@1295 221 <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
Chris@1295 222 <%
Chris@1295 223 today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
Chris@1295 224 style = ""
Chris@1295 225 style += "position: absolute;"
Chris@1295 226 style += "height: #{g_height}px;"
Chris@1295 227 style += "top: #{headers_height + 1}px;"
Chris@1295 228 style += "left: #{today_left}px;"
Chris@1295 229 style += "width:10px;"
Chris@1295 230 style += "border-left: 1px dashed red;"
Chris@1295 231 %>
Chris@1295 232 <%= content_tag(:div, '&nbsp;'.html_safe, :style => style) %>
Chris@1295 233 <% end %>
Chris@1295 234
Chris@1295 235 </div>
Chris@1295 236 </td>
Chris@1295 237 </tr>
Chris@1295 238 </table>
Chris@1295 239
Chris@1295 240 <table style="width:100%">
Chris@1295 241 <tr>
Chris@1295 242 <td align="left">
Chris@1295 243 <%= link_to_content_update("\xc2\xab " + l(:label_previous),
Chris@1295 244 params.merge(@gantt.params_previous)) %>
Chris@1295 245 </td>
Chris@1295 246 <td align="right">
Chris@1295 247 <%= link_to_content_update(l(:label_next) + " \xc2\xbb",
Chris@1295 248 params.merge(@gantt.params_next)) %>
Chris@1295 249 </td>
Chris@1295 250 </tr>
Chris@1295 251 </table>
Chris@1295 252
Chris@1295 253 <% other_formats_links do |f| %>
Chris@1295 254 <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %>
Chris@1295 255 <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
Chris@1295 256 <% end %>
Chris@1295 257 <% end # query.valid? %>
Chris@1295 258
Chris@1295 259 <% content_for :sidebar do %>
Chris@1295 260 <%= render :partial => 'issues/sidebar' %>
Chris@1295 261 <% end %>
Chris@1295 262
Chris@1295 263 <% html_title(l(:label_gantt)) -%>