From eb15edd5ffd293a989dbeca3a530e8de26c2e452 Mon Sep 17 00:00:00 2001 From: nwb Date: Sat, 5 Jul 2014 13:31:32 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E6=96=87=E6=A1=A3=202.?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E4=B8=AD=E7=BC=BA=E9=99=B7=E5=BA=8F=E5=8F=B7?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=9C=BA=E5=88=B6=E4=BC=98=E5=8C=96=202.?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 20 +- app/models/mailer.rb | 5 +- app/models/project.rb | 2 +- app/views/courses/show.html.erb | 2 +- app/views/mailer/_issue.html.erb | 2 +- app/views/mailer/_issue.text.erb | 2 +- app/views/mailer/issue_add.html.erb | 2 +- app/views/mailer/issue_add.text.erb | 2 +- app/views/projects/show.html.erb | 2 +- ...mine_代码评审插件管理员手册.pdf | 3648 +++++++++++++++++ 10 files changed, 3671 insertions(+), 16 deletions(-) create mode 100644 doc/Redmine_代码评审插件管理员手册.pdf diff --git a/app/models/issue.rb b/app/models/issue.rb index 3cd67d017..f8837cb6e 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 @@ -1160,9 +1156,19 @@ class Issue < ActiveRecord::Base "" << self.project.name.to_s << "#" << project_index 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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 09db4de97..25d592a24 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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. diff --git a/app/models/project.rb b/app/models/project.rb index f38ad0dd0..5efaf10ab 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 59d6720c7..396082854 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -84,7 +84,7 @@ ! - <%= l :label_update_time %> + <%= l :label_create_time %> : <%= format_time(@course.created_at) %> diff --git a/app/views/mailer/_issue.html.erb b/app/views/mailer/_issue.html.erb index 3d851d442..f0dc88d8b 100644 --- a/app/views/mailer/_issue.html.erb +++ b/app/views/mailer/_issue.html.erb @@ -1,4 +1,4 @@ -

<%= link_to(h("#{issue.tracker.name} ##{issue.id}: #{issue.subject}"), issue_url) %>

+

<%= link_to(h("#{issue.tracker.name} ##{issue.project_index}: #{issue.subject}"), issue_url) %>