From 6d594cfcbee0d0f054509aaea1ac923214572082 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 28 Jul 2016 15:11:04 +0800 Subject: [PATCH] =?UTF-8?q?git=20pull=E5=90=8E=E9=87=8D=E6=96=B0commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 + app/api/mobile/apis/projects.rb | 2 +- app/controllers/at_controller.rb | 2 +- app/controllers/issues_controller.rb | 36 ++++++++++--- app/controllers/student_work_controller.rb | 8 +++ app/controllers/syllabuses_controller.rb | 2 +- app/controllers/wechats_controller.rb | 4 +- app/helpers/application_helper.rb | 1 - app/helpers/courses_helper.rb | 14 ++--- app/models/journal.rb | 2 +- app/views/boards/_course_new.html.erb | 4 +- app/views/courses/show.html.erb | 2 +- app/views/issues/_issue_replies.html.erb | 3 +- app/views/issues/add_journal.js.erb | 22 +------- app/views/issues/add_reply.js.erb | 6 +-- app/views/issues/delete_journal.js.erb | 4 +- app/views/layouts/_course_base_info.html.erb | 10 ++-- .../syllabuses/_delete_syllabus.html.erb | 4 +- config/locales/courses/zh.yml | 2 +- db/schema.rb | 20 +++++--- lib/wechat/lib/wechat.rb | 1 + lib/wechat/lib/wechat/ticket/jsapi_base.rb | 4 +- .../lib/wechat/token/access_token_base.rb | 4 +- plugins/redmine_ckeditor/.gitmodules | 3 -- public/assets/wechat/blog_detail.html | 39 +++++++------- public/assets/wechat/course_discussion.html | 47 ++++++++--------- public/assets/wechat/course_notice.html | 38 +++++++------- public/assets/wechat/homework_detail.html | 39 +++++++------- public/assets/wechat/issue_detail.html | 46 ++++++++--------- public/assets/wechat/jour_message_detail.html | 49 +++++++++--------- public/assets/wechat/project_discussion.html | 51 +++++++++---------- .../wechat/templates/comment_reply.html | 38 +++++++------- .../wechat/controllers/activity.js | 2 +- .../javascripts/wechat/controllers/project.js | 2 +- public/stylesheets/weui/weixin.css | 12 +++-- 35 files changed, 265 insertions(+), 260 deletions(-) delete mode 100644 plugins/redmine_ckeditor/.gitmodules diff --git a/Gemfile b/Gemfile index a94f1b33b..6e8a4dcdf 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,8 @@ gem 'kaminari' gem 'elasticsearch-model' gem 'elasticsearch-rails' +#rails 3.2.22.2 bug +gem "test-unit", "~>3.0" ### profile # gem 'oneapm_rpm' diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb index f0bb2cc3c..23bcadde9 100644 --- a/app/api/mobile/apis/projects.rb +++ b/app/api/mobile/apis/projects.rb @@ -173,7 +173,7 @@ module Mobile # # present :status, status - {status:-1, message: '该功能暂未开放,敬请期待!' } + {status:-1, message: '该功能将在近日开发,敬请期待!' } end end diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 69c33f90e..0e48cd962 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -10,7 +10,7 @@ class AtController < ApplicationController @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users #加上all - if @users.size > 0 + if @user && @users.size > 0 allUser = Struct.new(:id, :name).new allUser.id = @users.map{|u| u.id}.join(",") allUser.name = "all" diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 921d7d12b..63ef30b35 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -440,7 +440,7 @@ class IssuesController < ApplicationController jour.save update_user_activity(@issue.class,@issue.id) update_forge_activity(@issue.class,@issue.id) - + @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @user_activity_id = params[:user_activity_id] if params[:issue_id] @issue_id = params[:issue_id] @@ -483,12 +483,21 @@ class IssuesController < ApplicationController if User.current.logged? jour = Journal.find(params[:journal_id]) @issue = Issue.find params[:id] - new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id) + @project = @issue.project + @allowed_statuses = @issue.new_statuses_allowed_to(User.current) + @priorities = IssuePriority.active + new_jour = Journal.new + new_jour.user_id = User.current.id + new_jour.reply_id = params[:journal_id] + new_jour.parent_id = jour.id + new_jour.notes = params[:content] + new_jour.journalized = @issue + new_jour.save_attachments(params[:attachments]) + # new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id) @user_activity_id = params[:user_activity_id] if new_jour.save update_user_activity(@issue.class,@issue.id) update_forge_activity(@issue.class,@issue.id) - respond_to do |format| format.js end @@ -496,13 +505,28 @@ class IssuesController < ApplicationController end end - # + # 需要刷新详情页面,代码同步一致 + # 获取project和issue状态是为了刷新页面 + # 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型 + # 非动态页面直接刷新,动态页面手动刷新 def delete_journal @issue = Issue.find(params[:id]) - Journal.destroy(params[:journal_id]) + begin + forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first + forge_acts.destroy unless forge_acts.nil? + at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first + at_message.destroy unless at_message.nil? + Journal.delete(params[:journal_id]) + rescue Exception => e + puts e + end @user_activity_id = params[:user_activity_id] respond_to do |format| - format.js + if @user_activity_id + format.js + else + format.html{ redirect_to issue_url(@issue)} + end end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 1b93bdeba..e2dd23552 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -381,6 +381,7 @@ class StudentWorkController < ApplicationController @is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评 @show_all = false + # 0表示没有分组的学生,-1表示所有分组的学生 if @group if @group == "0" none_group_students = @course.members.select{ |member| member.course_group_id == 0 } @@ -389,6 +390,13 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')' end + elsif @group == "-1" + all_group_students = @course.members.select{ |member| member.course_group_id } + if all_group_students.empty? + student_in_group = '(0)' + else + student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')' + end else course_group = CourseGroup.find_by_id(@group) group_students = course_group.users diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index 9c69f5259..e77b19511 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -88,7 +88,7 @@ class SyllabusesController < ApplicationController end def destroy - if @syllabus && @syllabus.courses.empty? + if @syllabus && @syllabus.courses.not_deleted.empty? @syllabus.destroy redirect_to user_courselist_user_path(User.current.id) end diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index b791a0508..b773ef62e 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -145,11 +145,11 @@ class WechatsController < ActionController::Base end on :click, with: 'PROJECT' do |request, key| - request.reply.text "此功能正在开发中,很快就会上线,谢谢!" + request.reply.text "该功能将在近日开发,敬请期待!" end on :click, with: 'JOIN_PROJECT' do |request, key| - request.reply.text "该功能暂未开放,敬请期待!" + request.reply.text "该功能将在近日开发,敬请期待!" # uw = user_binded?(request[:FromUserName]) # unless uw # sendBind(request) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7aae73e94..d64d95223 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,7 +33,6 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter - # def user_blogs_path(resource,parameters={}) # super # end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 96e0d7683..e1dda3554 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -595,19 +595,19 @@ module CoursesHelper def get_acts_list_type type case type when "homework" - ">" + l(:label_homework_acts) + l(:label_homework_acts) when "news" - ">" + l(:label_news_acts) + l(:label_news_acts) when "attachment" - ">" + l(:label_attachment_acts) + l(:label_attachment_acts) when "message" - ">" + l(:label_message_acts) + l(:label_message_acts) when "journalsForMessage" - ">" + l(:label_journalsForMessage_acts) + l(:label_journalsForMessage_acts) when "poll" - ">" + l(:label_poll_acts) + l(:label_poll_acts) else - ">" + l(:label_all_cats) + l(:label_all_cats) end end diff --git a/app/models/journal.rb b/app/models/journal.rb index d2cc9e539..f22015f47 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -55,7 +55,7 @@ class Journal < ActiveRecord::Base before_create :split_private_notes, :add_journals_count # fq - after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id) + after_save :be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id) # end #after_destroy :down_user_score #before_save :be_user_score diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 32cec24d5..90f0d9c7e 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -132,12 +132,12 @@