From 55bb9f68e0a5726a13c4304317b2ffaf52f96090 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 6 Dec 2015 10:48:05 +0800 Subject: [PATCH 1/9] =?UTF-8?q?gemfile=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0125e9d60..38364b556 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,9 @@ group :development do gem 'grape-swagger' gem 'better_errors', '~> 1.1.0' gem 'rack-mini-profiler', '~> 0.9.3' - gem 'win32console' + if RUBY_PLATFORM =~ /w32/ + gem 'win32console' + end end group :development, :test do From af31946586651554e398542472f3fb2dd049cee4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 6 Dec 2015 15:03:12 +0800 Subject: [PATCH 2/9] =?UTF-8?q?issue=E5=88=97=E8=A1=A8=E5=BC=80=E5=90=AFAT?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 7 + app/helpers/application_helper.rb | 34 + app/models/user.rb | 8 +- app/views/issues/show.html.erb | 5 +- db/schema.rb | 44 +- .../lib/rails_kindeditor/helper.rb | 5 +- public/assets/kindeditor/at/config.js | 39 + public/assets/kindeditor/at/jquery.atwho.css | 49 + public/assets/kindeditor/at/jquery.atwho.js | 1161 +++++++++++++++++ 9 files changed, 1321 insertions(+), 31 deletions(-) create mode 100644 public/assets/kindeditor/at/config.js create mode 100644 public/assets/kindeditor/at/jquery.atwho.css create mode 100644 public/assets/kindeditor/at/jquery.atwho.js diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index edf055370..407c7a3bd 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -142,6 +142,13 @@ class IssuesController < ApplicationController @project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young @available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq + #id name email + #1. issues list persons + #2. project persons + @at_persons = [] + @journals.each {|j| @at_persons << j.user unless @at_persons.include?(j.user)} + @issue.project.users.each {|u| @at_persons << u unless @at_persons.include?(u)} + respond_to do |format|`` format.html { retrieve_previous_and_next_issue_ids diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cbc646eac..1d1fe3164 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2619,4 +2619,38 @@ int main(int argc, char** argv){ true end end + + def import_ke(default_opt={}) + opt = {enable_at: true, prettify: false, init_activity: false}.merge default_opt + ss = '' + if opt[:enable_at] + ss = '" + 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') + ss += stylesheet_link_tag("/assets/kindeditor/at/jquery.atwho.css") + end + + if opt[:prettify] + ss += javascript_include_tag 'prettify' + ss += stylesheet_link_tag 'prettify' + end + + if opt[:init_activity] + ss += javascript_include_tag "init_activity_KindEditor" + end + + ss.html_safe + end + end diff --git a/app/models/user.rb b/app/models/user.rb index 9c437a186..65c0bf858 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -409,10 +409,14 @@ class User < Principal else name = lastname+firstname end - name = name.empty? || name.nil? ? login : name - name + name.empty? || name.nil? ? login : name end ## end + + def get_at_show_name + name = show_name + name = "#{name} #{self.login}" if name != self.login + end #added by nie def count_new_journal_reply diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 76e178120..80d3aaac1 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,4 +1,7 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= content_for(:header_tags) do %> +<%= import_ke(enable_at: true) %> +<% end %> +