Chris@1296: <% @gantt.view = self %> Chris@1296:

<%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

Chris@1296: Chris@1296: <%= form_tag({:controller => 'gantts', :action => 'show', Chris@1296: :project_id => @project, :month => params[:month], Chris@1296: :year => params[:year], :months => params[:months]}, Chris@1296: :method => :get, :id => 'query_form') do %> Chris@1296: <%= hidden_field_tag 'set_filter', '1' %> Chris@1296:
"> Chris@1296: <%= l(:label_filter_plural) %> Chris@1296:
"> Chris@1296: <%= render :partial => 'queries/filters', :locals => {:query => @query} %> Chris@1296:
Chris@1296:
Chris@1296: Chris@1296:

Chris@1296: <%= gantt_zoom_link(@gantt, :in) %> Chris@1296: <%= gantt_zoom_link(@gantt, :out) %> Chris@1296:

Chris@1296: Chris@1296:

Chris@1296: <%= text_field_tag 'months', @gantt.months, :size => 2 %> Chris@1296: <%= l(:label_months_from) %> Chris@1296: <%= select_month(@gantt.month_from, :prefix => "month", :discard_type => true) %> Chris@1296: <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %> Chris@1296: <%= hidden_field_tag 'zoom', @gantt.zoom %> Chris@1296: Chris@1296: <%= link_to_function l(:button_apply), '$("#query_form").submit()', Chris@1296: :class => 'icon icon-checked' %> Chris@1296: <%= link_to l(:button_clear), { :project_id => @project, :set_filter => 1 }, Chris@1296: :class => 'icon icon-reload' %> Chris@1296:

Chris@1296: <% end %> Chris@1296: Chris@1296: <%= error_messages_for 'query' %> Chris@1296: <% if @query.valid? %> Chris@1296: <% Chris@1296: zoom = 1 Chris@1296: @gantt.zoom.times { zoom = zoom * 2 } Chris@1296: Chris@1296: subject_width = 330 Chris@1296: header_heigth = 18 Chris@1296: Chris@1296: headers_height = header_heigth Chris@1296: show_weeks = false Chris@1296: show_days = false Chris@1296: Chris@1296: if @gantt.zoom > 1 Chris@1296: show_weeks = true Chris@1296: headers_height = 2 * header_heigth Chris@1296: if @gantt.zoom > 2 Chris@1296: show_days = true Chris@1296: headers_height = 3 * header_heigth Chris@1296: end Chris@1296: end Chris@1296: Chris@1296: # Width of the entire chart Chris@1296: g_width = ((@gantt.date_to - @gantt.date_from + 1) * zoom).to_i Chris@1296: @gantt.render(:top => headers_height + 8, Chris@1296: :zoom => zoom, Chris@1296: :g_width => g_width, Chris@1296: :subject_width => subject_width) Chris@1296: g_height = [(20 * (@gantt.number_of_rows + 6)) + 150, 206].max Chris@1296: t_height = g_height + headers_height Chris@1296: %> Chris@1296: Chris@1296: <% if @gantt.truncated %> Chris@1296:

<%= l(:notice_gantt_chart_truncated, :max => @gantt.max_rows) %>

