From a3a92a19f962610afaaa71eb2ce4042c1fc112a0 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Apr 2016 18:50:38 +0800 Subject: [PATCH 01/38] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 7c1efce6d..6ee190852 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160330103916) do +ActiveRecord::Schema.define(:version => 20160414055511) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1290,6 +1290,7 @@ ActiveRecord::Schema.define(:version => 20160330103916) do t.datetime "updated_at", :null => false t.string "field_type" t.integer "hide", :default => 0 + t.integer "status", :default => 1 end create_table "organizations", :force => true do |t| @@ -1302,6 +1303,7 @@ ActiveRecord::Schema.define(:version => 20160330103916) do t.datetime "updated_at", :null => false t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 + t.integer "show_mode", :default => 0 end create_table "phone_app_versions", :force => true do |t| @@ -1684,8 +1686,8 @@ ActiveRecord::Schema.define(:version => 20160330103916) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false - t.integer "simi_id", :default => 0 - t.integer "simi_value", :default => 0 + t.integer "simi_id" + t.integer "simi_value" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" From 955c258856844c0858be9508de76677d71e82b99 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 12 Jul 2016 10:35:52 +0800 Subject: [PATCH 02/38] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86=E4=B8=AD=E2=80=9C=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E2=80=9D=E4=B8=8B=E6=8B=89=E6=A1=86=E4=B8=AD?= =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E6=89=80=E6=9C=89=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_copy_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index cc7f2fb53..d7a9fa4cd 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -53,7 +53,7 @@
  • - <%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %> + <%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
  • From f0e456729e1f6ab9510494ffd365c7d3e4e7cd45 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 12 Jul 2016 16:21:30 +0800 Subject: [PATCH 03/38] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=AD=E7=9A=84html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 8 ++++++++ app/views/layouts/_show_messages_list.html.erb | 16 ++++++++-------- .../users/_join_course_course_message.html.erb | 2 +- app/views/users/_user_message_course.html.erb | 10 +++++----- app/views/users/_user_message_forum.html.erb | 2 +- app/views/users/_user_message_system.html.erb | 2 +- .../users/_user_message_userfeedaback.html.erb | 2 +- 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 23fd401fd..3a28e4b72 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3296,6 +3296,14 @@ def strip_html(text,len=0,endss="...") return ss end +def message_content content + content = (strip_html content).strip + if content.gsub(" ", "") == "" + content = "[非文本消息]" + end + content +end + def get_hw_index(hw,is_teacher) if is_teacher homeworks = hw.course.homework_commons.order("created_at asc") diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb index ba31c4379..0829b9c42 100644 --- a/app/views/layouts/_show_messages_list.html.erb +++ b/app/views/layouts/_show_messages_list.html.erb @@ -5,7 +5,7 @@ @@ -21,16 +21,17 @@
  • - <% if User.current.try(:login) == qa.author_login %> + <% if User.current.try(:login) == qa.author_login || User.current.admin? || is_project_manager?(User.current.id, @project.id) %>
  • - <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> + <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> / + <%=link_to "删除", delete_project_quality_analysi_path(qa, :project_id => @project.id), :method => "delete", :confirm => "删除会一并删除分析结果,确定删除吗?", :class => "fontBlue2" %>
  • - <% else %> -
  • 编辑
  • - <% end %> + <% end %>
    <% end %> +<% else %> + <%#= 数据为空时候界面,待完善 %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a570fef55..fbb69af62 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -790,12 +790,13 @@ RedmineApp::Application.routes.draw do end end - resources :quality_analysis, :only => [:index, :create, :edit, :update] do + resources :quality_analysis, :only => [:index, :create, :edit, :update, :delete] do collection do end member do match 'update_jenkins_job' match 'edit' + match 'delete' match 'create' get 'error_list' end diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb index c9cbcee26..615bb6ac3 100644 --- a/lib/trustie/gitlab/helper.rb +++ b/lib/trustie/gitlab/helper.rb @@ -60,8 +60,6 @@ module Trustie def get_gitlab_role m case m.roles.first.position - when 1,2 - GUEST when 5 REPORTER when 4 From 191261d3b873d0c7ef46b8bb1cc90f9a13516806 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 12 Jul 2016 17:30:29 +0800 Subject: [PATCH 05/38] each time to 10s --- app/controllers/quality_analysis_controller.rb | 7 +++---- app/views/quality_analysis/error_list.html.erb | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 08ac4067f..a7e421cdc 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -33,7 +33,6 @@ class QualityAnalysisController < ApplicationController arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first if @client.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? - logger.info("88888888888888888888") aa = @client.job.delete("#{job_name}") quality_an.delete unless quality_an.blank? end @@ -71,12 +70,12 @@ class QualityAnalysisController < ApplicationController # 判断调用sonar分析是否成功 # 等待启动时间处理, 最长时间为30分钟 - for i in 0..60 do - sleep(30) + for i in 0..180 do + sleep(10) @current_build_status = @client.job.get_current_build_status("#{job_name}") if (@current_build_status == "success" || @current_build_status == "failure") break - if i == 60 + if i == 180 @build_console_result = false break end diff --git a/app/views/quality_analysis/error_list.html.erb b/app/views/quality_analysis/error_list.html.erb index 84f2777fa..138dc9c08 100644 --- a/app/views/quality_analysis/error_list.html.erb +++ b/app/views/quality_analysis/error_list.html.erb @@ -6,6 +6,6 @@ <% if @build_console_result == false %> 分析超时 <% else %> - <%= h @error_list.output %> + <%= h @error_list.try(:output).html_safe %> <% end %> \ No newline at end of file From 16cf8a56a1fa0dfe1bd55aee75afdd385eeba826 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 13 Jul 2016 09:34:36 +0800 Subject: [PATCH 06/38] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=92=8C?= =?UTF-8?q?=E8=80=81=E5=B8=88=E5=8F=AF=E7=9C=8B=E5=88=B0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=89=80=E6=9C=89=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- app/controllers/syllabuses_controller.rb | 6 +++++- app/controllers/users_controller.rb | 9 +++++++-- app/views/layouts/base_syllabus.html.erb | 9 +++++++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 52e1f5fd0..36a5d9d4f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -82,7 +82,7 @@ class AdminController < ApplicationController syllabus.update_attributes(:title => params[:title], :eng_name => params[:eng_name], :user_id => @user.id) syllabus.description = Message.where("id = 19412").first.nil? ? nil : Message.where("id = 19412").first.content if syllabus.save - course.update_attribute('syllabus_id', syllabus.id) + course.update_column('syllabus_id', syllabus.id) @flag = params[:flag].to_i @course = course respond_to do |format| diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index 8d7195f38..291e6ca30 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -109,7 +109,11 @@ class SyllabusesController < ApplicationController sort_name = "updated_on" sort_type = @c_sort == 1 ? "asc" : "desc" - @courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}") + if User.current == @syllabus.user || User.current.admin? + @courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}") + else + @courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}") + end #根据 作业+资源数排序 if @order.to_i == 2 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 83a794cd9..373b4f514 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1410,8 +1410,13 @@ class UsersController < ApplicationController @all_count = @user.courses.visible.where("is_delete =?", 0).count elsif @type == 'Syllabus' @syllabus = Syllabus.where("id = #{params[:syllabus]}").first - @courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5) - @all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count + if User.current == @syllabus.user || User.current.admin? + all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") + else + all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") + end + @courses = all_courses.limit(5).offset(@page * 5) + @all_count = all_courses.count end end diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb index 5aa23b3c5..b0ecea006 100644 --- a/app/views/layouts/base_syllabus.html.erb +++ b/app/views/layouts/base_syllabus.html.erb @@ -75,8 +75,13 @@ <% end%> <% end%> - <% courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %> - <% all_count = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).count%> + <% if User.current == @syllabus.user || User.current.admin? + all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") + else + all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") + end %> + <% courses = all_courses.limit(5) %> + <% all_count = all_courses.count%>
      From 9bf853d2bbcb6d781441bde7fa897b2d6e35b0de Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 13 Jul 2016 09:49:24 +0800 Subject: [PATCH 07/38] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E5=90=8D=E7=A7=B0=E5=92=8C?= =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_syllabus_eng_name.html.erb | 2 +- app/views/layouts/_syllabus_title.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_syllabus_eng_name.html.erb b/app/views/layouts/_syllabus_eng_name.html.erb index ed8035736..72af30927 100644 --- a/app/views/layouts/_syllabus_eng_name.html.erb +++ b/app/views/layouts/_syllabus_eng_name.html.erb @@ -3,6 +3,6 @@ <% else%> 课程英文名称 <% end %> -<% if User.current == syllabus.user %> +<% if User.current == syllabus.user || User.current.admin? %> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :class => "none", :onclick => "show_edit_eng_name();"%> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_syllabus_title.html.erb b/app/views/layouts/_syllabus_title.html.erb index 5180da82d..51737fe4e 100644 --- a/app/views/layouts/_syllabus_title.html.erb +++ b/app/views/layouts/_syllabus_title.html.erb @@ -1,5 +1,5 @@ <%=@syllabus.title %> -<% if User.current == syllabus.user %> +<% if User.current == syllabus.user || User.current.admin? %> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :onclick => "show_edit_title();"%> <% end %> \ No newline at end of file From 845f36c4f3fa379b8f8a27e60a1ea13988ad0ba1 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 10:00:04 +0800 Subject: [PATCH 08/38] =?UTF-8?q?=E8=A7=A3=E5=86=B3z=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E5=80=99=E9=82=AE=E7=AE=B1=E4=B8=8D=E8=83=BD=E6=98=AF?= =?UTF-8?q?=E5=A4=A7=E5=86=99=E5=8A=A0=E4=B8=8B=E5=88=92=E7=BA=BF=E7=9A=84?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/account/login.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 23acabd1f..cfe9cd695 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -62,7 +62,7 @@ }); $mail.blur(function (event) { - if (/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ + if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){ $('#mail_req').html( '邮件格式不对').show(); $mail_correct = false; return ; From ef931d14918e059a0c5bc9c736c97bbc5657ed2a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 12:07:27 +0800 Subject: [PATCH 09/38] =?UTF-8?q?=E7=BC=96=E8=BE=91issue=EF=BC=8C=E4=B8=8E?= =?UTF-8?q?=E5=9B=9E=E5=A4=8Dissue=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=88=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_form.html.erb | 24 ------------------------ app/views/issues/add_journal.js.erb | 5 +++-- app/views/issues/show.html.erb | 6 +++++- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 8b313a2ef..e2b6a0a17 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -58,13 +58,6 @@
  • - <%# if @copy_from && @copy_from.attachments.any? %> - - - - - <%# end %> <% if @copy_from && !@copy_from.leaf? %>

    @@ -83,23 +76,6 @@ <%= render :partial => 'issues/attributes' %>

  • - - - - - <%#= link_to "", -# {:controller => 'watchers', :action => 'new', :project_id => @issue.project}, -# :remote => true, -# :method => 'get', - :class => "pic_sch mt5 ml5" %> - - <%#= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript watchers_autocomplete_for_user_path(:user => @available_watchers, :format => 'js', :flag => 'ture') }')" %> - - - - - - <%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %> <% end %> 确定 diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index 21519d5a1..838e2d83d 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -1,8 +1,9 @@ <% if @issue_id %> //issue详情中回复 $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); - $("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>') - sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%=@issue.class.name%>"); + $("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>') + $("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>') + sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>"); issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", "resizeType":0, diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 67bb4d59d..13642c0ca 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -15,7 +15,7 @@ } }); -
    +
    问题跟踪
    @@ -23,8 +23,12 @@
    +
    <%= render :partial => 'issues/detail'%> +
    +
    <%= render :partial => 'issues/edit'%> +
    From 61bf6604b1ffc8355cca02ef05a25d8b2d6a03e6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 13 Jul 2016 12:23:28 +0800 Subject: [PATCH 10/38] =?UTF-8?q?=E8=A7=A3=E5=86=B3ajax=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=8Cissue=E7=8A=B6=E6=80=81=E9=80=89=E6=A1=86?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 1 + app/views/issues/_attributes.html.erb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 44f0d15f4..73877ddc7 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -440,6 +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] diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index f0967843a..cb9b79c7c 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -4,15 +4,15 @@
    • - <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> + <%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }), {:no_label => true}, # ajax 刷新 #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", :class => "w150" %> - <% else %> - <%= h(@issue.status.name) %> - <% end %> + <%# else %> + <%#= h(@issue.status.name) %> + <%# end %>
    • From ded8f48d34406bdf3fbc80a560bd9b4d8da10abf Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 13 Jul 2016 15:20:39 +0800 Subject: [PATCH 11/38] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E7=9A=84=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 6 +- app/controllers/blog_comments_controller.rb | 11 +++- app/controllers/users_controller.rb | 5 ++ app/helpers/application_helper.rb | 2 +- app/views/blog_comments/reply.js.erb | 2 +- .../users/_blog_comments_replies.html.erb | 59 +++++++++++++++++++ app/views/users/_reply_to.html.erb | 13 ++++ app/views/users/_user_blog.html.erb | 5 +- 8 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 app/views/users/_blog_comments_replies.html.erb diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index 5b29565ad..69c33f90e 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -47,6 +47,8 @@ class AtController < ApplicationController find_journals_for_message(id) when 'Principal' find_principal(id) + when 'BlogComment' + find_blog_comment(id) when 'All' nil else @@ -166,8 +168,8 @@ class AtController < ApplicationController #BlogComment def find_blog_comment(id) - blog = BlogComment.find(id).blog - blog.users + blog = BlogComment.find(id) + blog.author.watcher_users end end \ No newline at end of file diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 4a8de5814..a6e383504 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -130,9 +130,16 @@ class BlogCommentsController < ApplicationController params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0 params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0 @blogComment.safe_attributes = params[:blog_comment] - @blogComment.content = @quote + @blogComment.content @blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title] - @article.children << @blogComment + if params[:activity_id] + @blogComment.content = params[:blog_comment][:content] + parent = BlogComment.find params[:parent_id] + @blogComment.reply_id = params[:reply_id] + parent.children << @blogComment + else + @blogComment.content = @quote + @blogComment.content + @article.children << @blogComment + end @article.save # @article.update_attribute(:updated_on, @blogComment.updated_on) @user_activity_id = params[:user_activity_id] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 373b4f514..633254978 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -120,6 +120,11 @@ class UsersController < ApplicationController @is_course = params[:is_course] @is_board = params[:is_board] @type = 'Message' + when 'BlogComment' + @reply = BlogComment.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'BlogComment' end respond_to do |format| format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a28e4b72..3d8d970b5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3141,7 +3141,7 @@ end #获取所有子节点 def get_all_children result, jour - if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) + if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment) jour.children.each do |jour_child| result << jour_child get_all_children result, jour_child diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb index baf4418e9..f612cfe98 100644 --- a/app/views/blog_comments/reply.js.erb +++ b/app/views/blog_comments/reply.js.erb @@ -5,7 +5,7 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); // init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% else%> -$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>"); //init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity'); <% end %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity'); \ No newline at end of file diff --git a/app/views/users/_blog_comments_replies.html.erb b/app/views/users/_blog_comments_replies.html.erb new file mode 100644 index 000000000..181f6698a --- /dev/null +++ b/app/views/users/_blog_comments_replies.html.erb @@ -0,0 +1,59 @@ +
        + <% comments.each do |comment| %> + +
      • +
        + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> +
        +
        +
        + <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %> + <%= time_from_now(comment.created_on) %> +
        + <% if !comment.parent.nil? && !comment.parent.parent.nil? %> + <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> + <% end %> + <% if !comment.content_detail.blank? %> +
        + <%= comment.content_detail.html_safe %> +
        +
        +
        + + + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + + + <%= link_to( + l(:button_reply), + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <% if comment.author == User.current %> + <%= link_to( + l(:button_delete), + {:controller => 'blog_comments',:action => 'destroy', :id => comment.id}, + :method => :delete, + :class => 'fr newsGrey mr10', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete)) %> + <% end %> + +
        +
        +
        +

        + <% end %> +
        +
        +
      • + <% end %> +
      \ No newline at end of file diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 8a2909ad4..8358a7d23 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -44,6 +44,19 @@

      <% end%> + <% elsif @type == 'BlogComment' %> + <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id}, :method => "post", :remote => true) do |f| %> + + <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %> + <%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@activity_id %> + <%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %> + <%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author_id %> +
      + + +
      +

      + <% end%> <% end %>
    diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 77510c858..868f92979 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -45,10 +45,11 @@
    <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> - <% comments = activity.children.reorder("created_on desc").limit(3) %> + <% all_comments = []%> + <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%= render :partial => 'users/blog_comments_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id}%>
    <% end %> From 1e8f496718954b856002670b3ad55f2b9cbc7770 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 14 Jul 2016 10:06:37 +0800 Subject: [PATCH 12/38] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=20=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=9C=AA?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/controllers/student_work_controller.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a9d84c2d9..479aec3ce 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -968,7 +968,7 @@ class CoursesController < ApplicationController @homework = HomeworkCommon.find params[:homework] #order("#{@order} #{@b_sort}" - @student_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("simi_value desc"),@name + @student_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("simi_value desc").has_committed,@name @works_hash = {} diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index bc1b97a2f..45b54cf0a 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -271,7 +271,7 @@ class StudentWorkController < ApplicationController all_studentwork = find_all_student_work_by_homeid() - @work_count = all_studentwork.count + @work_count = all_studentwork.has_committed.count end #代码查重 status: 0完成 -2不需要查重 -1查重失败不支持该语言 @@ -282,7 +282,7 @@ class StudentWorkController < ApplicationController @homework = HomeworkCommon.find params[:homework] - all_studentwork = find_all_student_work_by_homeid() + all_studentwork = find_all_student_work_by_homeid().has_committed if all_studentwork == nil resultObj[:status] = -2 From 9b59ca20de663cae04e9bb648036ee5721b8d0e1 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 10:39:54 +0800 Subject: [PATCH 13/38] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dissue=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=88=A0=E9=99=A4=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E7=BC=96=E8=BE=91=E4=BF=9D=E5=AD=98issue?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=99=BD=E8=89=B2=E6=A1=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 16 ++++++++-------- app/views/issues/_issue_replies.html.erb | 3 +-- app/views/issues/_issue_reply_ke_form.html.erb | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 73877ddc7..049842e37 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -432,12 +432,12 @@ class IssuesController < ApplicationController def add_journal if User.current.logged? - jour = Journal.new - jour.user_id = User.current.id - jour.notes = params[:notes] - jour.journalized = @issue - jour.save_attachments(params[:attachments]) - jour.save + @jour = Journal.new + @jour.user_id = User.current.id + @jour.notes = params[:notes] + @jour.journalized = @issue + @jour.save_attachments(params[:attachments]) + @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) @@ -493,7 +493,7 @@ class IssuesController < ApplicationController update_forge_activity(@issue.class,@issue.id) respond_to do |format| - format.js + format.html{redirect_to issue_url(@issue)} end end end @@ -503,7 +503,7 @@ class IssuesController < ApplicationController @issue = Issue.find(params[:id]) Journal.destroy(params[:journal_id]) respond_to do |format| - format.js + format.html{redirect_to issue_url(@issue)} end end diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 7b5383c1e..4efef74b8 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -42,7 +42,6 @@ l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>reply.id}, :method => :get, - :remote=>true, :class => 'fr newsGrey mr10', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) @@ -73,7 +72,7 @@
    - <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %> + <%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
    diff --git a/app/views/issues/_issue_reply_ke_form.html.erb b/app/views/issues/_issue_reply_ke_form.html.erb index 7fbb0d191..87b599aa3 100644 --- a/app/views/issues/_issue_reply_ke_form.html.erb +++ b/app/views/issues/_issue_reply_ke_form.html.erb @@ -7,7 +7,7 @@
    <% if User.current.logged? %>
    - <%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%> + <%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post") do |f|%> <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%> From 00c414c34791823a4eb0c8a8648d5ec68d05da4d Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 11:14:05 +0800 Subject: [PATCH 14/38] =?UTF-8?q?issue=E5=9B=9E=E5=A4=8D=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_issue_replies.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 4efef74b8..c120ca1b9 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -74,7 +74,7 @@
    <%= render :partial => 'attachments/issue_reply', :locals => {:container => @jour.nil? ? @issue : @jour} %>
    - +
    <% end %> From 8c6fca87c9a7a937dd9e5c9a4f47adeb2c75339e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Jul 2016 13:57:06 +0800 Subject: [PATCH 15/38] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=96=B0=E9=97=BB=E6=B7=BB=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E6=93=8D=E4=BD=9C=EF=BC=8C=E6=89=80=E6=9C=89=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_project_news.html.erb | 19 +++++++++++++++++++ app/views/users/_project_message.html.erb | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 2d498e827..e751e16ae 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -32,6 +32,25 @@
    <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    + <% if User.current.logged? %> +
    +
      +
    • + <% if User.current.logged? %> +
        +
      • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
      • +
      • + <%= link_to(l(:button_edit), {:controller => 'news', :action => 'edit', :id => activity}, :class => 'postOptionLink') if activity.author == User.current %> +
      • +
      • + <%= delete_link(news_path(activity), :data => {:confirm => l(:text_are_you_sure)}, :class => 'postOptionLink') if activity.author == User.current %> +
      • +
      + <% end %> +
    • +
    +
    + <% end %>
    diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d1bb99296..00075dc8e 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -1,4 +1,4 @@ -
    +
    <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> @@ -46,7 +46,7 @@ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
    <% if User.current.logged? %> - - <% comments_for_doc = document.children.reorder("created_at desc").limit(3) %> - <% count = document.children.count() %> + <% all_comments = []%> + <% count=get_all_children(all_comments, document).count %>
    - <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => document.id} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => act.id} %> + + <% all_comments = []%> + <% comments = get_all_children(all_comments, document)[0..2] %> + <% if count > 0 %> +
    + <%= render :partial => 'users/org_document_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%> +
    + <% end %> -
    - <%= render :partial => 'users/all_replies', :locals => {:comments => comments_for_doc}%> -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %> @@ -84,7 +89,6 @@ <% if User.current.logged? %>
    <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> -
    diff --git a/app/views/users/_comment_reply_detail.html.erb b/app/views/users/_comment_reply_detail.html.erb index 266a0b32b..b8ea13cf4 100644 --- a/app/views/users/_comment_reply_detail.html.erb +++ b/app/views/users/_comment_reply_detail.html.erb @@ -3,7 +3,7 @@
    <%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %> - <%= time_from_now(comment.created_on) %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
    <%= comment.content_detail.html_safe %>
    \ No newline at end of file diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 70a7e6c7d..48daa6e95 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -80,8 +80,6 @@
    <% all_comments = []%> <% count=get_all_children(all_comments, activity).count %> - <%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %> - <%# count = fetch_user_leaveWord_reply(activity).count %>
    <%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> diff --git a/app/views/users/_org_document_replies.html.erb b/app/views/users/_org_document_replies.html.erb new file mode 100644 index 000000000..ce26cf70c --- /dev/null +++ b/app/views/users/_org_document_replies.html.erb @@ -0,0 +1,60 @@ +
      + <% comments.each do |comment| %> + +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> +
      +
      +
      + <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %> + <%= time_from_now(comment.created_at) %> +
      + <% if !comment.parent.nil? && !comment.parent.parent.nil? %> + <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> + <% end %> + <% if !comment.content_detail.blank? %> +
      + <%= comment.content_detail.html_safe %> +
      +
      +
      + + + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + + + <%= link_to( + l(:button_reply), + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <% if comment.creator_user == User.current %> + <%= link_to( + l(:button_delete), + {:controller => 'org_document_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id}, + :method => :delete, + :remote => true, + :class => 'fr mr20', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete)) %> + <% end %> + +
      +
      +
      +

      + <% end %> +
      +
      +
    • + <% end %> +
    \ No newline at end of file diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 5c3f2a70b..cb8b2e0ff 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -43,8 +43,6 @@

    <% end%> <% elsif @type == 'BlogComment' %> - <%#= form_for reply, :as => :reply, :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id}, :html => {:multipart => true, :id => 'new_form'} do |f| %> - <%= form_for('new_form', :url => {:controller => 'blog_comments',:action => 'reply', :id => reply.id, :blog_id => reply.blog.id, :user_id => User.current.id}, :method => "post", :remote => true) do |f| %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %> @@ -57,7 +55,17 @@

    <% end%> - <% end %> + <% elsif @type == 'OrgDocumentComment' %> + <%= form_for('new_form', :url => {:controller => 'org_document_comments',:action => 'reply', :id => reply.id}, :method => "post", :remote => true) do |f| %> + + <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %> +
    + + +
    +

    + <% end%> + <% end %>
    diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index 30ae23bfb..b7485def3 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -6,6 +6,8 @@ $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :part $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>'); <% elsif params[:type] == 'BlogComment' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/blog_comments_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i, :homepage => @homepage}) %>'); +<% elsif params[:type] == 'OrgDocumentComment' %> +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/org_document_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>'); <% else %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>'); <% end %> From 7ea5d7d93449e6684a2bfa1321057fed7155aa95 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 10:21:59 +0800 Subject: [PATCH 21/38] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=8F=90=E7=A4=BA=E2=80=9C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E5=88=97=E8=A1=A8=E4=B8=AD=E6=B2=A1=E6=9C=89=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E8=AF=BE=E7=A8=8B=EF=BC=8C=E8=AF=B7=E6=82=A8?= =?UTF-8?q?=E5=85=88=E5=88=9B=E5=BB=BA=E8=AF=BE=E7=A8=8B=E2=80=9D=E5=A7=8B?= =?UTF-8?q?=E7=BB=88=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_copy_course.html.erb | 2 +- app/views/courses/new.html.erb | 2 +- app/views/courses/settings.html.erb | 2 +- public/javascripts/course.js | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/courses/_copy_course.html.erb b/app/views/courses/_copy_course.html.erb index d7a9fa4cd..55217017b 100644 --- a/app/views/courses/_copy_course.html.erb +++ b/app/views/courses/_copy_course.html.erb @@ -54,7 +54,7 @@
  • <%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %> - + 如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>
  • diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index 78b3d8293..a96380ecf 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -12,7 +12,7 @@ <%=@syllabus.title %> <% end %> - + 如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>
  • diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index ee0f6c98a..5b45042a7 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -32,7 +32,7 @@
  • <%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %> - + 如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>
  • diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 0e60f01c9..e90742004 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -188,10 +188,8 @@ function regex_syllabus_option(str) { var obj = document.getElementById(str + "_syllabus_id"); var syllabus = obj.options[obj.selectedIndex]; if(parseInt(syllabus.value) == 0) { - $("#"+str+"_syllabus_notice").show(); return false; } else{ - $("#"+str+"_syllabus_notice").hide(); return true; } } else { From 97b1ea22e7c84b2d2c7138404401fb517146c452 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 10:51:44 +0800 Subject: [PATCH 22/38] =?UTF-8?q?=E8=A7=A3=E5=86=B3=EF=BC=9AFirefox?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=AD=EF=BC=9A=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93=EF=BC=8C=E5=85=88=E7=82=B9=E5=87=BB=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E7=BC=96=E8=BE=91=E5=9B=BE=E6=A0=87=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=88=E7=AC=94=EF=BC=89=EF=BC=8C=E5=86=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E9=A1=B5=E9=9D=A2=E7=A9=BA=E7=99=BD=E5=A4=84=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E5=9B=BE=E4=B8=A4=E4=B8=AA=E8=B5=84=E6=BA=90=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E6=9C=89=E4=B8=80=E6=AE=B5=E7=A9=BA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_resource_detail.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index 85e0dc8d3..4e9f38c50 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -93,6 +93,6 @@
  • -
    -
    \ No newline at end of file +
    +
    \ No newline at end of file From fd68479d72ef011f76210cc700c8a711eb16bf7d Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 11:02:53 +0800 Subject: [PATCH 23/38] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE/?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90=E5=BA=93=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E3=80=81=E9=97=AE=E7=AD=94=E5=8C=BA=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E5=8F=91=E9=80=81=E3=80=81=E9=80=9A=E7=9F=A5=E5=8F=91?= =?UTF-8?q?=E9=80=81=E3=80=81=E6=96=B0=E9=97=BB=E5=8F=91=E9=80=81=E3=80=81?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E5=8F=91=E9=80=81=E5=88=B0=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E6=94=B9=E4=B8=BA=E7=8F=AD=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resource_share_for_orgs.html.erb | 2 +- app/views/users/_resource_share_for_project_popup.html.erb | 2 +- app/views/users/_send_homework_to_course.html.erb | 2 +- app/views/users/_share_message_to_course.html.erb | 2 +- app/views/users/_share_message_to_org.html.erb | 2 +- app/views/users/_share_message_to_project.html.erb | 2 +- app/views/users/_share_news_to_course.html.erb | 2 +- app/views/users/_share_news_to_org.html.erb | 2 +- app/views/users/_share_news_to_project.html.erb | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 6788161f0..36d1c774f 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -5,7 +5,7 @@ <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index 07f4abe38..b521bcb90 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -6,7 +6,7 @@ <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb index fc4007d03..f6f007838 100644 --- a/app/views/users/_send_homework_to_course.html.erb +++ b/app/views/users/_send_homework_to_course.html.erb @@ -16,7 +16,7 @@ function send_submit() { var checkboxs = $("input[name='course_ids[]']:checked"); if(checkboxs.length == 0) { - $("#choose_courses_notice").text("请先选择课程"); + $("#choose_courses_notice").text("请先选择班级"); } else{ $("#choose_courses_notice").text(""); $("#choose_course_list_form").submit(); diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb index d86c51f0d..4fc1a1766 100644 --- a/app/views/users/_share_message_to_course.html.erb +++ b/app/views/users/_share_message_to_course.html.erb @@ -5,7 +5,7 @@
    发送到
    diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb index 8cb2fae57..37575a8d5 100644 --- a/app/views/users/_share_message_to_org.html.erb +++ b/app/views/users/_share_message_to_org.html.erb @@ -2,7 +2,7 @@
    发送到
    diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb index 3a89c0b9f..89b36e22a 100644 --- a/app/views/users/_share_message_to_project.html.erb +++ b/app/views/users/_share_message_to_project.html.erb @@ -3,7 +3,7 @@
    发送到
    diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb index e03a296b2..0e88c164e 100644 --- a/app/views/users/_share_news_to_course.html.erb +++ b/app/views/users/_share_news_to_course.html.erb @@ -5,7 +5,7 @@
    发送到
    diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index 095e09027..85d5e7104 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -2,7 +2,7 @@
    发送到
    diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb index 0fb38f8df..d4c293304 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -3,7 +3,7 @@
    发送到
    From 38cc3c20100f669b79b3c808452efd2da9ad9a45 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 11:31:31 +0800 Subject: [PATCH 24/38] =?UTF-8?q?=E5=8F=91=E9=80=81=E8=BF=87=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E5=9C=A8=E9=A1=B9=E7=9B=AE=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 83a794cd9..15ddf0435 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2132,6 +2132,7 @@ class UsersController < ApplicationController # 添加资源到对应的项目 def add_exist_file_to_project @flag = true + # 发送单个资源 if params[:send_id].present? send_id = params[:send_id] project_ids = params[:projects_ids] @@ -2168,6 +2169,8 @@ class UsersController < ApplicationController quotes = ori.quotes.to_i + 1 ori.update_attribute(:quotes, quotes) unless ori.nil? ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + # 项目中添加动态 + ForgeActivity.create(:user_id => User.current.id, :project_id => project_id, :forge_act_id => attach_copied_obj.id, :forge_act_type => "Attachment" ) end unless Project.find(project_id).project_score.nil? Project.find(project_id).project_score.update_attribute(:attach_num, @@ -2176,6 +2179,7 @@ class UsersController < ApplicationController end @ori = ori end + # 发送多个资源 elsif params[:send_ids].present? send_ids = params[:send_ids].split(",") project_ids = params[:projects_ids] @@ -2214,6 +2218,8 @@ class UsersController < ApplicationController quotes = ori.quotes.to_i + 1 ori.update_attribute(:quotes, quotes) unless ori.nil? ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + # 项目中添加动态 + ForgeActivity.create(:user_id => User.current.id, :project_id => project_id, :forge_act_id => attach_copied_obj.id, :forge_act_type => "Attachment" ) end unless Project.find(project_id).project_score.nil? Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1) From 77e4a66e7e166096c321292ab6d48730c240607a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 13:50:15 +0800 Subject: [PATCH 25/38] =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=90=8E=E5=BC=95=E8=B5=B7=E7=9A=84=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_friend_group.html.erb | 2 +- app/views/projects/_research_team.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/projects/_friend_group.html.erb b/app/views/projects/_friend_group.html.erb index feb4fb3ac..d50f96f22 100644 --- a/app/views/projects/_friend_group.html.erb +++ b/app/views/projects/_friend_group.html.erb @@ -22,7 +22,7 @@ <%= link_to "(#{@project.project_score.attach_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %> + <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml105" %> <% end %>
    <% end %> \ No newline at end of file diff --git a/app/views/projects/_research_team.html.erb b/app/views/projects/_research_team.html.erb index 7c8d80c59..1d2debdfe 100644 --- a/app/views/projects/_research_team.html.erb +++ b/app/views/projects/_research_team.html.erb @@ -33,7 +33,7 @@ <%= link_to "(#{@project.project_score.attach_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %> + <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml105" %> <% end %>
    <% end%> From 4e3a7e8df121102c4302e112c2c26ef2812492e8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 14:11:51 +0800 Subject: [PATCH 26/38] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E2=80=9C=E6=97=A5=E6=9C=9F=E2=80=9D--=E3=80=8B=E2=80=9C?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=97=A5=E6=AD=A2=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_versions.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/settings/_new_versions.html.erb b/app/views/projects/settings/_new_versions.html.erb index 557025eaa..68d35f9af 100644 --- a/app/views/projects/settings/_new_versions.html.erb +++ b/app/views/projects/settings/_new_versions.html.erb @@ -73,7 +73,7 @@
  • - + <%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>" fl" %> <%= calendar_for('version_effective_date') %>
  • From 87e1e0c4b106e6eb06477f4f88aad1f74d940764 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jul 2016 14:45:06 +0800 Subject: [PATCH 27/38] =?UTF-8?q?rake=E4=BB=BB=E5=8A=A1=EF=BC=8C=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8E=E8=8E=B7=E5=8F=96=E6=9C=80=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/update_homework.rake | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/tasks/update_homework.rake b/lib/tasks/update_homework.rake index d97004c8c..33bcc2231 100644 --- a/lib/tasks/update_homework.rake +++ b/lib/tasks/update_homework.rake @@ -15,11 +15,9 @@ namespace :update_homework do unless student_works.nil? student_works.each do |s| project = Project.find s.project_id - unless project.nil? && project.gpid.blank? + if !project.nil? && !project.gpid.blank? project_time=project.updated_on project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last - puts "the time is =========================> #{time}" - puts "the project_time is =========================> #{project_time}" if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') #if format_time(time) < format_time(project_time) time = project_time @@ -31,9 +29,6 @@ namespace :update_homework do changesets = g.commits(project.gpid, :ref_name => default_branch) changesets_latest_coimmit = changesets[0] unless changesets[0].blank? - puts "the time is =========================> #{time}" - puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}" - puts "the distance time is =========================> #{changesets_latest_coimmit.created_at.to_time > Time.now}" if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S') #if format_time(time) < format_time(changesets_latest_coimmit.created_at) time = changesets_latest_coimmit.created_at.to_time From b7e6725e1fd730c54feba9e6a2e1c409ce542a18 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jul 2016 14:48:39 +0800 Subject: [PATCH 28/38] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=90=8D=E7=A7=B0=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 13 ++- .../admin/_rename_syllabus_title.html.erb | 3 + app/views/admin/syllabuses.html.erb | 85 ++++++++++++++----- app/views/admin/update_syllabus_title.js.erb | 1 + app/views/layouts/_syllabus_info.html.erb | 4 +- app/views/layouts/_syllabus_title.html.erb | 2 +- app/views/layouts/base_syllabus.html.erb | 20 +++-- .../syllabuses/edit_syllabus_title.js.erb | 1 + config/routes.rb | 1 + public/javascripts/syllabus.js | 35 +++++--- 10 files changed, 121 insertions(+), 44 deletions(-) create mode 100644 app/views/admin/_rename_syllabus_title.html.erb create mode 100644 app/views/admin/update_syllabus_title.js.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 36a5d9d4f..6c62c642a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -96,7 +96,7 @@ class AdminController < ApplicationController def courses @name = params[:name].to_s.strip.downcase if @name && @name != "" - @courses = Course.select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)} + @courses = Course.select{ |course| course.teacher && ((course.teacher.show_name).include?(@name) || course.name.include?(@name))} @courses = @courses.sort{|x, y| y.created_at <=> x.created_at} else @courses = Course.order('created_at desc') @@ -135,6 +135,17 @@ class AdminController < ApplicationController end end + #修改课程名称 + def update_syllabus_title + @syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first + unless @syllabus.nil? + @syllabus.update_column("title", params[:name]) + respond_to do |format| + format.js + end + end + end + #管理员界面精品课程列表 def excellent_courses @courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 ) diff --git a/app/views/admin/_rename_syllabus_title.html.erb b/app/views/admin/_rename_syllabus_title.html.erb new file mode 100644 index 000000000..e3a175215 --- /dev/null +++ b/app/views/admin/_rename_syllabus_title.html.erb @@ -0,0 +1,3 @@ + + <%= syllabus.title %> + \ No newline at end of file diff --git a/app/views/admin/syllabuses.html.erb b/app/views/admin/syllabuses.html.erb index 782f6b01c..194091abc 100644 --- a/app/views/admin/syllabuses.html.erb +++ b/app/views/admin/syllabuses.html.erb @@ -46,10 +46,8 @@ <%= syllabus.id %> - - - <%= link_to(syllabus.title, syllabus_path(syllabus.id)) %> - + + <%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %> @@ -89,23 +87,24 @@