+<%
+ line_number_width = @gantt.number_of_rows.to_s.length * 8 + 8
+%>
+
+ <%
+ style = ""
+ style += "position:relative;"
+ style += "height: #{t_height + 24}px;"
+ style += "width: #{line_number_width + 1}px;"
+ %>
+ <%= content_tag(:div, :style => style) do %>
+ <%
+ style = ""
+ style += "right: -2px;"
+ style += "width: #{line_number_width}px;"
+ style += "height: #{headers_height}px;"
+ style += "line-height: #{headers_height}px;"
+ style += "font-size:0.9em;"
+ style += 'background: #eee;'
+ %>
+ <%= content_tag(:div, "LN", :style => style, :class => "gantt_hdr") %>
+ <%
+ style = ""
+ style += "right: -2px;"
+ style += "width: #{line_number_width}px;"
+ style += "height: #{t_height}px;"
+ style += 'border-left: 1px solid #c0c0c0;'
+ style += 'overflow: hidden;'
+ %>
+ <%= content_tag(:div, "", :style => style, :class => "gantt_hdr") %>
+ <%
+ top = headers_height + 9
+ line_number = 1
+ %>
+ <% @gantt.number_of_rows.times do %>
+ <%
+ style = ""
+ style += "right: +4px;"
+ style += "top: #{top}px;"
+ style += "position: absolute;"
+ %>
+ <%= content_tag(:div, :style => style, :class => "gantt_subjects") do %>
+ <%= line_number %>
+ <% end %>
+ <%
+ top = top + 20
+ line_number = line_number + 1
+ %>
+ <% end %>
+ <% end %>
+ |
+
<%
style = ""
@@ -226,7 +283,7 @@
style += "height: #{height}px;"
%>
<%= content_tag(:div, :style => style, :class => "gantt_hdr") do %>
- <%= link_to h("#{month_f.year}-#{month_f.month}"),
+ <%= link_to "#{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}" %>
<% end %>
@@ -285,11 +342,46 @@
<% end %>
<% end %>
+<% ###### Day numbers headers ###### %>
+<% if show_day_num %>
+ <%
+ left = 0
+ height = g_height + header_height*2 - 1
+ wday = @gantt.date_from.cwday
+ day_num = @gantt.date_from
+ %>
+ <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
+ <%
+ width = zoom - 1
+ style = ""
+ style += "left:#{left}px;"
+ style += "top:37px;"
+ style += "width:#{width}px;"
+ style += "height:#{height}px;"
+ style += "font-size:0.7em;"
+ clss = "gantt_hdr"
+ clss << " nwday" if @gantt.non_working_week_days.include?(wday)
+ %>
+ <% if wday == 6 %><% style += "color:blue;" %><% end %>
+ <% if wday == 7 %><% style += "color:red;" %><% end %>
+ <%= content_tag(:div, :style => style, :class => clss) do %>
+ <%= day_num.day %>
+ <% end %>
+ <%
+ left = left + width+1
+ day_num = day_num + 1
+ wday = wday + 1
+ wday = 1 if wday > 7
+ %>
+ <% end %>
+<% end %>
+
<% ###### Days headers ####### %>
<% if show_days %>
<%
left = 0
height = g_height + header_height - 1
+ top = (show_day_num ? 55 : 37)
wday = @gantt.date_from.cwday
%>
<% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %>
@@ -297,13 +389,15 @@
width = zoom - 1
style = ""
style += "left: #{left}px;"
- style += "top:37px;"
+ style += "top: #{top}px;"
style += "width: #{width}px;"
style += "height: #{height}px;"
style += "font-size:0.7em;"
clss = "gantt_hdr"
clss << " nwday" if @gantt.non_working_week_days.include?(wday)
%>
+ <% if wday == 6 %><% style += "color:blue;" %><% end %>
+ <% if wday == 7 %><% style += "color:red;" %><% end %>
<%= content_tag(:div, :style => style, :class => clss) do %>
<%= day_letter(wday) %>
<% end %>
@@ -318,9 +412,9 @@
<%= @gantt.lines.html_safe %>
<% ###### Today red line (excluded from cache) ###### %>
-<% if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
+<% if User.current.today >= @gantt.date_from and User.current.today <= @gantt.date_to %>
<%
- today_left = (((Date.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
+ today_left = (((User.current.today - @gantt.date_from + 1) * zoom).floor() - 1).to_i
style = ""
style += "position: absolute;"
style += "height: #{g_height}px;"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e2386f2..49bb48d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,5 +1,5 @@
en:
setting_show_subject_lines: Show subjects at right
setting_show_assignees: Show assignees column
- setting_subject_width: Subject conlumn width
+ setting_subject_width: Subject column width
setting_assignee_width: Assignee column width
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
new file mode 100644
index 0000000..b44107e
--- /dev/null
+++ b/config/locales/ja.yml
@@ -0,0 +1,5 @@
+ja:
+ setting_show_subject_lines: 題名を右に表示
+ setting_show_assignees: 担当者列を表示
+ setting_subject_width: 題名列の幅
+ setting_assignee_width: 担当者列の幅
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
new file mode 100644
index 0000000..ca31d95
--- /dev/null
+++ b/config/locales/zh.yml
@@ -0,0 +1,5 @@
+zh:
+ setting_show_subject_lines: 在右侧显示主题
+ setting_show_assignees: 显示【指派给】列
+ setting_subject_width: 【主题】列宽
+ setting_assignee_width: 【指派给】列宽
diff --git a/lib/progressive/gantt_patch.rb b/lib/progressive/gantt_patch.rb
index 1cadf64..e598854 100644
--- a/lib/progressive/gantt_patch.rb
+++ b/lib/progressive/gantt_patch.rb
@@ -6,43 +6,31 @@ def initialize_with_assignees(options={})
@assignees = ''
end
- def render_issues_with_assignees(issues, options={})
- @issue_ancestors = []
- issues.each do |i|
- subject_for_issue(i, options) unless options[:only] == :lines
- assignee_for_issue(i, options)
- line_for_issue(i, options) unless options[:only] == :subjects
- options[:top] += options[:top_increment]
- @number_of_rows += 1
- break if abort?
+ def render_object_row_with_assignees(object, options)
+ class_name = object.class.name.downcase
+ send("subject_for_#{class_name}", object, options) unless options[:only] == :lines
+ send("assignee_for_#{class_name}", object, options) unless "#{class_name}" != "issue"
+ send("line_for_#{class_name}", object, options) unless options[:only] == :subjects
+ options[:top] += options[:top_increment]
+ @number_of_rows += 1
+ if @max_rows && @number_of_rows >= @max_rows
+ raise MaxLinesLimitReached
end
- options[:indent] -= (options[:indent_increment] * @issue_ancestors.size)
end
def line_for_issue_with_subject(issue, options)
+ # Skip issues that don't have a due_before (due_date or version's due_date)
if issue.is_a?(Issue) && (issue.due_before || options[:show_subject_lines])
- coords = coordinates(issue.start_date, issue.due_before, issue.done_ratio, options[:zoom])
label = "#{issue.status.name} #{issue.done_ratio}%"
- case options[:format]
- when :html
- label += " - #{issue.subject}" if options[:show_subject_lines]
- html_task(options, coords,
- :css => "task " + (issue.leaf? ? 'leaf' : 'parent'),
- :label => label, :issue => issue,
- :markers => !issue.leaf?)
- when :image
- image_task(options, coords, :label => label)
- when :pdf
- pdf_task(options, coords, :label => label)
- end
- else
- ''
+ label += " - #{issue.subject}" if options[:show_subject_lines]
+ markers = !issue.leaf?
+ line(issue.start_date, issue.due_before, issue.done_ratio, markers, label, options, issue)
end
end
- alias_method_chain :initialize, :assignees
- alias_method_chain :render_issues, :assignees
- alias_method_chain :line_for_issue, :subject
+ alias_method_chain :initialize, :assignees
+ alias_method_chain :render_object_row, :assignees
+ alias_method_chain :line_for_issue, :subject
# Renders the subjects of the Gantt chart, the left side.
def assignees(options={})
|