1.添加文档

2.邮件中缺陷序号计算机制优化
2.项目、课程动态优化
This commit is contained in:
nwb 2014-07-05 13:31:32 +08:00
parent c927bb6fd6
commit eb15edd5ff
10 changed files with 3671 additions and 16 deletions

View File

@ -990,13 +990,9 @@ class Issue < ActiveRecord::Base
end
def to_s
"#{tracker} ##{id}: #{subject}"
"#{tracker} ##{project_index}: #{subject}"
end
# 缺陷在项目中的序号
def inProjectIndex
(self.project.issues.index(self).to_i + 1).to_s
end
# Returns a string of css classes that apply to the issue
def css_classes
@ -1162,7 +1158,17 @@ class Issue < ActiveRecord::Base
end
def project_index
(self.project.issues.index(self).to_i + 1).to_s
if self.project.issues.include?(self)
(self.project.issues.index(self).to_i + 1).to_s
else
issue_index = 1
self.project.issues.each do |issue|
if self.id > issue.id
++issue_index
end
end
issue_index.to_s
end
end
private

View File

@ -96,8 +96,9 @@ class Mailer < ActionMailer::Base
# issue_add(issue) => Mail::Message object
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue)
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
'Issue-Id' => issue_id,
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@ -108,7 +109,7 @@ class Mailer < ActionMailer::Base
cc = issue.watcher_recipients - recipients
mail :to => recipients,
:cc => cc,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
end
# Builds a Mail::Message object used to email recipients of the edited issue.

View File

@ -41,7 +41,7 @@ class Project < ActiveRecord::Base
has_many :principals, :through => :member_principals, :source => :principal
has_many :enabled_modules, :dependent => :delete_all
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
has_many :issues, :dependent => :destroy, :include => [:status, :tracker]
has_many :issues, :dependent => :destroy, :include => [:status, :tracker] , :order => "id ASC"
has_many :issue_changes, :through => :issues, :source => :journals
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
has_many :time_entries, :dependent => :delete_all

View File

@ -84,7 +84,7 @@
<strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= l :label_update_time %>
<td class="font_lighter" style="float: right"><%= l :label_create_time %>
: <%= format_time(@course.created_at) %>
</table>
</td>

View File

@ -1,4 +1,4 @@
<h1><%= link_to(h("#{issue.tracker.name} ##{issue.id}: #{issue.subject}"), issue_url) %></h1>
<h1><%= link_to(h("#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}"), issue_url) %></h1>
<ul>
<li><%=l(:field_author)%>: <%=h issue.author %></li>

View File

@ -1,4 +1,4 @@
<%= "#{issue.tracker.name} ##{issue.id}: #{issue.subject}" %>
<%= "#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}" %>
<%= issue_url %>
* <%=l(:field_author)%>: <%= issue.author %>

View File

@ -1,3 +1,3 @@
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => h(@issue.author)) %>
<%= l(:text_issue_added, :id => "##{@issue.project_index}", :author => h(@issue.author)) %>
<hr />
<%= render :partial => 'issue', :formats => [:html], :locals => { :issue => @issue, :issue_url => @issue_url } %>

View File

@ -1,4 +1,4 @@
<%= l(:text_issue_added, :id => "##{@issue.id}", :author => @issue.author) %>
<%= l(:text_issue_added, :id => "##{@issue.project_index}", :author => @issue.author) %>
----------------------------------------
<%= render :partial => 'issue', :formats => [:text], :locals => { :issue => @issue, :issue_url => @issue_url } %>

View File

@ -75,7 +75,7 @@
<%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
</tr>
<tr>
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>
<td class="font_lighter" style="float: right"><%= l :label_create_time %>: <%= format_time(@project.created_on) %>
</table></td>
</tr>
</table>

File diff suppressed because one or more lines are too long