Commit 20b4e226 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Performance improvement on calendar and gantt (about 45% on gantt for large number of issues).

Partial issues/_tooltip is replaced by an helper and some translated strings are now cached.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@794 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent c3e3a189
...@@ -34,6 +34,7 @@ class ProjectsController < ApplicationController ...@@ -34,6 +34,7 @@ class ProjectsController < ApplicationController
include CustomFieldsHelper include CustomFieldsHelper
helper :ifpdf helper :ifpdf
include IfpdfHelper include IfpdfHelper
helper :issues
helper IssuesHelper helper IssuesHelper
helper :queries helper :queries
include QueriesHelper include QueriesHelper
......
...@@ -21,6 +21,7 @@ class TimelogController < ApplicationController ...@@ -21,6 +21,7 @@ class TimelogController < ApplicationController
helper :sort helper :sort
include SortHelper include SortHelper
helper :issues
def report def report
@available_criterias = { 'version' => {:sql => "#{Issue.table_name}.fixed_version_id", @available_criterias = { 'version' => {:sql => "#{Issue.table_name}.fixed_version_id",
......
...@@ -70,8 +70,8 @@ module ApplicationHelper ...@@ -70,8 +70,8 @@ module ApplicationHelper
def format_date(date) def format_date(date)
return nil unless date return nil unless date
@date_format_setting ||= Setting.date_format.to_i @date_format ||= (Setting.date_format.to_i == 0 ? l(:general_fmt_date) : date.strftime("%Y-%m-%d"))
@date_format_setting == 0 ? l_date(date) : date.strftime("%Y-%m-%d") date.strftime(@date_format)
end end
def format_time(time) def format_time(time)
......
...@@ -17,6 +17,19 @@ ...@@ -17,6 +17,19 @@
module IssuesHelper module IssuesHelper
def render_issue_tooltip(issue)
@cached_label_start_date ||= l(:field_start_date)
@cached_label_due_date ||= l(:field_due_date)
@cached_label_assigned_to ||= l(:field_assigned_to)
@cached_label_priority ||= l(:field_priority)
link_to_issue(issue) + ": #{h(issue.subject)}<br /><br />" +
"<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
"<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />" +
"<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
"<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
end
def show_detail(detail, no_html=false) def show_detail(detail, no_html=false)
case detail.property case detail.property
when 'attr' when 'attr'
......
<%= link_to_issue issue %></strong>: <%=h issue.subject %><br />
<br />
<strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br />
<strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br />
<strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br />
<strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %>
...@@ -49,7 +49,7 @@ while day <= @date_to ...@@ -49,7 +49,7 @@ while day <= @date_to
<%= h(truncate(i.subject, 30)) %> <%= h(truncate(i.subject, 30)) %>
</small> </small>
<span class="tip"> <span class="tip">
<%= render :partial => "issues/tooltip", :locals => { :issue => i }%> <%= render_issue_tooltip i %>
</span> </span>
</div> </div>
<% else %> <% else %>
......
...@@ -192,7 +192,7 @@ top = headers_height + 10 ...@@ -192,7 +192,7 @@ top = headers_height + 10
<% # === tooltip === %> <% # === tooltip === %>
<div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;"> <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
<span class="tip"> <span class="tip">
<%= render :partial => "issues/tooltip", :locals => { :issue => i }%> <%= render_issue_tooltip i %>
</span></div> </span></div>
<% else <% else
i_left = ((i.start_date - @date_from)*zoom).floor i_left = ((i.start_date - @date_from)*zoom).floor
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
<td align="center"> <td align="center">
<% if entry.issue %> <% if entry.issue %>
<div class="tooltip"> <div class="tooltip">
<%= link_to "#{entry.issue.tracker.name} ##{entry.issue.id}", {:action => 'details', :issue_id => entry.issue } %> <%= link_to_issue entry.issue %>
<span class="tip"> <span class="tip">
<%= render :partial => "issues/tooltip", :locals => { :issue => entry.issue }%> <%= render_issue_tooltip entry.issue %>
</span> </span>
</div> </div>
<% end %> <% end %>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment