Last active
August 29, 2015 14:03
-
-
Save mi-yo/1b9bc352e38538515c9c to your computer and use it in GitHub Desktop.
Redmine 2.5.1 gantts show assignee.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- app/views/gantts/show.html.erb.org 2014-03-30 01:56:38 +0900 | |
+++ app/views/gantts/show.html.erb 2014-06-29 22:41:28 +0900 | |
@@ -146,6 +146,61 @@ | |
<% end %> | |
<% end %> | |
</td> | |
+<% | |
+ assignee_width = 80 | |
+%> | |
+<td style="width:<%= assignee_width %>px; padding:0px;"> | |
+ <% | |
+ style = "" | |
+ style += "position:relative;" | |
+ style += "height: #{t_height + 24}px;" | |
+ style += "width: #{assignee_width}px;" | |
+ %> | |
+ <%= content_tag(:div, :style => style) do %> | |
+ <% | |
+ style = "" | |
+ style += "right: -2px;" | |
+ style += "width: #{assignee_width}px;" | |
+ style += "height: #{headers_height}px;" | |
+ style += "font-size:0.9em;" | |
+ style += 'background: #eee;' | |
+ %> | |
+ <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> | |
+ <% | |
+ style = "" | |
+ style += "right: -2px;" | |
+ style += "width: #{assignee_width}px;" | |
+ style += "height: #{t_height}px;" | |
+ %> | |
+ <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %> | |
+ <% | |
+ top = headers_height + 9 | |
+ row_number = 1 | |
+ %> | |
+ <%= content_tag(:div, :style => style, :class => "gantt_subjects") do %> | |
+ <% @gantt.number_of_rows.times do %> | |
+ <% | |
+ style = "" | |
+ style += "left: +4px;" | |
+ style += "top: #{top}px;" | |
+ style += "width: #{assignee_width - 4}px;" | |
+ style += "height: 16px;" | |
+ style += "position: absolute;" | |
+ style += "overflow: hidden;" | |
+ style += "text-overflow: ellipsis;" | |
+ style += "white-space: nowrap;" | |
+ %> | |
+ <%= content_tag(:span, :style => style, :class => "assigned-to") do %> | |
+ <%= link_to_user(@gantt.assignees[row_number]).html_safe %> | |
+ <% end %> | |
+ <% | |
+ top = top + 20 | |
+ row_number = row_number + 1 | |
+ %> | |
+ <% end %> | |
+ <% end %> | |
+ <% end %> | |
+</td> | |
<td> | |
<div style="position:relative;height:<%= t_height + 24 %>px;overflow:auto;" id="gantt_area"> | |
--- lib/redmine/helpers/gantt.rb.org 2014-03-30 01:56:41 +0900 | |
+++ lib/redmine/helpers/gantt.rb 2014-06-29 22:36:24 +0900 | |
@@ -72,6 +72,7 @@ | |
@date_from = Date.civil(@year_from, @month_from, 1) | |
@date_to = (@date_from >> @months) - 1 | |
@subjects = '' | |
+ @assignees = {} | |
@lines = '' | |
@number_of_rows = nil | |
@issue_ancestors = [] | |
@@ -127,6 +128,10 @@ | |
@subjects | |
end | |
+ def assignees() | |
+ @assignees | |
+ end | |
+ | |
# Renders the lines of the Gantt chart, the right side | |
def lines(options={}) | |
render(options.merge(:only => :lines)) unless @lines_rendered | |
@@ -236,6 +241,7 @@ | |
line_for_issue(i, options) unless options[:only] == :subjects | |
options[:top] += options[:top_increment] | |
@number_of_rows += 1 | |
+ @assignees.store(@number_of_rows, i.assigned_to) | |
break if abort? | |
end | |
options[:indent] -= (options[:indent_increment] * @issue_ancestors.size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment