From ef6f239182e5ded2eebfb577ccd54ce9281859d2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 12 Aug 2014 15:02:55 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=86=E7=A6=BB=E5=87=BA=E6=9D=A5=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=A1=A8=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2065147_add_colun_to_course_attachments.rb | 5 ++++ ...0140812065417_update_course_attachments.rb | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 db/migrate/20140812065147_add_colun_to_course_attachments.rb create mode 100644 db/migrate/20140812065417_update_course_attachments.rb diff --git a/db/migrate/20140812065147_add_colun_to_course_attachments.rb b/db/migrate/20140812065147_add_colun_to_course_attachments.rb new file mode 100644 index 000000000..75ea0b757 --- /dev/null +++ b/db/migrate/20140812065147_add_colun_to_course_attachments.rb @@ -0,0 +1,5 @@ +class AddColunToCourseAttachments < ActiveRecord::Migration + def change + add_column :course_attachments, :container_id, :integer, :default => 0 + end +end diff --git a/db/migrate/20140812065417_update_course_attachments.rb b/db/migrate/20140812065417_update_course_attachments.rb new file mode 100644 index 000000000..f14accb48 --- /dev/null +++ b/db/migrate/20140812065417_update_course_attachments.rb @@ -0,0 +1,29 @@ +class UpdateCourseAttachments < ActiveRecord::Migration + def up + attachments = Attachment.where(" container_type = 'Course'") + attachments.each do |attachment| + course_attachment = CourseAttachment.new + course_attachment.container_id = attachment.container_id + course_attachment.filename = attachment.filename + course_attachment.disk_filename = attachment.disk_filename + course_attachment.filesize = attachment.filesize + course_attachment.content_type = attachment.content_type + course_attachment.digest = attachment.digest + course_attachment.downloads = attachment.downloads + course_attachment.author_id = attachment.author_id + course_attachment.created_at = attachment.created_on + course_attachment.description = attachment.description + course_attachment.disk_directory = attachment.disk_directory + course_attachment.attachtype = attachment.attachtype + course_attachment.is_public = attachment.is_public + course_attachment.save(:validate => false) + end + end + + def down + coll = CourseAttachment.all + coll.each do |model| + model.destroy + end + end +end From caed78327a0e3aeb957d40b5fc4d8cb517cfba34 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 13 Aug 2014 11:17:22 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 7 ++-- app/controllers/welcome_controller.rb | 6 ++-- app/helpers/project_score_helper.rb | 28 ++++++++++------ app/helpers/user_score_helper.rb | 42 ++++++++++++++++++++---- app/helpers/welcome_helper.rb | 4 +-- app/models/attachment.rb | 16 +++++++-- app/models/changeset.rb | 11 ++++++- app/models/document.rb | 11 +++++-- app/models/issue.rb | 35 +++++++++++--------- app/models/journal.rb | 10 +++--- app/models/journal_detail.rb | 16 ++++----- app/models/journals_for_message.rb | 13 ++++---- app/models/memo.rb | 1 + app/models/message.rb | 13 ++++---- app/models/praise_tread.rb | 31 ++++++++++++++--- app/models/watcher.rb | 5 ++- app/views/projects/_member_list.html.erb | 2 +- app/views/projects/_project.html.erb | 2 +- app/views/users/_user_score.html.erb | 3 +- db/schema.rb | 9 ++++- 20 files changed, 184 insertions(+), 81 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3f6827159..202a2d513 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -76,6 +76,7 @@ class ProjectsController < ApplicationController # helper :watcherlist helper :words helper :project_score + helper :user_score ### added by william include ActsAsTaggableOn::TagsHelper @@ -111,7 +112,7 @@ class ProjectsController < ApplicationController per_page_option = 10 @projects_all = Project.active.visible. - joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). + joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id"). where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project) @project_count = @projects_all.count @@ -134,7 +135,7 @@ class ProjectsController < ApplicationController @projects = @projects_all.order("created_on desc") @s_type = 0 when '1' - @projects = @projects_all.order("grade desc") + @projects = @projects_all.order("score desc") @s_type = 1 when '2' @projects = @projects_all.order("watchers_count desc") @@ -148,7 +149,7 @@ class ProjectsController < ApplicationController @projects = @projects[@project_pages.offset, @project_pages.per_page] else - @projects = @projects = @projects_all.order("grade desc") + @projects = @projects = @projects_all.order("score desc") @s_type = 1 end @projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 4a0586c95..80b4e3576 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -27,14 +27,14 @@ class WelcomeController < ApplicationController @first_page = FirstPage.where("page_type = 'project'").first #@show_course = @first_page.show_course if @first_page.nil? || @first_page.sort_type.nil? - @projects = find_miracle_project(10, 3,"grade desc") + @projects = find_miracle_project(10, 3,"score desc") else case @first_page.sort_type when 0 @projects = find_miracle_project(10, 3,"created_on desc") #@projects = @projects_all.order("created_on desc") when 1 - @projects = find_miracle_project(10, 3,"grade desc") + @projects = find_miracle_project(10, 3,"score desc") #@projects = @projects_all.order("grade desc") when 2 @projects = find_miracle_project(10, 3,"watchers_count desc") @@ -48,7 +48,7 @@ class WelcomeController < ApplicationController # @projects = @projects[@project_pages.offset, @project_pages.per_page] else - @projects = @projects_all.order("grade desc") + @projects = @projects_all.order("score desc") end end diff --git a/app/helpers/project_score_helper.rb b/app/helpers/project_score_helper.rb index 6cf7e7767..07b0ee921 100644 --- a/app/helpers/project_score_helper.rb +++ b/app/helpers/project_score_helper.rb @@ -65,26 +65,34 @@ module ProjectScoreHelper b_m_num * 2 end - #项目得分 + #计算项目得分 def project_scores project result = (issue_score project) + (news_score project) + (document_score project) + (changesets_score project) + (board_message_score project) - pss = ProjectStatus.where("project_id = '#{project.id}'") + pss = ProjectScore.where("project_id = '#{project.id}'") if pss.nil? || pss.count == 0 - ps = ProjectStatus.new - ps.grade = result + ps = ProjectScore.new + ps.score = result ps.project = project - ps.watchers_count = project.watcher_users.count - ps.changesets_count = project.changesets.count ps.save else ps = pss.first - ps.grade = result - if ps.changesets_count.nil? || ps.changesets_count == "" - ps.changesets_count = project.changesets.count - end + ps.score = result ps.save end result end + #读取项目得分 + def red_project_scores project + grade = 0 + pss = ProjectScore.where("project_id = '#{project.id}'") + if pss.nil? || pss.count == 0 + grade + else + ps = pss.first + grade = ps.score + grade + end + end + end \ No newline at end of file diff --git a/app/helpers/user_score_helper.rb b/app/helpers/user_score_helper.rb index dc43de32a..38f4f91f0 100644 --- a/app/helpers/user_score_helper.rb +++ b/app/helpers/user_score_helper.rb @@ -445,7 +445,7 @@ FROM `users` where id = #{user.id}") def messges_for_issue_num(user,project=nil) if project.nil? - Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count + Journal.includes(:user).where("user_id = '#{user.id}' and notes is not null and notes != ''").all.count else Journal.includes(:user).joins(:issue).where("#{Journal.table_name}.user_id = '#{user.id}' and #{Issue.table_name}.project_id = '#{project.id}' and #{Journal.table_name}.notes != '' and #{Journal.table_name}.notes is not null").all.count end @@ -475,6 +475,16 @@ FROM `users` where id = #{user.id}") end + def issues_status_score(user,project=nil) + if project.nil? + #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_score FROM users WHERE users.id = '#{user.id}'") + else + #Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_score FROM users WHERE users.id = '#{user.id}'") + end + end + #更新对留言的回复数量 def update_replay_for_message(user,type,project=nil) option_number = get_option_number(user,type) @@ -491,6 +501,14 @@ FROM `users` where id = #{user.id}") end + def replay_for_message_score(user,project=nil) + if project.nil? + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project') as m_score FROM users WHERE users.id = '#{user.id}'") + else + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_score FROM users WHERE users.id = '#{user.id}'") + end + end + #更新对帖子的回复数量 def update_replay_for_memo(user,type,project=nil) option_number = get_option_number(user,type) @@ -506,6 +524,14 @@ FROM `users` where id = #{user.id}") end end + def replay_for_memo_score(user,project=nil) + if project.nil? + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id != -1) FROM users WHERE users.id = #{user.id}") + else + User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id = #{project.id}) FROM users WHERE users.id = #{user.id}") + end + end + #更新被关注的人数 def update_follow(user,type) option_number = get_option_number(user,type) @@ -517,6 +543,10 @@ FROM `users` where id = #{user.id}") Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count end + def follow_score(user) + User.find_by_sql("SELECT users.id, (SELECT COUNT(*) * 2 FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = '#{user.id}') FROM users WHERE users.id = '#{user.id}'") + end + #更新帖子踩各项数量 def update_tread(user,type,project=nil) option_number = get_option_number(user,type) @@ -542,7 +572,7 @@ FROM `users` where id = #{user.id}") end target_user = obj.author level = UserLevels.get_level(pt.user)#pt.user.get_level - project = pt.project + #project = pt.project if level == 1 && target_user.id == user.id result << pt elsif level == 2 && target_user.id == user.id @@ -560,7 +590,7 @@ FROM `users` where id = #{user.id}") result2 = [] pts.each do |pt| obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id) - if obj.nil? + if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?) next end if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id) @@ -568,7 +598,7 @@ FROM `users` where id = #{user.id}") end target_user = obj.author level = UserLevels.get_level(pt.user)#pt.user.get_level - project = pt.project + #project = pt.project if level == 1 && target_user.id == user.id result << pt elsif level == 2 && target_user.id == user.id @@ -600,7 +630,7 @@ FROM `users` where id = #{user.id}") result2 = [] pts.each do |pt| obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id) - if obj.nil? + if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?) next end if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id) @@ -608,7 +638,7 @@ FROM `users` where id = #{user.id}") end target_user = obj.author level = UserLevels.get_level(pt.user)#pt.user.get_level - project = pt.project + #project = pt.project if level == 1 && target_user.id == user.id result << pt elsif level == 2 && target_user.id == user.id diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 8ee7f42d8..f538657b1 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -428,13 +428,13 @@ module WelcomeHelper resultSet.take(limit) end - def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15 + def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15 # Project.find_by_sql(" # SELECT p.id, p.name, p.description, p.identifier, t.project_id # FROM projects AS p LEFT OUTER JOIN ( # SELECT project_id,grade FROM project_statuses # WHERE project_type = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ") - Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all + Project.visible.joins(:project_status).joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all end def sort_bid_by_hot_rails reward_type, limit = 10 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 67e46eb5e..bcd8852f5 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -26,6 +26,8 @@ class Attachment < ActiveRecord::Base belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" + include UserScoreHelper + validates_presence_of :filename, :author validates_length_of :filename, :maximum => 255 validates_length_of :disk_filename, :maximum => 255 @@ -68,8 +70,9 @@ class Attachment < ActiveRecord::Base @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") before_save :files_to_final_location - before_save :be_user_score # user_score - after_destroy :delete_from_disk + after_create :be_user_score # user_score + after_update :be_user_score + after_destroy :delete_from_disk,:down_user_score # add by nwb # 获取所有可公开的资源文件列表 @@ -504,9 +507,16 @@ class Attachment < ActiveRecord::Base type = self.container_type types = %w|Document News Version Project Issue Message WikiPage| if types.include?(type) - UserScore.project(:push_file, User.current,self, { attachment_id: self.id }) + #UserScore.project(:push_file, self.author,self, { attachment_id: self.id }) + end end + update_attachment(self.author,1) + end + + #删除附件时重新统计用户的附件数量得分 + def down_user_score + update_attachment(self.author,1) end end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index a56dee691..38bdd0cc8 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -18,7 +18,7 @@ class Changeset < ActiveRecord::Base belongs_to :repository belongs_to :user - + include UserScoreHelper #after_save :be_user_score # user_score has_many :filechanges, :class_name => 'Change', :dependent => :delete_all @@ -64,6 +64,8 @@ class Changeset < ActiveRecord::Base } after_create :scan_for_issues,:be_user_score # user_score + after_update :be_user_score + after_destroy :down_user_score before_create :before_create_cs # fq @@ -305,6 +307,13 @@ class Changeset < ActiveRecord::Base UserScore.project(:push_code, self.user,self, { changeset_id: self.id }) #更新用户等级 UserLevels.update_user_level(self.user) + update_changeset(self.user,1) + end + + #积分刷新 + def down_user_score + UserLevels.update_user_level(self.user) + update_changeset(self.user,1) end end diff --git a/app/models/document.rb b/app/models/document.rb index 1467903b0..42692bc22 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -20,9 +20,9 @@ class Document < ActiveRecord::Base belongs_to :project belongs_to :user belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" - - after_create :be_user_score # user_score - + include UserScoreHelper + after_save :be_user_score # user_score + after_destroy :down_user_score acts_as_attachable :delete_permission => :delete_documents @@ -68,5 +68,10 @@ class Document < ActiveRecord::Base # update user score def be_user_score UserScore.project(:push_document, self.user,self,{ document_id: self.id }) + update_document(self.user,1) + end + + def down_user_score + update_document(self.user,1) end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 1978f5405..64632b77d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -79,7 +79,7 @@ class Issue < ActiveRecord::Base # fq after_create :act_as_activity,:be_user_score_new_issue after_update :be_user_score - before_destroy :down_user_score + after_destroy :down_user_score # after_create :be_user_score # end @@ -1508,35 +1508,38 @@ class Issue < ActiveRecord::Base def be_user_score #缺陷完成度更新 if self.done_ratio_changed? - UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id }) - #update_issue_done_ratio(User.current,1) + UserScore.project(:update_issue_ratio, self.author,self,{ issue_id: self.id }) + #update_issue_done_ratio(self.author,1) end #缺陷状态更改 if self.status_id_changed? - #协同得分 - UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id}) - #update_issues_status(self.author , 1) + #协同得分 + UserScore.joint(:change_issue_status, self.author,nil,self, {issue_id: self.id}) + #update_issues_status(self.author , 1) end end #发布缺陷 def be_user_score_new_issue - UserScore.project(:post_issue, User.current,self, { issue_id: self.id }) + UserScore.project(:post_issue, self.author,self, { issue_id: self.id }) update_post_issue(self.author,1) end def down_user_score #缺陷完成度更新 - if self.done_ratio_changed? - UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id }) - #update_issue_done_ratio(User.current,1) - end + #if self.done_ratio_changed? + # UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id }) + # update_issue_done_ratio(User.current,1) + #end #缺陷状态更改 - if self.status_id_changed? - #协同得分 - UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id}) - #update_issues_status(self.author , 1) - end + #if self.status_id_changed? + # #协同得分 + # UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id}) + # update_issues_status(self.author , 1) + #end + update_post_issue(self.author,1) + update_issue_done_ratio(User.current,1) + update_issues_status(self.author , 1) end diff --git a/app/models/journal.rb b/app/models/journal.rb index c08d8d630..0fe2b804b 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -46,11 +46,11 @@ class Journal < ActiveRecord::Base before_create :split_private_notes # fq - after_create :act_as_activity,:be_user_score + after_save :act_as_activity,:be_user_score # end #after_destroy :down_user_score #before_save :be_user_score - before_destroy :down_user_score + after_destroy :down_user_score scope :visible, lambda {|*args| user = args.shift || User.current @@ -162,8 +162,9 @@ class Journal < ActiveRecord::Base if !self.notes.nil? && self.notes.gsub(' ','') != '' #协同得分加分 UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id }) + update_messges_for_issue(self.user,1) end - #update_messges_for_issue(User.current,1) + end # 减少用户分数 -by zjc def down_user_score @@ -171,7 +172,8 @@ class Journal < ActiveRecord::Base if !self.notes.nil? && self.notes.gsub(' ','') != '' #协同得分减分 UserScore.joint(:delete_issue_message, self.user,self.issue.author,self, { message_id: self.id }) + update_messges_for_issue(self.user,1) end - #update_messges_for_issue(User.current,1) + end end diff --git a/app/models/journal_detail.rb b/app/models/journal_detail.rb index c2b0aaa2a..82a63b028 100644 --- a/app/models/journal_detail.rb +++ b/app/models/journal_detail.rb @@ -19,9 +19,9 @@ class JournalDetail < ActiveRecord::Base include UserScoreHelper belongs_to :journal before_save :normalize_values - after_create :be_user_score - #after_destroy :down_user_score - before_destroy :down_user_score + after_save :be_user_score + after_destroy :down_user_score + #before_destroy :down_user_score private def normalize_values @@ -45,23 +45,21 @@ class JournalDetail < ActiveRecord::Base def be_user_score #更新缺陷完成度 if self.prop_key == 'done_ratio' - #update_issue_done_ratio(User.current,1) + update_issue_done_ratio(self.journal.user,1) #更新缺陷状态 elsif self.prop_key == 'status_id' - #update_issues_status(User.current , 1) + update_issues_status(self.journal.user , 1) end end #更新用户分数 def down_user_score - #update_issue_done_ratio(User.current,1) - #update_issues_status(User.current , 1) if self.prop_key == 'done_ratio' - + update_issue_done_ratio(self.journal.user,1) #更新缺陷状态 elsif self.prop_key == 'status_id' - UserScore.joint(:delete_issue_status, self.journal.user,nil,self, {issue_id: self.id}) + update_issues_status(self.journal.user, 1) end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index c79004794..dd687f263 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -54,10 +54,10 @@ class JournalsForMessage < ActiveRecord::Base validates :notes, presence: true after_create :act_as_activity #huang - after_create :reset_counters!,:be_user_score + after_create :reset_counters! after_destroy :reset_counters! - #before_save :be_user_score - #before_destroy :down_user_score + after_save :be_user_score + after_destroy :down_user_score # default_scope { where('m_parent_id IS NULL') } @@ -142,8 +142,8 @@ class JournalsForMessage < ActiveRecord::Base #新建了留言回复 if self.reply_id != 0 #协同得分加分 - UserScore.joint(:reply_message, User.current,User.find(self.reply_id),self, { journals_for_messages_id: self.id }) - update_replay_for_message(User.current,1) + UserScore.joint(:reply_message, self.user,User.find(self.reply_id),self, { journals_for_messages_id: self.id }) + update_replay_for_message(self.user,1) end end # 更新用户分数 -by zjc @@ -151,7 +151,8 @@ class JournalsForMessage < ActiveRecord::Base #删除了留言回复 if self.reply_id != 0 #协同得分减分 - UserScore.joint(:reply_message_delete, User.current,User.find(self.reply_id), { journals_for_messages_id: self.id }) + UserScore.joint(:reply_message_delete, self.user,User.find(self.reply_id), { journals_for_messages_id: self.id }) + update_replay_for_message(self.user,1) end end end diff --git a/app/models/memo.rb b/app/models/memo.rb index 1d191e39d..5a909f782 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -14,6 +14,7 @@ class Memo < ActiveRecord::Base acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC" acts_as_attachable has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj + has_many :praise_tread, as: :praise_tread_object, dependent: :destroy belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id' # acts_as_searchable :column => ['subject', 'content'], # #:include => { :forum => :p} diff --git a/app/models/message.rb b/app/models/message.rb index a57797af1..647a665dc 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -21,6 +21,8 @@ class Message < ActiveRecord::Base belongs_to :board belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' + has_many :praise_tread, as: :praise_tread_object, dependent: :destroy + acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC" acts_as_attachable belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id' @@ -59,12 +61,11 @@ class Message < ActiveRecord::Base after_create :add_author_as_watcher, :reset_counters! after_update :update_messages_board - after_destroy :reset_counters!#,:down_user_score + after_destroy :reset_counters!,:down_user_score # fq after_create :act_as_activity,:be_user_score #before_save :be_user_score - before_destroy :down_user_score # end scope :visible, lambda {|*args| @@ -151,11 +152,11 @@ class Message < ActiveRecord::Base #新建message且无parent的为发帖 if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id }) - #update_memo_number(User.current,1) + update_memo_number(User.current,1) #新建message且有parent的为回帖 elsif !self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:reply_posting, self.author,self.parent.author,self, { message_id: self.id }) - #update_replay_for_memo(User.current,1) + update_replay_for_memo(User.current,1) end end @@ -163,10 +164,10 @@ class Message < ActiveRecord::Base def down_user_score if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) + update_memo_number(User.current,1) elsif !self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:reply_deleting, self.author,self.parent.author,self, { message_id: self.id }) + update_replay_for_memo(User.current,1) end - #update_memo_number(User.current,1) - #update_replay_for_memo(User.current,1) end end diff --git a/app/models/praise_tread.rb b/app/models/praise_tread.rb index 98253d837..0a7282d26 100644 --- a/app/models/praise_tread.rb +++ b/app/models/praise_tread.rb @@ -3,7 +3,8 @@ class PraiseTread < ActiveRecord::Base belongs_to :user belongs_to :praise_tread_object, polymorphic: true after_create :be_user_score - + after_destroy :down_user_score + include UserScoreHelper def self.find_object_by_type_and_id(type,id) @obj = nil case type @@ -28,7 +29,7 @@ class PraiseTread < ActiveRecord::Base # 获取裁定对象为Message时Message所属的项目或课程 def project project = nil - if self.praise_tread_object_type == 'Message' + if self.praise_tread_object_type == 'Message' || self.praise_tread_object_type == 'Issues' obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id) project = obj.project end @@ -38,15 +39,37 @@ class PraiseTread < ActiveRecord::Base #更新用户分数 - by zjc def be_user_score #踩贴吧或讨论区帖子 - if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message') + if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message') obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id) target_user = obj.author UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id }) + update_tread(User.current,1) + update_tread(target_user,1) #顶贴吧或讨论区帖子 - elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message') + elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message') obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id) target_user = obj.author UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id }) + update_praise(target_user,1) + #更新用户等级 + UserLevels.update_user_level(target_user) + end + end + + def down_user_score + #踩贴吧或讨论区帖子 + if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message') + obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id) + target_user = obj.author + #UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id }) + update_tread(User.current,1) + update_tread(target_user,1) + #顶贴吧或讨论区帖子 + elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message') + obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id) + target_user = obj.author + #UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id }) + update_praise(target_user,1) #更新用户等级 UserLevels.update_user_level(target_user) end diff --git a/app/models/watcher.rb b/app/models/watcher.rb index e2e255a1e..420bd0d84 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Watcher < ActiveRecord::Base + include UserScoreHelper belongs_to :watchable, :polymorphic => true belongs_to :user #Added by nie @@ -23,7 +24,7 @@ class Watcher < ActiveRecord::Base has_one :users_status #end after_create :be_user_score - before_destroy :down_user_score + after_destroy :down_user_score validates_presence_of :user validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] @@ -79,6 +80,7 @@ class Watcher < ActiveRecord::Base if self.watchable_type == 'Principal' #影响力得分 UserScore.influence(:followed_by, self.user,self.watchable,self, { watcher_id: self.id }) + update_follow(self.watchable,1) end end @@ -87,6 +89,7 @@ class Watcher < ActiveRecord::Base #取消关注 if self.watchable_type == 'Principal' UserScore.influence(:cancel_followed, self.user,self.watchable,self, { watcher_id: self.id }) + update_follow(self.watchable,1) end end diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb index cdf6c459d..15a02df93 100644 --- a/app/views/projects/_member_list.html.erb +++ b/app/views/projects/_member_list.html.erb @@ -23,7 +23,7 @@ <% else%> <%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
-

