diff --git a/app/models/news.rb b/app/models/news.rb index 53581a536..a7407c91f 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -41,7 +41,7 @@ class News < ActiveRecord::Base validates_presence_of :title, :description validates_length_of :title, :maximum => 60 validates_length_of :summary, :maximum => 255 - validates_length_of :description, :maximum => 10000 + # validates_length_of :description, :maximum => 10000 acts_as_attachable :delete_permission => :manage_news acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project diff --git a/app/models/repository.rb b/app/models/repository.rb index f50f37f31..571bba1b9 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -107,7 +107,7 @@ class Repository < ActiveRecord::Base def scm unless @scm @scm = self.scm_adapter.new(url, root_url, - login, password, path_encoding) + login, password, path_encoding, project_id) if root_url.blank? && @scm.root_url.present? update_attribute(:root_url, @scm.root_url) end diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb index be018c3f5..ede4a0534 100644 --- a/app/views/issues/update.js.erb +++ b/app/views/issues/update.js.erb @@ -12,12 +12,25 @@ issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, "no_label":true, + "at_id":<%= @issue.project_id%>, + "at_type":"Project", "autoHeightMode":true, - "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\")})", - "emotionsBasePath":"http://localhost:3000","height":300, + "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})", + "emotionsBasePath":'<%= Setting.host_name%>', + "height":300, "allowFileManager":true, "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); +//issue_desc_editor = KindEditor.create('#issue_description', +// {"width":"85%", +// "resizeType":0, +// "no_label":true, +// "autoHeightMode":true, +// "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\")})", +// "emotionsBasePath":"http://localhost:3000","height":300, +// "allowFileManager":true, +// "uploadJson":"/kindeditor/upload", +// "fileManagerJson":"/kindeditor/filemanager"}); <%else%> alert('<%= @issue.errors.full_messages[0].to_s%>') <%end %> diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index 3e51f2d4d..2dd520b92 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -80,7 +80,7 @@ module Redmine end def initialize(url, root_url=nil, login=nil, password=nil, - path_encoding=nil) + path_encoding=nil, project_id) @url = url @login = login if login && !login.empty? @password = (password || "") if @login diff --git a/lib/redmine/scm/adapters/gitlab_adapter.rb b/lib/redmine/scm/adapters/gitlab_adapter.rb index 32429fe35..7b2d18310 100644 --- a/lib/redmine/scm/adapters/gitlab_adapter.rb +++ b/lib/redmine/scm/adapters/gitlab_adapter.rb @@ -13,10 +13,12 @@ module Redmine attr_accessor :is_default end - def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil) + def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil, project_id) super @g = Gitlab.client - @project = Repository.find_by_url(url).project.gpid + r = Repository.where("url =? and project_id =?", url, project_id).first + @project = r.project.gpid + # @project = Repository.find_by_url(url).project.gpid @path_encoding = path_encoding.blank? ? 'UTF-8' : path_encoding end diff --git a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb index 23bd5108b..3b93de0b3 100644 --- a/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb +++ b/plugins/redmine_ckeditor/app/views/issues/update_form.js.erb @@ -13,11 +13,12 @@ issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, "no_label":true, + "at_id":<%= @issue.project_id%>, + "at_type":"Project", "autoHeightMode":true, - "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin(\"autoheight\"),$(this.toolbar.div).hide();})", - "afterFocus":"eval(function(){$(this.toolbar.div).show();})", - "afterBlur":"eval(function(){$(this.toolbar.div).hide();})", - "emotionsBasePath":"http://localhost:3000", - "height":300,"allowFileManager":true, + "afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, "<%=@issue.project_id %>", 'Project');}; this.loadPlugin('autoheight')})", + "emotionsBasePath":'<%= Setting.host_name%>', + "height":300, + "allowFileManager":true, "uploadJson":"/kindeditor/upload", "fileManagerJson":"/kindeditor/filemanager"}); \ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index c147850ef..5bfaccf30 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -299,12 +299,12 @@ function regexDescription() $("#description_notice_span").focus(); return false; } - else if(name.length >=6000){ + /*else if(name.length >=6000){ $("#description_notice_span").text("描述最多3000个汉字(或6000个英文字符)"); $("#description_notice_span").css('color','#ff0000'); $("#description_notice_span").focus(); return false; - } + }*/ else { $("#description_notice_span").text("填写正确"); diff --git a/public/javascripts/project.js b/public/javascripts/project.js index a7bf954a0..cc679847a 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -248,13 +248,13 @@ function regexDescription() { $("#description_notice_span").focus(); return false; } - else if (name.length > 10000) + /*else if (name.length > 10000) { $("#description_notice_span").text("描述超过10000个字符"); $("#description_notice_span").css('color', '#ff0000'); $("#description_notice_span").focus(); return false; - } + }*/ else { $("#description_notice_span").text("填写正确"); $("#description_notice_span").css('color', '#008000');