From a451680cf854feca2df9b2fe32c53a89c0c8f569 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 24 Feb 2016 17:09:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=AE=B0=E5=BD=95=E6=94=BE=E5=9C=A8=E8=A1=A8?= =?UTF-8?q?forwards=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fb35d8495..654703bd6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1591,7 +1591,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end @save_message = attach_copied_obj.errors.full_messages end end @@ -1627,7 +1629,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 4 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end @save_message = attach_copied_obj.errors.full_messages end end @@ -1685,7 +1689,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end unless Project.find(project_id).project_score.nil? Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) @@ -1724,7 +1730,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end unless Project.find(project_id).project_score.nil? Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) end @@ -1781,7 +1789,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end end end elsif params[:send_ids].present? @@ -1815,7 +1825,9 @@ class UsersController < ApplicationController if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end - attach_copied_obj.save + if attach_copied_obj.save + ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + end end end else From 991613d7604a2036698d1d63fc242272ea1b8485 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 25 Feb 2016 16:22:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=9C=A8=E8=BD=AC=E5=8F=91=E8=A1=A8forward?= =?UTF-8?q?s=E8=AE=B0=E5=BD=95=E5=8F=91=E9=80=81=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E3=80=81=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 24 ++++++++++++++++++++++++ app/models/attachment.rb | 2 +- app/models/message.rb | 2 ++ app/models/news.rb | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 654703bd6..a1dc443e0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1856,6 +1856,10 @@ class UsersController < ApplicationController course_ids.each do |course_id| if Course.find(course_id).news.map(&:id).exclude?(news.id) course_news = News.create(:course_id => course_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + #record forward to table forwards if new record is valid + if course_news.valid? + news.forwards << Forward.new(:to_type => course_news.class.name, :to_id => course_news.id) + end news.attachments.each do |attach| course_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, @@ -1872,6 +1876,10 @@ class UsersController < ApplicationController project = Project.find(project_id) if project.news.map(&:id).exclude?(news.id) message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id) + # record forward to table forwards if new record is valid + if message.valid? + news.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id) + end news.attachments.each do |attach| message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, @@ -1885,6 +1893,10 @@ class UsersController < ApplicationController news = News.find(params[:send_id]) field_id = params[:subfield] org_news = News.create(:org_subfield_id => field_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1) + # record forward to table forwards if new record is valid + if org_news.valid? + news.forwards << Forward.new(:to_type => org_news.class.name, :to_id => org_news.id) + end news.attachments.each do |attach| org_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, @@ -1900,6 +1912,10 @@ class UsersController < ApplicationController course = Course.find(course_id) if course.news.map(&:id).exclude?(@message.id) message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + # record forward to table forwards if new record is valid + if message.valid? + @message.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id) + end @message.attachments.each do |attach| message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, @@ -1916,6 +1932,10 @@ class UsersController < ApplicationController project = Project.find(project_id) if project.news.map(&:id).exclude?(@message.id) message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + # record forward to table forwards if new record is valid + if message.valid? + @message.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id) + end @message.attachments.each do |attach| message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, @@ -1932,6 +1952,10 @@ class UsersController < ApplicationController @message.save board = OrgSubfield.find(field_id).boards.first mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id) + # record forward to table forwards if new record is valid + if mes.valid? + @message.forwards << Forward.new(:to_type => mes.class.name, :to_id => mes.id) + end @message.attachments.each do |attach| mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, diff --git a/app/models/attachment.rb b/app/models/attachment.rb index c8aa33760..9fb6112b8 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -28,7 +28,7 @@ class Attachment < ActiveRecord::Base belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy - has_many :forwards, :as => :from + has_many :forwards, :as => :from, :dependent => :destroy # 课程动态 has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end diff --git a/app/models/message.rb b/app/models/message.rb index 675d37790..cc9968309 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -45,6 +45,8 @@ class Message < ActiveRecord::Base has_many :ActivityNotifies,:as => :activity, :dependent => :destroy + #转发表 + has_many :forwards, :as => :from, :dependent => :destroy after_destroy :delete_org_activities acts_as_searchable :columns => ['subject', 'content'], diff --git a/app/models/news.rb b/app/models/news.rb index fee5d2801..f859beb0c 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -37,6 +37,9 @@ class News < ActiveRecord::Base has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy #end + #转发表 + has_many :forwards, :as => :from, :dependent => :destroy + has_many :ActivityNotifies,:as => :activity, :dependent => :destroy validates_presence_of :title, :description From 555a9131c4aedf93fc20d00322036b50cf225246 Mon Sep 17 00:00:00 2001 From: newuser Date: Fri, 26 Feb 2016 15:37:59 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Gitlab=E7=AB=AF=E8=8E=B7=E5=8F=96=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7655f1eb4..f7845d6f1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -633,9 +633,10 @@ update end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s - @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip + # gitlab端获取默认分支 + gitlab_branchs = $g.project(@project.gpid).default_branch + @project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip) @rev_to = params[:rev_to] - unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) if @repository.branches.blank? raise InvalidRevisionParam From 8784c7cec606592e65e06d5d2c52724e4b5d4d74 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 26 Feb 2016 16:13:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=AD=A3=E5=B8=B8=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7f60b11b4..fe829f7a8 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1013,8 +1013,9 @@ function showNormalImage(id) { var image=$(description_images[i]); var element=$("").attr("href",image.attr('src')); image.wrap(element); + $(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); } - $('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 + //$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 } } From 1951d50bf7b087f16b3a373ba004a7d7fce8d806 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 26 Feb 2016 16:37:13 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=9B=9E=E5=A4=8D=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/_new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/org_document_comments/_new.html.erb b/app/views/org_document_comments/_new.html.erb index 9d3fe2de8..9e77d3fa8 100644 --- a/app/views/org_document_comments/_new.html.erb +++ b/app/views/org_document_comments/_new.html.erb @@ -1,6 +1,6 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> - <%= javascript_include_tag "des_KindEditor" %> + <%= javascript_include_tag "des_kindEditor" %> <% end %>