+

<%= l(:label_user_for_project_grade) %>: <%= format("%.2f" ,UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i %>

diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index e9a733ece..3d7cdfb6c 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -128,7 +128,7 @@ <% if @project.project_type !=1 %> <%= l(:label_project_grade)%>: - <%= link_to(format("%.2f" , project_scores(@project) ).to_i, + <%= link_to(format("%.2f" , red_project_scores(@project) ).to_i, {:controller => 'projects', :action => 'show_projects_score', :remote => true, :id => @project.id}, :style=>"color: #EC6300;") %> diff --git a/app/views/users/_user_score.html.erb b/app/views/users/_user_score.html.erb index 338d72ada..e9334a047 100644 --- a/app/views/users/_user_score.html.erb +++ b/app/views/users/_user_score.html.erb @@ -1,6 +1,7 @@ <%= l(:label_user_grade)%>: -<%= link_to(format("%.2f" ,user_scores(user,1).total_score ).to_i, {:controller => 'users', + +<%= link_to(format("%.2f" ,get_option_number(user,1).total_score ).to_i, {:controller => 'users', :action => 'show_new_score', :remote => true, :id => user.id diff --git a/db/schema.rb b/db/schema.rb index 292ca9d05..7a921754a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140801034242) do +ActiveRecord::Schema.define(:version => 20140811022947) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -772,6 +772,13 @@ ActiveRecord::Schema.define(:version => 20140801034242) do t.datetime "updated_at", :null => false end + create_table "project_scores", :force => true do |t| + t.string "project_id" + t.integer "score" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "project_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" From 582ccd2ecf282a819b247db6946351a6fddb63cc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 13 Aug 2014 14:45:10 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0wiki=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=A8=A1=E5=9D=97=E5=9B=9E=E5=8E=BB=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 44 ++++++++++++++++++++++- app/helpers/wiki_helper.rb | 10 ++++++ app/views/messages/_project_show.html.erb | 4 +-- app/views/wiki/_content.html.erb | 2 +- db/schema.rb | 7 ++-- 5 files changed, 60 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b1006d239..23f6b6994 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -685,7 +685,7 @@ module ApplicationHelper when 2 obj = args.shift attr = args.shift - text = obj.send(attr).to_s + text = obj.send(attr).html_safe.to_s else raise ArgumentError, 'invalid arguments to textilizable' end @@ -716,6 +716,48 @@ module ApplicationHelper text.html_safe end + # + #格式化字符串,不转义html代码 + def textAreailizable(*args) + options = args.last.is_a?(Hash) ? args.pop : {} + case args.size + when 1 + obj = options[:object] + text = args.shift + when 2 + obj = args.shift + attr = args.shift + text = obj.send(attr).html_safe.to_s + else + raise ArgumentError, 'invalid arguments to textilizable' + end + return '' if text.blank? + project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) + only_path = options.delete(:only_path) == false ? false : true + + text = text.dup + macros = catch_macros(text) + text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr) + + @parsed_headings = [] + @heading_anchors = {} + @current_section = 0 if options[:edit_section_links] + + parse_sections(text, project, obj, attr, only_path, options) + text = parse_non_pre_blocks(text, obj, macros) do |text| + [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name| + send method_name, text, project, obj, attr, only_path, options + end + end + parse_headings(text, project, obj, attr, only_path, options) + + if @parsed_headings.any? + replace_toc(text, @parsed_headings) + end + + text.html_safe + end + def parse_non_pre_blocks(text, obj, macros) s = StringScanner.new(text) tags = [] diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index c6cb3b39d..8278ce035 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -40,4 +40,14 @@ module WikiHelper link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil}) }) end + + def wiki_content_format wiki + text = wiki.text.html_safe + text = parse_non_pre_blocks(text, wiki, text) do |text| + [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name| + send method_name, text, project, wiki, attr, only_path, options + end + end + text + end end diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 66027e6ec..0bae1a761 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -161,8 +161,8 @@
- <%#= textilizable message,:content,:attachments => message.attachments %> - <%= message.content.html_safe %> + <%= textAreailizable message,:content,:attachments => message.attachments %> + <%#= message.content.html_safe %>
<%= link_to_attachments message, :author => false %> diff --git a/app/views/wiki/_content.html.erb b/app/views/wiki/_content.html.erb index fcfcc1351..96d358381 100644 --- a/app/views/wiki/_content.html.erb +++ b/app/views/wiki/_content.html.erb @@ -1,5 +1,5 @@
- <%= textilizable content, :text, :attachments => content.page.attachments, + <%= textAreailizable content, :text, :attachments => content.page.attachments, :edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %> <%#= content.text.html_safe %>
diff --git a/db/schema.rb b/db/schema.rb index f087206ee..d90541472 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140812032957) do +ActiveRecord::Schema.define(:version => 20140812065417) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -304,8 +304,9 @@ ActiveRecord::Schema.define(:version => 20140812032957) do t.string "disk_directory" t.integer "attachtype" t.integer "is_public" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "container_id", :default => 0 end create_table "course_infos", :force => true do |t| From 0e35967433e913646a0ea8e61312fbe5df1086f1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 13 Aug 2014 15:19:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9wiki=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=88=9D=E5=A7=8B=E5=8C=96=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/wiki/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 35f905eef..3a1abdd83 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -16,7 +16,7 @@

<%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %>

From 4934c8c801051e2b3bdfd91be65adea47f20094c Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 13 Aug 2014 15:37:28 +0800 Subject: [PATCH 5/7] =?UTF-8?q?#=20=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stores_controller.rb | 6 +++++ app/models/issue.rb | 13 ++++----- app/views/stores/index.html.erb | 4 +-- app/views/welcome/contest.html.erb | 40 ++++++++++++++-------------- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index ae9336161..26ed51a59 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -5,12 +5,18 @@ class StoresController < ApplicationController layout 'base_stores' def search + begin q = "%#{params[:name].strip}%" (redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank? result = find_public_attache q @searched_attach = paginateHelper result @result_all_count = result.count; + rescue Exception => e + #render 'stores' + redirect_to stores_path + end + end def find_public_attache keywords diff --git a/app/models/issue.rb b/app/models/issue.rb index 1978f5405..f81665035 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -138,10 +138,10 @@ class Issue < ActiveRecord::Base nil when 'default' user_ids = [user.id] + user.groups.map(&:id) - "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" + "(#{table_name}.is_private = #{connection.quoted_false}) OR (#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" when 'own' user_ids = [user.id] + user.groups.map(&:id) - "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" + "(#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" else '1=0' end @@ -159,9 +159,9 @@ class Issue < ActiveRecord::Base when 'all' true when 'default' - !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to)) - when 'own' - self.author == user || user.is_or_belongs_to?(assigned_to) + (!self.is_private? ||self.tracker == user) || (self.author == user || user.is_or_belongs_to?(assigned_to)) + when 'own' + self.tracker == user || self.author == user || user.is_or_belongs_to?(assigned_to) else false end @@ -1009,9 +1009,10 @@ class Issue < ActiveRecord::Base s << ' overdue' if overdue? s << ' child' if child? s << ' parent' unless leaf? - s << ' private' if is_private? + #s << ' private' if is_private? s << ' created-by-me' if User.current.logged? && author_id == User.current.id s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id + s << ' tracker-id' if User.current.logged? && tracker_id == User.current.id s end diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 8ad37f504..6984169d7 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -21,7 +21,7 @@ <% k.each do |c1|%>
- <%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> + <%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
<%= c1.downloads %> @@ -32,7 +32,7 @@
<% end -%>
- + <% end; reset_cycle %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index f2140fd9b..d735e1013 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -14,7 +14,7 @@ $('#' + id).val(''); } } - + $(function(){ $("#main").find("a").attr("target", "_blank"); setCss(); @@ -118,23 +118,23 @@ +
- +
<% if get_avatar?(@contest_page) %> <%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %> <% else %> <%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %> <% end %> -
+
<% unless @contest_page.nil? %> <%= @contest_page.title %> , <%= @contest_page.description %> <% end %>
- +
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %> <%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%> @@ -162,7 +162,7 @@
<%= image_tag('/images/contest1.png')%>
- +
<%= link_to(contest.name, contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> @@ -172,19 +172,19 @@ (<%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %>) <% end %>
- +
<%=contest.description.truncate(100, omission: '...')%>

- +
- + <%=l(:label_release_time)%>: <%=format_time contest.created_on %>
- + - <% end; reset_cycle %> - + <% end; reset_cycle %> +
@@ -299,31 +299,31 @@ <% if Softapplication.count > 0%>
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %> - +
  • <%= image_tag('/images/app1.png')%>
    - +
    <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
    - +
    ><%=softapplication.description.to_s.truncate(50, omission: '...')%>

    - +
    <%=l(:label_release_time)%>: <%=format_time softapplication.created_at %>
    - +
  • - <% end; reset_cycle %> - + <% end; reset_cycle %> +
    <% else %>

    <%= l(:label_no_ftapplication) %>

    - + <% end %> From ce7d91d164d8d0ac1dc28e69313209ddb11ebd02 Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 13 Aug 2014 16:29:26 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=20#932=20=E8=BE=93=E5=85=A5=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E4=B8=BA=E9=9D=9E=E6=B1=89=E5=AD=97=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=94=E5=AD=97=E6=95=B0=E8=BE=83=E5=A4=9A=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86Bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/issues_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 5e7f7c18c..315a86340 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -73,7 +73,7 @@ module IssuesHelper ancestors.each do |ancestor| s << '
    ' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id))) end - s << '
    ' + s << '
    ' subject = h(issue.subject) if issue.is_private? subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject From bc6ad5d4163175a5d283fa4ccaeb5637b0826ebd Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 13 Aug 2014 16:45:50 +0800 Subject: [PATCH 7/7] =?UTF-8?q?#936=20=E8=BE=93=E5=85=A5=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=9D=9E=E6=B1=89=E6=97=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/documents/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 2964a06ba..45f54ad9b 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -9,7 +9,7 @@ <% end %>
    -

    <%=h @document.title %>

    +

    <%=h @document.title %>

    <%#=h @document.category.name %>
    <%= format_date @document.created_on %>