From 3baba9c95e1d75a1064207af1dfdc9ac71db10e4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 27 Apr 2015 11:56:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B8=85=E7=90=86gemfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Gemfile | 47 +------------------------------------------- lib/tasks/ctags.rake | 4 ++++ 3 files changed, 6 insertions(+), 46 deletions(-) create mode 100644 lib/tasks/ctags.rake diff --git a/.gitignore b/.gitignore index 96788ad9a..5e8a94339 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ vendor/cache /files /public/images/avatars /public/files +/tags diff --git a/Gemfile b/Gemfile index d5fe6c581..0103a18b5 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' end +gem "mysql2", "= 0.3.18" gem 'redis-rails' gem 'rubyzip' gem 'delayed_job_active_record'#, :group => :production @@ -22,9 +23,6 @@ gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' gem 'spreadsheet' gem 'ruby-ole' -#gem 'email_verifier', path: 'lib/email_verifier' -gem 'rufus-scheduler' -#gem 'dalli', path: 'lib/dalli-2.7.2' gem 'rails_kindeditor',path:'lib/rails_kindeditor' group :development do gem 'grape-swagger' @@ -84,56 +82,13 @@ group :openid do gem "rack-openid" end -# Optional gem for exporting the gantt to a PNG file, not supported with jruby -platforms :jruby do - # jruby-openssl is bundled with JRuby 1.7.0 - gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0' - gem "activerecord-jdbc-adapter", "1.2.5" -end -# Include database gems for the adapters found in the database -# configuration file -require 'erb' -require 'yaml' database_file = File.join(File.dirname(__FILE__), "config/database.yml") if File.exist?(database_file) - database_config = YAML::load(ERB.new(IO.read(database_file)).result) - adapters = database_config.values.map {|c| c['adapter']}.compact.uniq - if adapters.any? - adapters.each do |adapter| - case adapter - when 'mysql2' - gem "mysql2", "= 0.3.18", :platforms => [:mri, :mingw] - gem "activerecord-jdbcmysql-adapter", :platforms => :jruby - when 'mysql' - gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw] - gem "activerecord-jdbcmysql-adapter", :platforms => :jruby - when /postgresql/ - gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw] - gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby - when /sqlite3/ - gem "sqlite3", :platforms => [:mri, :mingw] - gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby - when /sqlserver/ - gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw] - gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw] - else - warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") - end - end - else - warn("No adapter found in config/database.yml, please configure it first") - end else warn("Please configure your config/database.yml first") end -local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") -if File.exists?(local_gemfile) - puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v` - instance_eval File.read(local_gemfile) -end - # Load plugins' Gemfiles Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` diff --git a/lib/tasks/ctags.rake b/lib/tasks/ctags.rake new file mode 100644 index 000000000..c62d634dc --- /dev/null +++ b/lib/tasks/ctags.rake @@ -0,0 +1,4 @@ +desc "rerun ctags on current project" +task :ctags do + %x{ ctags --exclude=.git --exclude='*.log' -R * `bundle show --paths` } +end From 24ce5191c324e021f5913b7d9efa5933fbbb0db0 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 27 Apr 2015 12:04:08 +0800 Subject: [PATCH 2/9] =?UTF-8?q?zip=E6=89=93=E5=8C=85=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=9C=89=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index df354f107..1d03ef629 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -180,6 +180,7 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) + ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" zipfile_name = "#{output_path}/#{rename_zipfile}" @@ -189,7 +190,7 @@ class ZipdownController < ApplicationController rename_file = File.basename(filename) rename_file = filename_to_real( File.basename(filename)) if is_attachment begin - zipfile.add(rename_file, filename) + zipfile.add(ic.iconv(rename_file), filename) rescue Exception => e zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)} next @@ -238,4 +239,4 @@ class ZipdownController < ApplicationController attach = Attachment.find_by_disk_filename(name) attach.filename end -end \ No newline at end of file +end From 56f6fa0d8622857f1cf97b6bf7f0002d11a90d84 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 27 Apr 2015 14:36:11 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=AE=BE=E7=BD=AEzip=E6=94=AF=E6=8C=81unic?= =?UTF-8?q?ode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 1d03ef629..c1695e384 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -180,9 +180,9 @@ class ZipdownController < ApplicationController def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[]) - ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE') rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip" zipfile_name = "#{output_path}/#{rename_zipfile}" + Zip.unicode_names = true Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name)) Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| @@ -190,7 +190,7 @@ class ZipdownController < ApplicationController rename_file = File.basename(filename) rename_file = filename_to_real( File.basename(filename)) if is_attachment begin - zipfile.add(ic.iconv(rename_file), filename) + zipfile.add(rename_file, filename) rescue Exception => e zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)} next From a23231ea7b55286619e725bc626b29af820f92a4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Apr 2015 15:29:09 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E5=93=81=E6=97=B6=E7=9A=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/new.html.erb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 8697ff7ab..cf182716e 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -72,7 +72,7 @@ <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %>

-

+

<%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%> -
- +

-

- -

- <%= render :partial => 'attachments/form' %> -

+
+

+    添加附件    :

+
+ <%= render :partial => 'attachments/form' %> +
+

上传: - 课件 |  - 软件 |  - 媒体 |  - 代码 |  - 其他 + 课件 |  + 软件 |  + 媒体 |  + 代码 |  + 其他

