issues to_param

This commit is contained in:
yanxd 2014-03-24 16:42:43 +08:00
parent 8bb4d44cbe
commit 163cdc8cf7
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ class Issue < ActiveRecord::Base
# sort by id so that limited eager loading doesn't break with postgresql # sort by id so that limited eager loading doesn't break with postgresql
:order_column => "#{table_name}.id" :order_column => "#{table_name}.id"
acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"}, acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"},
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o}},
:type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') } :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]},
@ -217,7 +217,7 @@ class Issue < ActiveRecord::Base
end end
def to_param def to_param
@to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self)}|#{self.project.issues.count})"#.parameterize @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self)+1}-#{self.project.issues.count})"#.parameterize
end end
# Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields

View File

@ -9,14 +9,14 @@
<div class="next-prev-links contextual"> <div class="next-prev-links contextual">
<%= link_to_if @prev_issue_id, <%= link_to_if @prev_issue_id,
"\xc2\xab #{l(:label_previous)}", "\xc2\xab #{l(:label_previous)}",
(@prev_issue_id ? issue_path(@prev_issue_id) : nil), (@prev_issue_id ? issue_path(Issue.find_by_id(@prev_issue_id)) : nil),
:title => "##{@prev_issue_id}" %> | :title => "##{@prev_issue_id}" %> |
<% if @issue_position && @issue_count %> <% if @issue_position && @issue_count %>
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> | <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
<% end %> <% end %>
<%= link_to_if @next_issue_id, <%= link_to_if @next_issue_id,
"#{l(:label_next)} \xc2\xbb", "#{l(:label_next)} \xc2\xbb",
(@next_issue_id ? issue_path(@next_issue_id) : nil), (@next_issue_id ? issue_path(Issue.find_by_id(@next_issue_id)) : nil),
:title => "##{@next_issue_id}" %> :title => "##{@next_issue_id}" %>
</div> </div>
<% end %> <% end %>