annotate .svn/pristine/82/82b21e972ba488af04b89b832125d370772e13c3.svn-base @ 1478:5ca1f4a47171 bibplugin_db_migrations

Close obsolete branch bibplugin_db_migrations
author Chris Cannam
date Fri, 30 Nov 2012 14:40:50 +0000
parents cbb26bc654de
children
rev   line source
Chris@909 1 <% @gantt.view = self %>
Chris@909 2 <h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
Chris@909 3
Chris@909 4 <% form_tag({:controller => 'gantts', :action => 'show', :project_id => @project, :month => params[:month], :year => params[:year], :months => params[:months]}, :method => :get, :id => 'query_form') do %>
Chris@909 5 <%= hidden_field_tag 'set_filter', '1' %>
Chris@909 6 <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
Chris@909 7 <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
Chris@909 8 <div style="<%= @query.new_record? ? "" : "display: none;" %>">
Chris@909 9 <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
Chris@909 10 </div>
Chris@909 11 </fieldset>
Chris@909 12
Chris@909 13 <p class="contextual">
Chris@909 14 <%= gantt_zoom_link(@gantt, :in) %>
Chris@909 15 <%= gantt_zoom_link(@gantt, :out) %>
Chris@909 16 </p>
Chris@909 17
Chris@909 18 <p class="buttons">
Chris@909 19 <%= text_field_tag 'months', @gantt.months, :size => 2 %>
Chris@909 20 <%= l(:label_months_from) %>
Chris@909 21 <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %>
Chris@909 22 <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %>
Chris@909 23 <%= hidden_field_tag 'zoom', @gantt.zoom %>
Chris@909 24
Chris@909 25 <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %>
Chris@909 26 <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, :class => 'icon icon-reload' %>
Chris@909 27 </p>
Chris@909 28 <% end %>
Chris@909 29
Chris@909 30 <%= error_messages_for 'query' %>
Chris@909 31 <% if @query.valid? %>
Chris@909 32 <% zoom = 1
Chris@909 33 @gantt.zoom.times { zoom = zoom * 2 }
Chris@909 34
Chris@909 35 subject_width = 330
Chris@909 36 header_heigth = 18
Chris@909 37
Chris@909 38 headers_height = header_heigth
Chris@909 39 show_weeks = false
Chris@909 40 show_days = false
Chris@909 41
Chris@909 42 if @gantt.zoom >1
Chris@909 43 show_weeks = true
Chris@909 44 headers_height = 2*header_heigth
Chris@909 45 if @gantt.zoom > 2
Chris@909 46 show_days = true
Chris@909 47 headers_height = 3*header_heigth
Chris@909 48 end
Chris@909 49 end
Chris@909 50
Chris@909 51 # Width of the entire chart
Chris@909 52 g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
Chris@909 53
Chris@909 54 @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width)
Chris@909 55
Chris@909 56 g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
Chris@909 57 t_height = g_height + headers_height
Chris@909 58
Chris@909 59
Chris@909 60 %>
Chris@909 61
Chris@909 62 <% if @gantt.truncated %>
Chris@909 63 <p class="warning"><%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %></p>
Chris@909 64 <% end %>
Chris@909 65
Chris@909 66 <table width="100%" style="border:0; border-collapse: collapse;">
Chris@909 67 <tr>
Chris@909 68 <td style="width:<%= subject_width %>px; padding:0px;">
Chris@909 69
Chris@909 70 <div style="position:relative;height:<%= t_height + 24 %>px;width:<%= subject_width + 1 %>px;">
Chris@909 71 <div style="right:-2px;width:<%= subject_width %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr"></div>
Chris@909 72 <div style="right:-2px;width:<%= subject_width %>px;height:<%= t_height %>px;border-left: 1px solid #c0c0c0;overflow:hidden;" class="gantt_hdr"></div>
Chris@909 73
Chris@909 74 <div class="gantt_subjects">
Chris@909 75 <%= @gantt.subjects.html_safe %>
Chris@909 76 </div>
Chris@909 77
Chris@909 78 </div>
Chris@909 79 </td>
Chris@909 80 <td>
Chris@909 81
Chris@909 82 <div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;">
Chris@909 83 <div style="width:<%= g_width-1 %>px;height:<%= headers_height %>px;background: #eee;" class="gantt_hdr">&nbsp;</div>
Chris@909 84 <%
Chris@909 85 #
Chris@909 86 # Months headers
Chris@909 87 #
Chris@909 88 month_f = @gantt.date_from
Chris@909 89 left = 0
Chris@909 90 height = (show_weeks ? header_heigth : header_heigth + g_height)
Chris@909 91 @gantt.months.times do
Chris@909 92 width = ((month_f >> 1) - month_f) * zoom - 1
Chris@909 93 %>
Chris@909 94 <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
Chris@909 95 <%= link_to h("#{month_f.year}-#{month_f.month}"), @gantt.params.merge(:year => month_f.year, :month => month_f.month), :title => "#{month_name(month_f.month)} #{month_f.year}"%>
Chris@909 96 </div>
Chris@909 97 <%
Chris@909 98 left = left + width + 1
Chris@909 99 month_f = month_f >> 1
Chris@909 100 end %>
Chris@909 101
Chris@909 102 <%
Chris@909 103 #
Chris@909 104 # Weeks headers
Chris@909 105 #
Chris@909 106 if show_weeks
Chris@909 107 left = 0
Chris@909 108 height = (show_days ? header_heigth-1 : header_heigth-1 + g_height)
Chris@909 109 if @gantt.date_from.cwday == 1
Chris@909 110 # @date_from is monday
Chris@909 111 week_f = @gantt.date_from
Chris@909 112 else
Chris@909 113 # find next monday after @date_from
Chris@909 114 week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1)
Chris@909 115 width = (7 - @gantt.date_from.cwday + 1) * zoom-1
Chris@909 116 %>
Chris@909 117 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">&nbsp;</div>
Chris@909 118 <%
Chris@909 119 left = left + width+1
Chris@909 120 end %>
Chris@909 121 <%
Chris@909 122 while week_f <= @gantt.date_to
Chris@909 123 width = (week_f + 6 <= @gantt.date_to) ? 7 * zoom -1 : (@gantt.date_to - week_f + 1) * zoom-1
Chris@909 124 %>
Chris@909 125 <div style="left:<%= left %>px;top:19px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr">
Chris@909 126 <small><%= week_f.cweek if width >= 16 %></small>
Chris@909 127 </div>
Chris@909 128 <%
Chris@909 129 left = left + width+1
Chris@909 130 week_f = week_f+7
Chris@909 131 end
Chris@909 132 end %>
Chris@909 133
Chris@909 134 <%
Chris@909 135 #
Chris@909 136 # Days headers
Chris@909 137 #
Chris@909 138 if show_days
Chris@909 139 left = 0
Chris@909 140 height = g_height + header_heigth - 1
Chris@909 141 wday = @gantt.date_from.cwday
Chris@909 142 (@gantt.date_to - @gantt.date_from + 1).to_i.times do
Chris@909 143 width = zoom - 1
Chris@909 144 %>
Chris@909 145 <div style="left:<%= left %>px;top:37px;width:<%= width %>px;height:<%= height %>px;font-size:0.7em;<%= "background:#f1f1f1;" if wday > 5 %>" class="gantt_hdr">
Chris@909 146 <%= day_name(wday).first %>
Chris@909 147 </div>
Chris@909 148 <%
Chris@909 149 left = left + width+1
Chris@909 150 wday = wday + 1
Chris@909 151 wday = 1 if wday > 7
Chris@909 152 end
Chris@909 153 end %>
Chris@909 154
Chris@909 155 <%= @gantt.lines.html_safe %>
Chris@909 156
Chris@909 157 <%
Chris@909 158 #
Chris@909 159 # Today red line (excluded from cache)
Chris@909 160 #
Chris@909 161 if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
Chris@909 162 <div style="position: absolute;height:<%= g_height %>px;top:<%= headers_height + 1 %>px;left:<%= ((Date.today-@gantt.date_from+1)*zoom).floor()-1 %>px;width:10px;border-left: 1px dashed red;">&nbsp;</div>
Chris@909 163 <% end %>
Chris@909 164
Chris@909 165 </div>
Chris@909 166 </td>
Chris@909 167 </tr>
Chris@909 168 </table>
Chris@909 169
Chris@909 170 <table width="100%">
Chris@909 171 <tr>
Chris@909 172 <td align="left"><%= link_to_content_update("\xc2\xab " + l(:label_previous), params.merge(@gantt.params_previous)) %></td>
Chris@909 173 <td align="right"><%= link_to_content_update(l(:label_next) + " \xc2\xbb", params.merge(@gantt.params_next)) %></td>
Chris@909 174 </tr>
Chris@909 175 </table>
Chris@909 176
Chris@909 177 <% other_formats_links do |f| %>
Chris@909 178 <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %>
Chris@909 179 <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %>
Chris@909 180 <% end %>
Chris@909 181 <% end # query.valid? %>
Chris@909 182
Chris@909 183 <% content_for :sidebar do %>
Chris@909 184 <%= render :partial => 'issues/sidebar' %>
Chris@909 185 <% end %>
Chris@909 186
Chris@909 187 <% html_title(l(:label_gantt)) -%>