<% end %> diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index e07efadd5..4f65a17c1 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -296,6 +296,7 @@ a:hover.close_btn {background-position:-66px 0;} .hiddent{ overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .break_word_firefox{white-space: pre-wrap;word-break: break-all;} +.font_bold{font-weight: bold;} /***** Ajax indicator ******/ From 0970182cd5c497dd477782f1d150a769fb70fde5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Apr 2015 17:25:42 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BD=93=E6=95=99=E5=B8=88=E5=8F=AA?= =?UTF-8?q?=E8=AF=84=E5=88=86=E4=B8=8D=E8=AF=84=E8=AE=BA=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8F=AF=E4=BB=A5=E8=BF=9B=E8=A1=8C=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=20=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=9B=9E=E5=A4=8D=E6=A1=86=E6=A0=B7=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88=E6=A1=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 6 ++++-- app/models/journals_for_message.rb | 6 +++++- app/views/words/_journal_reply_items.html.erb | 2 +- app/views/words/_new_respond.html.erb | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ee95277ce..811b19ad6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -473,8 +473,10 @@ class HomeworkAttachController < ApplicationController #保存评论 @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 - if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言 - @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation + if params[:new_form] && params[:new_form][:user_message] #有没有留言 + @homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher + else + @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher end @teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 396501862..0a6944e3b 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,7 +56,7 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - validates :notes, presence: true + validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity #huang after_create :reset_counters! after_destroy :reset_counters! @@ -88,6 +88,10 @@ class JournalsForMessage < ActiveRecord::Base self.find(message_id).destroy # self.destroy_all "id = #{message_id}" end + + def is_homework_jour? + self.jour_type != "HomeworkAttach" + end def reference_user User.find(reply_id) diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 716a27ffe..d52f7cfe1 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -40,7 +40,7 @@
<% if reply_allow %> - <% if journal.jour_type == "Course" %> + <% if journal.jour_type == "Course" || journal.jour_type == "Project" %> <%= render :partial => "words/new_respond_course", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %> <% else %> <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %> diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index 243f8b2c4..34e7c1ccf 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,5 +1,5 @@ <%= form_tag(words_create_reply_path, :remote => true) do %> - <%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5', + <%= text_area_tag 'user_notes', "", :class => 'noline', :style => "resize: none;", :rows => 4, :placeholder => l(:label_feedback_respond_content), :maxlength => 250 %> @@ -9,7 +9,7 @@ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= submit_tag l(:button_feedback_respond), :name => nil , - :class => "reply_btn", + :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> <% end %> \ No newline at end of file From e30c44684727bd43ae2bd440ad548a88f4c09df6 Mon Sep 17 00:00:00 2001 From: whimlex Date: Mon, 27 Apr 2015 17:49:05 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=A7=81=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_form.html.erb | 1 + config/locales/projects/zh.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index f0e28a975..4cd370adc 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -17,6 +17,7 @@ <% if @issue.safe_attribute? 'is_private' %> <%= f.check_box :is_private, :no_label => true, :class => "ml30" %> + <% end %>
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 49fe0e19a..3b125181e 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -188,6 +188,7 @@ zh: field_priority: 优先级 field_done_ratio: "% 完成" field_is_private: 私有 + field_is_private_tips: (设置为“私有”后本问题将仅对项目成员可见) field_watcher: 跟踪者 label_relates_to: 关联到 label_duplicates: 重复 From a64b3940dd2991370dc5a75eadd241e39a82ab96 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Apr 2015 17:50:03 +0800 Subject: [PATCH 8/9] =?UTF-8?q?1=E3=80=81=E5=BD=93=E6=95=99=E5=B8=88?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E9=A2=84?= =?UTF-8?q?=E7=95=99=E4=B8=80=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_review.html.erb | 3 ++- public/stylesheets/css.css | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/homework_attach/_review.html.erb b/app/views/homework_attach/_review.html.erb index 1666d8a43..921f16c8e 100644 --- a/app/views/homework_attach/_review.html.erb +++ b/app/views/homework_attach/_review.html.erb @@ -36,7 +36,8 @@ <% end %>
-

<%= textilizable jour.nil? ? "" : jour.notes%>

+ <% notes = textilizable(jour.nil? ? "" : jour.notes)%> + <%= notes.empty? ? "

".html_safe : notes%>
<% unless jour.nil? %> <% ids = 'project_respond_form_'+ jour.id.to_s%> diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 2efec2bbf..9bda2b7eb 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -118,7 +118,7 @@ a:hover.ping_sub{ background:#14a8b9;} .ping_dispic img{ height:46px; width:46px;} .ping_discon{ float:left; width:350px; margin-left:15px;} .ping_distop span{ float:left;} -.ping_distop p{ color:#5f5f5f;} +.ping_distop p{ color:#5f5f5f;min-height: 24px;} .ping_disfoot a{ float:right; color:#15bccf; margin-left:5px;} .ping_distop span a{ float:right; /*width:20px;*/ height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;} From d2f1f7d1421706ebb0db572c9a8e8e4938b0703c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Apr 2015 17:52:16 +0800 Subject: [PATCH 9/9] =?UTF-8?q?1=E3=80=81=E5=BD=93=E6=95=99=E5=B8=88?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E9=A2=84?= =?UTF-8?q?=E7=95=99=E4=B8=80=E9=83=A8=E5=88=86=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/words/_new_respond.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index 34e7c1ccf..33c523c33 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -10,6 +10,6 @@ <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= submit_tag l(:button_feedback_respond), :name => nil , :class => "enterprise", - :style => "float: right; margin-top: 1px; margin-right: 4px;"%> + :style => "float: right; margin-top: 1px; margin-right: 4px;margin-bottom: 5px;"%> <% end %> \ No newline at end of file