Chris@1296: <% end %> Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296:
Chris@1296: <% Chris@1296: style = "" Chris@1296: style += "position:relative;" Chris@1296: style += "height: #{t_height + 24}px;" Chris@1296: style += "width: #{subject_width + 1}px;" Chris@1296: %> Chris@1296: <%= content_tag(:div, :style => style) do %> Chris@1296: <% Chris@1296: style = "" Chris@1296: style += "right:-2px;" Chris@1296: style += "width: #{subject_width}px;" Chris@1296: style += "height: #{headers_height}px;" Chris@1296: style += 'background: #eee;' Chris@1296: %> Chris@1296: <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> Chris@1296: <% Chris@1296: style = "" Chris@1296: style += "right:-2px;" Chris@1296: style += "width: #{subject_width}px;" Chris@1296: style += "height: #{t_height}px;" Chris@1296: style += 'border-left: 1px solid #c0c0c0;' Chris@1296: style += 'overflow: hidden;' Chris@1296: %> Chris@1296: <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> Chris@1296: <%= content_tag(:div, :class => "gantt_subjects") do %> Chris@1296: <%= @gantt.subjects.html_safe %> Chris@1296: <% end %> Chris@1296: <% end %> Chris@1296: Chris@1296:
Chris@1296: <% Chris@1296: style = "" Chris@1296: style += "width: #{g_width - 1}px;" Chris@1296: style += "height: #{headers_height}px;" Chris@1296: style += 'background: #eee;' Chris@1296: %> Chris@1296: <%= content_tag(:div, ' '.html_safe, :style => style, :class => "gantt_hdr") %> Chris@1296: Chris@1296: <% ###### Months headers ###### %> Chris@1296: <% Chris@1296: month_f = @gantt.date_from Chris@1296: left = 0 Chris@1296: height = (show_weeks ? header_heigth : header_heigth + g_height) Chris@1296: %> Chris@1296: <% @gantt.months.times do %> Chris@1296: <% Chris@1296: width = (((month_f >> 1) - month_f) * zoom - 1).to_i Chris@1296: style = "" Chris@1296: style += "left: #{left}px;" Chris@1296: style += "width: #{width}px;" Chris@1296: style += "height: #{height}px;" Chris@1296: %> Chris@1296: <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> Chris@1296: <%= link_to h("#{month_f.year}-#{month_f.month}"), Chris@1296: @gantt.params.merge(:year => month_f.year, :month => month_f.month), Chris@1296: :title => "#{month_name(month_f.month)} #{month_f.year}" %> Chris@1296: <% end %> Chris@1296: <% Chris@1296: left = left + width + 1 Chris@1296: month_f = month_f >> 1 Chris@1296: %> Chris@1296: <% end %> Chris@1296: Chris@1296: <% ###### Weeks headers ###### %> Chris@1296: <% if show_weeks %> Chris@1296: <% Chris@1296: left = 0 Chris@1296: height = (show_days ? header_heigth - 1 : header_heigth - 1 + g_height) Chris@1296: %> Chris@1296: <% if @gantt.date_from.cwday == 1 %> Chris@1296: <% Chris@1296: # @date_from is monday Chris@1296: week_f = @gantt.date_from Chris@1296: %> Chris@1296: <% else %> Chris@1296: <% Chris@1296: # find next monday after @date_from Chris@1296: week_f = @gantt.date_from + (7 - @gantt.date_from.cwday + 1) Chris@1296: width = (7 - @gantt.date_from.cwday + 1) * zoom - 1 Chris@1296: style = "" Chris@1296: style += "left: #{left}px;" Chris@1296: style += "top: 19px;" Chris@1296: style += "width: #{width}px;" Chris@1296: style += "height: #{height}px;" Chris@1296: %> Chris@1296: <%= content_tag(:div, ' '.html_safe, Chris@1296: :style => style, :class => "gantt_hdr") %> Chris@1296: <% left = left + width + 1 %> Chris@1296: <% end %> Chris@1296: <% while week_f <= @gantt.date_to %> Chris@1296: <% Chris@1296: width = ((week_f + 6 <= @gantt.date_to) ? Chris@1296: 7 * zoom - 1 : Chris@1296: (@gantt.date_to - week_f + 1) * zoom - 1).to_i Chris@1296: style = "" Chris@1296: style += "left: #{left}px;" Chris@1296: style += "top: 19px;" Chris@1296: style += "width: #{width}px;" Chris@1296: style += "height: #{height}px;" Chris@1296: %> Chris@1296: <%= content_tag(:div, :style => style, :class => "gantt_hdr") do %> Chris@1296: <%= content_tag(:small) do %> Chris@1296: <%= week_f.cweek if width >= 16 %> Chris@1296: <% end %> Chris@1296: <% end %> Chris@1296: <% Chris@1296: left = left + width + 1 Chris@1296: week_f = week_f + 7 Chris@1296: %> Chris@1296: <% end %> Chris@1296: <% end %> Chris@1296: Chris@1296: <% ###### Days headers ####### %> Chris@1296: <% if show_days %> Chris@1296: <% Chris@1296: left = 0 Chris@1296: height = g_height + header_heigth - 1 Chris@1296: wday = @gantt.date_from.cwday Chris@1296: %> Chris@1296: <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> Chris@1296: <% Chris@1296: width = zoom - 1 Chris@1296: style = "" Chris@1296: style += "left: #{left}px;" Chris@1296: style += "top:37px;" Chris@1296: style += "width: #{width}px;" Chris@1296: style += "height: #{height}px;" Chris@1296: style += "font-size:0.7em;" Chris@1296: clss = "gantt_hdr" Chris@1296: clss << " nwday" if @gantt.non_working_week_days.include?(wday) Chris@1296: %> Chris@1296: <%= content_tag(:div, :style => style, :class => clss) do %> Chris@1296: <%= day_letter(wday) %> Chris@1296: <% end %> Chris@1296: <% Chris@1296: left = left + width + 1 Chris@1296: wday = wday + 1 Chris@1296: wday = 1 if wday > 7 Chris@1296: %> Chris@1296: <% end %> Chris@1296: <% end %> Chris@1296: Chris@1296: <%= @gantt.lines.html_safe %> Chris@1296: Chris@1296: <% ###### Today red line (excluded from cache) ###### %> Chris@1296: <% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %> Chris@1296: <% Chris@1296: today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i Chris@1296: style = "" Chris@1296: style += "position: absolute;" Chris@1296: style += "height: #{g_height}px;" Chris@1296: style += "top: #{headers_height + 1}px;" Chris@1296: style += "left: #{today_left}px;" Chris@1296: style += "width:10px;" Chris@1296: style += "border-left: 1px dashed red;" Chris@1296: %> Chris@1296: <%= content_tag(:div, ' '.html_safe, :style => style) %> Chris@1296: <% end %> Chris@1296: Chris@1296:
Chris@1296:
Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296: Chris@1296:
Chris@1296: <%= link_to_content_update("\xc2\xab " + l(:label_previous), Chris@1296: params.merge(@gantt.params_previous)) %> Chris@1296: Chris@1296: <%= link_to_content_update(l(:label_next) + " \xc2\xbb", Chris@1296: params.merge(@gantt.params_next)) %> Chris@1296:
Chris@1296: Chris@1296: <% other_formats_links do |f| %> Chris@1296: <%= f.link_to 'PDF', :url => params.merge(@gantt.params) %> Chris@1296: <%= f.link_to('PNG', :url => params.merge(@gantt.params)) if @gantt.respond_to?('to_image') %> Chris@1296: <% end %> Chris@1296: <% end # query.valid? %> Chris@1296: Chris@1296: <% content_for :sidebar do %> Chris@1296: <%= render :partial => 'issues/sidebar' %> Chris@1296: <% end %> Chris@1296: Chris@1296: <% html_title(l(:label_gantt)) -%>