diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 68f7cc9cb..121cd3a42 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -24,7 +24,7 @@ class FilesController < ApplicationController before_filter :auth_login1, :only => [:index] before_filter :logged_user_by_apptoken,:only => [:index] before_filter :find_project_by_project_id#, :except => [:getattachtype] - before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment] + before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,:search_files_in_subfield] helper :sort include SortHelper diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0650db1cf..c4bbc4ebb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2727,6 +2727,10 @@ int main(int argc, char** argv){ opt = {enable_at: false, prettify: false, init_activity: false}.merge default_opt ss = '' + unless Setting.at_enabled? + opt[:enable_at] = false + end + ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg') if opt[:enable_at] ss += javascript_include_tag('/assets/kindeditor/at/jquery.caret.min.js', '/assets/kindeditor/at/jquery.atwho.js', '/assets/kindeditor/at/config.js') diff --git a/app/helpers/project_score_helper.rb b/app/helpers/project_score_helper.rb index 256e35a7a..4049cdd76 100644 --- a/app/helpers/project_score_helper.rb +++ b/app/helpers/project_score_helper.rb @@ -22,7 +22,9 @@ module ProjectScoreHelper #代码提交数量 def changesets_num project - # commit_count(project) + # g = Gitlab.client + # project.gpid.nil? ? 0 : g.commits_total_count(project.gpid) + # commits_total_count(project.gpid) project.changesets.count end diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 115a70e7a..fd6171f18 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -18,7 +18,7 @@ } $(function () { - init_activity_KindEditor_data(<%= issue.id%>, null, "87%"); + init_activity_KindEditor_data(<%= issue.id%>, null, "87%", "<%= issue.class.name %>"); showNormalImage('activity_description_<%= issue.id %>'); if ($("#intro_content_<%= issue.id %>").height() > 360) { $("#intro_content_show_<%= issue.id %>").show(); diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index c832c884f..4af757c77 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,9 +1,9 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false) %> + <%= import_ke(enable_at: true) %> <%= javascript_include_tag 'create_kindeditor'%> <% end %> -
-
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %> -
-
-
- <% if reply.try(:user).try(:realname) == ' ' %> - <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> - <% end %> - <%= l(:label_reply_to)%> - <% if comment.try(:user).try(:realname) == ' ' %> - <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14 ml10" %> - <% else %> - <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14 ml10" %> - <% end %> - <%= format_time reply.created_on %> -
-
- <%= reply.notes.html_safe %>
-
-
-
-
- <% end %> - <% end %> + <%= comment.notes.html_safe %> +
+ <% end %> <% end %> @@ -114,7 +83,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%> + <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id}, :method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> @@ -132,4 +101,5 @@
- \ No newline at end of file + + diff --git a/config/settings.yml b/config/settings.yml index 4286e0930..611ba8138 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -279,3 +279,5 @@ plugin_redmine_ckeditor: toolbar_can_collapse: '0' toolbar_location: top toolbar: Source,ShowBlocks,--,Undo,Redo,-,Find,Replace,--,Bold,Italic,Underline,Strike,-,Subscript,Superscript,-,NumberedList,BulletedList,-,Outdent,Indent,Blockquote,-,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,-,Link,Unlink,-,richImage,Table,HorizontalRule,/,Styles,Format,Font,FontSize,-,TextColor,BGColor +at_enabled: + default: 1 diff --git a/db/schema.rb b/db/schema.rb index 9c7702aa2..eac8a81db 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -558,23 +558,26 @@ ActiveRecord::Schema.define(:version => 20151218022014) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "editor_of_documents", :force => true do |t| @@ -923,16 +926,6 @@ ActiveRecord::Schema.define(:version => 20151218022014) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js index f26685f00..45e7c3195 100644 --- a/public/assets/kindeditor/at/config.js +++ b/public/assets/kindeditor/at/config.js @@ -10,10 +10,11 @@ var enableAt = function(_editor) { var ifr = editor.edit.iframe[0]; var doc = ifr.contentDocument || iframe.contentWindow.document; var ifrBody = doc.body; - ifrBody.contentEditable = true; + //ifrBody.contentEditable = false; + $(ifrBody).attr('enable_at', 'true'); console.log("enable at"); - $.fn.atwho.debug = true; + //$.fn.atwho.debug = true; var names = []; @@ -41,6 +42,6 @@ var enableAt = function(_editor) { }; $inputor = $(ifrBody).atwho(at_config); - $inputor.caret('pos', 47); - $inputor.focus().atwho('run'); + //$inputor.caret('pos', 47); + //$inputor.focus().atwho('run'); }; diff --git a/public/assets/kindeditor/at/jquery.atwho.js b/public/assets/kindeditor/at/jquery.atwho.js index 1e6c8ec25..cd2caf6ca 100644 --- a/public/assets/kindeditor/at/jquery.atwho.js +++ b/public/assets/kindeditor/at/jquery.atwho.js @@ -97,7 +97,7 @@ App = (function() { App.prototype.reg = function(flag, setting) { var base, controller; - controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[contentEditable]') ? new EditableController(this, flag) : new TextareaController(this, flag)); + controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[enable_at]') ? new EditableController(this, flag) : new TextareaController(this, flag)); if (setting.alias) { this.aliasMaps[setting.alias] = flag; } @@ -1110,7 +1110,7 @@ $.fn.atwho = function(method) { var _args, result; _args = arguments; result = null; - this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function() { + this.filter('textarea, input, [contenteditable=""], [contenteditable=true], [enable_at=true]').each(function() { var $this, app; if (!(app = ($this = $(this)).data("atwho"))) { $this.data('atwho', (app = new App(this))); diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 6f8e489f8..930911e76 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -260,7 +260,7 @@ K.options = { bodyClass : 'ke-content', indentChar : '\t', cssPath : K.basePath +'plugins/code/previewcode.css', - cssData : '', + cssData : 'font{color:black;}', minWidth : 650, minHeight : 100, minChangeSize : 1, diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index 3f555ac88..0eac4b01e 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -3,6 +3,7 @@ function sd_create_editor(params){ // var minHeight; //最小高度 var paramsHeight = params.height; //设定的高度 var id = arguments[1] ? arguments[1] : undefined; + var type = arguments[2] ? arguments[2] : ''; var paramsWidth = params.width == undefined ? "100%" : params.width; var editor = params.kindutil.create(params.textarea, { @@ -74,7 +75,9 @@ function sd_create_editor(params){ edit.html("我要回复"); this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight) // params.toolbar_container.hide(); - + if(typeof enableAt === 'function'){ + enableAt(this, id, type); + } } }).loadPlugin('paste'); return editor; @@ -136,6 +139,7 @@ function sd_reset_editor_form(params){ function sd_create_editor_from_data(id){ var height = arguments[1] ? arguments[1] : undefined; var width = arguments[2] ? arguments[2] : undefined; + var type = arguments[3] ? arguments[3] : undefined; KindEditor.ready(function (K) { $("div[nhname='new_message_" + id + "']").each(function () { var params = {}; @@ -153,7 +157,7 @@ function sd_create_editor_from_data(id){ params.height = height; params.width = width; if (params.textarea.data('init') == undefined) { - params.editor = sd_create_editor(params,id); + params.editor = sd_create_editor(params,id, type); sd_create_form(params); params.cancel_btn.click(function () { sd_reset_editor_form(params); diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index b0e4b9c59..4c63d1695 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -153,7 +153,7 @@ function init_activity_KindEditor_data(id){ params.cancel_btn.click(function () { nh_reset_form(params); }); - params.submit_btn.click(function () { + params.submit_btn.one('click',function () { params.form.submit(); }); params.textarea.data('init', 1);