From a9ee1d10cd62636c8c4ee1076aa65c7c1235dca6 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jul 2016 11:19:56 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E5=91=98=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=EF=BC=8C=E8=B7=B3=E8=BD=AC=E8=87=B3=E8=AF=A5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E7=9A=84=E6=88=90=E5=91=98=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 +++- app/views/users/_user_message_course.html.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a9d84c2d9..601b9e4da 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -301,7 +301,6 @@ class CoursesController < ApplicationController def member ## 有角色参数的才是课程,没有的就是项目 if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - @render_file = 'new_member_list' @score_sort_by = "desc" @sort_type = params[:sort_type] ? params[:sort_type] : "score" @@ -414,6 +413,9 @@ class CoursesController < ApplicationController end def settings + #添加成员消息状态 + join_course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?", User.current.id, 'JoinCourse', @course.id, 1, 0) + join_course_messages.update_all(:viewed => true) if User.current.allowed_to?(:as_teacher,@course) @select_tab = params[:tab] @issue_custom_fields = IssueCustomField.sorted.all diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index c27002d24..fa2be7ae1 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -653,7 +653,7 @@ ">您增加了新的班级成员:
  • - <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> + <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", {:controller => 'courses', :action => 'settings', :id => ma.course_id, :tab=>'member'}, :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> From 9e5e7a75b0a3a81ba728538c5199e9976d283e2c Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jul 2016 14:09:41 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E5=90=8E=EF=BC=8C=E8=80=81?= =?UTF-8?q?=E5=B8=88=E7=82=B9=E5=87=BB=E6=A8=A1=E6=8B=9F=E7=AD=94=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=8D=B4=E5=BC=B9=E5=87=BA=E5=8C=BF=E8=AF=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/new_user_commit_homework.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index 238102879..84503f837 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -7,7 +7,7 @@ $(function(){ $("#RSide").removeAttr("id"); $("#Container").css("width","1000px"); - <%if @homework.anonymous_comment == 0 && @homework.homework_detail_manual.comment_status != 1%> + <%if !@is_test && @homework.anonymous_comment == 0 && @homework.homework_detail_manual.comment_status != 1%> $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>'); showModal('ajax-modal', '360px'); $('#ajax-modal').siblings().remove(); From 8e3488132b07b3fb3abb7d711f8eec4a063c88d7 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jul 2016 14:43:47 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=9A=E5=85=AC=E5=85=B1=E9=A2=98=E5=BA=93=E4=B8=AD=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E5=8D=B4=E6=98=AF=E6=88=91=E7=9A=84=E9=A2=98?= =?UTF-8?q?=E5=BA=93=EF=BC=8C=E6=88=91=E7=9A=84=E9=A2=98=E5=BA=93=E4=B8=AD?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E5=8D=B4=E6=98=AF=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 6 +++--- app/views/users/_show_user_homeworks.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f5684f202..c870fdc3b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -709,9 +709,9 @@ class UsersController < ApplicationController @user = User.current @select_course = params[:select_course] ? 1 : 0 #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") - visible_course = Course.where("is_public = 1 && is_delete = 0") - visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" - @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc") + courses = @user.courses.where("is_delete = 1") + course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")" + @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order} #{@b_sort}") @type = params[:type] @limit = 15 @is_remote = true diff --git a/app/views/users/_show_user_homeworks.html.erb b/app/views/users/_show_user_homeworks.html.erb index 46e075412..f54f49865 100644 --- a/app/views/users/_show_user_homeworks.html.erb +++ b/app/views/users/_show_user_homeworks.html.erb @@ -1,8 +1,8 @@
    选用题库中的题目
    - 公共题库 - 我的题库 + 我的题库 + 公共题库
    From fdf925a0b8fbef14a33b80a4a2c20df962af89bf Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 18 Jul 2016 16:40:04 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=95=99=E8=A8=80=E5=8A=A8=E6=80=81=EF=BC=9A=E5=A6=82=E5=9B=BE?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E7=95=99=E8=A8=80=E5=8D=B4=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E2=80=9C=E5=B1=95=E5=BC=80=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E2=80=9D=E5=90=8E=E5=8F=88=E5=8F=AF=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E5=88=B7=E6=96=B0=E7=BD=91=E9=A1=B5=E5=90=8E?= =?UTF-8?q?=E5=8F=88=E5=88=A0=E9=99=A4=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 1 - .../users/_course_journalsformessage.html.erb | 6 ++-- app/views/users/_journal_replies.html.erb | 2 +- .../users/_journal_reply_banner.html.erb | 2 +- .../users/_user_journalsformessage.html.erb | 6 ++-- app/views/users/all_journals.js.erb | 2 +- public/javascripts/application.js | 34 ------------------- 7 files changed, 9 insertions(+), 44 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c870fdc3b..ec95ce38b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3315,7 +3315,6 @@ class UsersController < ApplicationController @journals = get_all_children(journals, obj) @type = 'JournalsForMessage' @user_activity_id = params[:div_id].to_i if params[:div_id] - @allow_delete = params[:allow_delete] when 'Issue' obj = Issue.where('id = ?', params[:id].to_i).first @journals = obj.journals.reorder("created_on desc") diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index 64ba9f6df..c9fe344ba 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -40,16 +40,16 @@
    <% 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)) %> + <%# 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/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :allow_delete => allow_delete} %> + <%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :allow_delete => allow_delete, :activity_id =>activity.id}%> + <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
    <% end %> diff --git a/app/views/users/_journal_replies.html.erb b/app/views/users/_journal_replies.html.erb index 7fc708ebb..e6b9f6f7b 100644 --- a/app/views/users/_journal_replies.html.erb +++ b/app/views/users/_journal_replies.html.erb @@ -68,7 +68,7 @@ :title => l(:button_reply)) %> - <% if allow_delete %> + <% if comment.creator_user == User.current || User.current.admin? %> <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> <% end %> diff --git a/app/views/users/_journal_reply_banner.html.erb b/app/views/users/_journal_reply_banner.html.erb index c231f473d..25175542f 100644 --- a/app/views/users/_journal_reply_banner.html.erb +++ b/app/views/users/_journal_reply_banner.html.erb @@ -10,7 +10,7 @@
    <%#= format_date(activity.updated_on) %>
    <%if count>3 %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index 4fb79ee2d..dfbe751ef 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -64,15 +64,15 @@
    <% all_comments = []%> <% count=get_all_children(all_comments, activity).count %> - <% allow_delete = (activity.user == User.current || User.current.admin?) %> + <%# allow_delete = (activity.user == User.current || User.current.admin?) %>
    - <%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :allow_delete => allow_delete} %> + <%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :allow_delete => allow_delete, :activity_id =>activity.id}%> + <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
    <% end %> diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index b7485def3..b5ccdad9e 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -1,7 +1,7 @@ <% if params[:type] == 'HomeworkCommon' %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>'); <% elsif params[:type] == 'JournalsForMessage' %> -$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>'); +$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>'); <% elsif params[:type] == 'Message' %> $('#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' %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fb7c6cda2..c3435d153 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1340,40 +1340,6 @@ function expand_all_reply(container, btnid, id, type, div_id) { } } -function expand_journal_reply(container, btnid, id, type, div_id, allow_delete) { - var target = $(container); - var btn = $(btnid); - if (btn.data('init') == '0') { - btn.data('init', 1); - $.get( - '/users/all_journals', - { - type: type, - id: id, - div_id: div_id, - allow_delete: allow_delete - }, - function(data) { - - } - ); - btn.html('收起回复'); - //target.show(); - } else if(btn.data('init') == '1') { - btn.data('init', 3); - btn.html('展开更多'); - target.hide(); - target.eq(0).show(); - target.eq(1).show(); - target.eq(2).show(); - } - else { - btn.data('init', 1); - btn.html('收起回复'); - target.show(); - } -} - function expand_message_reply(container, btnid, id, type, div_id, is_course, is_board) { var target = $(container); var btn = $(btnid); From 7853b8aa541f7aaac462849666da9869bb716c28 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 20 Jul 2016 17:00:18 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB=E3=80=81=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E6=A0=8F=E7=9B=AE=E9=80=9A=E7=9F=A5=E7=9A=84=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=92=8C=E8=AF=A6=E6=83=85=E9=A1=B5=E7=9A=84=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E5=9B=9E=E5=A4=8D=EF=BC=8C=20=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=BB=A3=E7=A0=81=E7=9A=84=E6=95=B4=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 3 +- app/controllers/blog_comments_controller.rb | 2 +- app/controllers/comments_controller.rb | 46 ++++++- app/controllers/messages_controller.rb | 6 +- app/controllers/users_controller.rb | 12 ++ app/models/comment.rb | 3 +- app/services/courses_service.rb | 2 +- app/views/blogs/_homepage.html.erb | 4 +- .../comments/_simple_ke_reply_form.html.erb | 20 +++ app/views/comments/destroy.js.erb | 10 ++ app/views/comments/quote.js.erb | 8 ++ app/views/comments/reply.js.erb | 10 ++ app/views/news/_course_show.html.erb | 111 +-------------- app/views/news/_news_all_replies.html.erb | 126 ++++++++++++++++++ app/views/news/_organization_show.html.erb | 104 +-------------- app/views/news/_project_show.html.erb | 104 +-------------- app/views/news/edit.html.erb | 2 +- .../_org_subfield_message.html.erb | 2 +- .../organizations/_org_subfield_news.html.erb | 2 +- .../organizations/_show_org_document.html.erb | 2 +- app/views/projects/_project_news.html.erb | 2 +- .../users/_blog_comment_reply_banner.html.erb | 18 --- .../users/_blog_comments_replies.html.erb | 60 --------- app/views/users/_course_homework.html.erb | 20 +-- .../users/_course_journalsformessage.html.erb | 6 +- app/views/users/_course_message.html.erb | 2 +- app/views/users/_course_news.html.erb | 48 +++---- app/views/users/_homework_replies.html.erb | 75 ----------- .../users/_journal_reply_banner.html.erb | 18 --- app/views/users/_message_replies.html.erb | 60 ++++++++- .../users/_message_reply_banner.html.erb | 18 --- ...eplies.html.erb => _news_replies.html.erb} | 42 ++++-- .../users/_org_document_replies.html.erb | 60 --------- app/views/users/_project_message.html.erb | 2 +- app/views/users/_project_news.html.erb | 4 +- app/views/users/_reply_banner.html.erb | 26 +++- app/views/users/_reply_to.html.erb | 13 +- app/views/users/_user_blog.html.erb | 4 +- .../users/_user_homework_detail.html.erb | 20 +-- .../users/_user_journalsformessage.html.erb | 5 +- app/views/users/_user_syllabus_list.html.erb | 2 +- app/views/users/all_journals.js.erb | 10 +- app/views/users/show_all_replies.js.erb | 2 +- config/routes.rb | 6 + .../20160719013955_add_column_to_comments.rb | 7 + db/schema.rb | 7 +- lib/redmine.rb | 2 +- 47 files changed, 437 insertions(+), 681 deletions(-) create mode 100644 app/views/comments/_simple_ke_reply_form.html.erb create mode 100644 app/views/comments/destroy.js.erb create mode 100644 app/views/comments/quote.js.erb create mode 100644 app/views/comments/reply.js.erb create mode 100644 app/views/news/_news_all_replies.html.erb delete mode 100644 app/views/users/_blog_comment_reply_banner.html.erb delete mode 100644 app/views/users/_blog_comments_replies.html.erb delete mode 100644 app/views/users/_homework_replies.html.erb delete mode 100644 app/views/users/_journal_reply_banner.html.erb delete mode 100644 app/views/users/_message_reply_banner.html.erb rename app/views/users/{_journal_replies.html.erb => _news_replies.html.erb} (58%) delete mode 100644 app/views/users/_org_document_replies.html.erb create mode 100644 db/migrate/20160719013955_add_column_to_comments.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b1aae9b26..d14bccc4e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -507,7 +507,8 @@ class ApplicationController < ActionController::Base # render_404 # end - def self.model_object(model) + def self. + model_object(model) self.model_object = model end diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index dcab1b360..dcd549d76 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -144,7 +144,7 @@ class BlogCommentsController < ApplicationController if params[:parent_id] @blogComment.content = params[:blog_comment][:content] parent = BlogComment.find params[:parent_id] - @blogComment.reply_id = params[:reply_id] + @blogComment.reply_id = params[:id] parent.children << @blogComment else @quote = params[:quote][:quote] || "" diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 5966b310f..9226b904c 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -19,8 +19,8 @@ class CommentsController < ApplicationController default_search_scope :news include ApplicationHelper model_object News - before_filter :find_model_object - before_filter :find_project_from_association + before_filter :find_model_object, :except => [:reply, :quote] + before_filter :find_project_from_association, :except => [:reply, :quote] before_filter :authorize def create @@ -73,7 +73,46 @@ class CommentsController < ApplicationController def destroy @news.comments.find(params[:comment_id]).destroy - redirect_to news_url(@news) + if params[:user_activity_id] + @user_activity_id = params[:user_activity_id] + respond_to do |format| + format.js + return + end + else + redirect_to news_url(@news) + end + end + + def quote + @comment = Comment.find(params[:id]) + respond_to do | format| + format.js + end + end + + def reply + comment = Comment.find(params[:id]) + @news = News.find comment.commented_id + new_comment = @news.comments.build(:author_id => User.current.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id) + @user_activity_id = params[:user_activity_id] + if new_comment.save + update_course_activity(@news.class,@news.id) + update_user_activity(@news.class,@news.id) + update_org_activity(@news.class,@news.id) + if @user_activity_id + respond_to do |format| + format.js + return + end + else + respond_to do |format| + format.html { + redirect_to news_path(@news) + } + end + end + end end private @@ -87,5 +126,4 @@ class CommentsController < ApplicationController @news end - end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index f5ad89832..160383e92 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -140,15 +140,15 @@ class MessagesController < ApplicationController def reply if params[:parent_id] parent = Message.find params[:parent_id] + @topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i) @reply = Message.new @reply.author = User.current @reply.board = parent.board @reply.content = params[:content] - @reply.subject = "RE: #{parent.subject}" - @reply.reply_id = params[:reply_id] + @reply.subject = "RE: #{@topic.subject}" + @reply.reply_id = params[:id] # @reply.reply_id = params[:id] parent.children << @reply - @topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i) @user_activity_id = params[:user_activity_id] if params[:user_activity_id] @is_course = params[:is_course] if params[:is_course] @is_board = params[:is_board] if params[:is_board] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ec95ce38b..6b9e8f4c9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -94,6 +94,10 @@ class UsersController < ApplicationController @comment = Message.find params[:comment].to_i when 'BlogComment' @comment = BlogComment.find params[:comment].to_i + when 'BlogComment' + @comment = OrgDocumentComment.find params[:comment].to_i + when 'Comment' + @comment = Comment.find params[:comment].to_i end end @@ -133,6 +137,11 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'OrgDocumentComment' + when 'News' + @reply = Comment.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'News' end respond_to do |format| format.js @@ -3306,6 +3315,8 @@ class UsersController < ApplicationController when 'News' obj = News.where('id = ?', params[:id].to_i).first @journals = obj.comments.reorder("created_on desc") + @type = 'News' + @user_activity_id = params[:div_id].to_i if params[:div_id] when 'Syllabus' obj = Syllabus.where('id = ?', params[:id].to_i).first @journals = obj.comments.reorder("created_on desc") @@ -3327,6 +3338,7 @@ class UsersController < ApplicationController @journals = get_all_children(comments, obj) when 'HomeworkCommon' obj = HomeworkCommon.where('id = ?', params[:id].to_i).first + @type = 'HomeworkCommon' @journals = obj.journals_for_messages.reorder("created_on desc") @is_in_course = params[:is_in_course].to_i if params[:is_in_course] @course_activity = params[:course_activity].to_i if params[:course_activity] diff --git a/app/models/comment.rb b/app/models/comment.rb index 80b52a8f4..633c9a825 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -33,10 +33,11 @@ class Comment < ActiveRecord::Base :title=>Proc.new {|o| "RE: #{o.commented.title}" }, :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} } + acts_as_tree :counter_cache => :comments_count, :order => "#{Comment.table_name}.created_on ASC" belongs_to :commented, :polymorphic => true, :counter_cache => true,:touch => true belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' validates_presence_of :commented, :author, :comments - safe_attributes 'comments' + safe_attributes 'comments','parent_id','reply_id','comments_count' after_create :send_mail, :act_as_system_message, :act_as_student_score after_destroy :down_course_score diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index a55a81e89..7782c00a0 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -162,7 +162,7 @@ class CoursesService raise '403' end end - @comments = @news.comments + @comments = @news.comments.reorder("created_on desc") @comments.reverse! if current_user.wants_comments_in_reverse_order? {:news => @news,:comments => @comments} diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb index d5a5c0d64..a16547836 100644 --- a/app/views/blogs/_homepage.html.erb +++ b/app/views/blogs/_homepage.html.erb @@ -51,13 +51,13 @@ <% all_comments = []%> <% count=get_all_children(all_comments, activity).count %>
    - <%= render :partial => 'users/blog_comment_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/blog_comments_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
    <% end %> diff --git a/app/views/comments/_simple_ke_reply_form.html.erb b/app/views/comments/_simple_ke_reply_form.html.erb new file mode 100644 index 000000000..764d4a1af --- /dev/null +++ b/app/views/comments/_simple_ke_reply_form.html.erb @@ -0,0 +1,20 @@ +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    + <% if User.current.logged? %> +
    + <%= form_for @comment, :as => :reply, :url => {:controller => 'comments',:action => 'reply', :id => @comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %> +
    + + +
    +

    + <% end%> +
    + <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/comments/destroy.js.erb b/app/views/comments/destroy.js.erb new file mode 100644 index 000000000..e8f425a85 --- /dev/null +++ b/app/views/comments/destroy.js.erb @@ -0,0 +1,10 @@ +<% if @user_activity_id %> + <% if @news.project_id && @news.project_id != -1 %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% elsif @news.course_id %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% elsif @news.org_subfield_id %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% end %> +<% end %> +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>"); diff --git a/app/views/comments/quote.js.erb b/app/views/comments/quote.js.erb new file mode 100644 index 000000000..cc5bc98ac --- /dev/null +++ b/app/views/comments/quote.js.erb @@ -0,0 +1,8 @@ +if($("#reply_message_<%= @comment.id%>").length > 0) { + $("#reply_message_<%= @comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'comments/simple_ke_reply_form', :locals => {:reply => @comment}) %>"); + $(function(){ + sd_create_editor_from_data(<%= @comment.id%>,null,"100%", "<%=@comment.class.to_s%>"); + }); +}else if($("#reply_to_message_<%= @comment.id %>").length >0) { + $("#reply_to_message_<%= @comment.id%>").replaceWith("

    "); +} \ No newline at end of file diff --git a/app/views/comments/reply.js.erb b/app/views/comments/reply.js.erb new file mode 100644 index 000000000..e8f425a85 --- /dev/null +++ b/app/views/comments/reply.js.erb @@ -0,0 +1,10 @@ +<% if @user_activity_id %> + <% if @news.project_id && @news.project_id != -1 %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% elsif @news.course_id %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% elsif @news.org_subfield_id %> + $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); + <% end %> +<% end %> +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>"); diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index fc877d809..c8068e425 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <% end %> @@ -97,97 +82,7 @@
    -
    -
    回复 - <%= @comments.count>0 ? "(#{@comments.count})" : "" %> - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%> - -
    -
    - <% unless @comments.empty? %> -
    - <% @comments.each_with_index do |reply,i| %> - -
    -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
    -
    -
    - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
    -
    - <%= reply.comments.html_safe%> -
    -
    - <%= format_time(reply.created_on) %> - -
    -

    -
    -
    -
    - <% end %> -
    - - <% end %> -
    - <% if @news.commentable? %> -
    - -
    -
    - <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> -
    - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :comments, :editor_id => 'comment_editor', - :owner_id => @comment.nil? ? 0: @comment.id, - :owner_type => OwnerTypeHelper::COMMENT, - :width => '99%', - :height => 100, - :minHeight=>100, - :input_html => { :id => 'comment_content', - :class => 'talk_text fl', - :maxlength => 5000 }%> -
    -

    -

    - - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

    - <% end %> -
    -
    -
    - <% end %> + <%= render :partial => 'news/news_all_replies' %>
    +
  • +
    + <%= 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? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents_no_root parents_rely, comment %> + <% length = parents_rely.length %> +
    + <% if length <= 3 %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> + <% else %> +
    +
    +
    + <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %> +
    + <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> +
    +
    + + + <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %> +
    + <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> +
    + <% end %> +
    + <% 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 => 'comments',:action => 'quote', :id => comment}, + :remote => true, + :method => 'get', + :title => l(:button_reply))%> + + + <%= link_to( + l(:button_delete), + {:controller => 'comments', + :action => 'destroy', :id => @news, + :comment_id => comment}, + :method => :delete, + :class => 'fr mr20', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete) + ) if @news.author == User.current %> + +
    +
    +
    +

    + <% end %> +
    +
    +
  • + <% end %> + + +<% end %> +
    +<% if @news.commentable? %> +
    + +
    +
    + <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
    + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +

    + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

    + <% end %> +
    +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb index 7eecf43ab..9790c1305 100644 --- a/app/views/news/_organization_show.html.erb +++ b/app/views/news/_organization_show.html.erb @@ -1,5 +1,5 @@ <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <% end %> @@ -87,90 +72,7 @@
    - <% unless @comments.empty? %> -
    -
    回复(<%=@comments.count %>)
    -
    -
    -
    - <% @comments.each_with_index do |reply,i| %> - -
    -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
    -
    -
    - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
    -
    - <%= reply.comments.html_safe%> -
    -
    - <%= format_time(reply.created_on) %> - -
    -

    -
    -
    -
    - <% end %> -
    - - <% end %> -
    - <% if @news.commentable? %> -
    - -
    -
    - <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> -
    - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :comments, :editor_id => 'comment_editor', - :owner_id => @comment.nil? ? 0: @comment.id, - :owner_type => OwnerTypeHelper::COMMENT, - :width => '99%', - :height => 100, - :minHeight=>100, - :input_html => { :id => 'comment_content', - :class => 'talk_text fl', - :maxlength => 5000 }%> -
    -

    -

    - - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

    - <% end %> -
    -
    -
    - <% end %> + <%= render :partial => 'news/news_all_replies' %>
    @@ -97,90 +82,7 @@
    - <% unless @comments.empty? %> -
    -
    回复(<%=@comments.count %>)
    -
    -
    -
    - <% @comments.each_with_index do |reply,i| %> - -
    -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
    -
    -
    - <% if reply.try(:author).try(:realname) == ' ' %> - <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% else %> - <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> - <% end %> -
    -
    - <%= reply.comments.html_safe%> -
    -
    - <%= format_time(reply.created_on) %> - -
    -

    -
    -
    -
    - <% end %> -
    - - <% end %> -
    - <% if @news.commentable? %> -
    - -
    -
    - <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> -
    - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :comments, :editor_id => 'comment_editor', - :owner_id => @comment.nil? ? 0: @comment.id, - :owner_type => OwnerTypeHelper::COMMENT, - :width => '99%', - :height => 100, - :minHeight=>100, - :input_html => { :id => 'comment_content', - :class => 'talk_text fl', - :maxlength => 5000 }%> -
    -

    -

    - - <%= l(:label_cancel_with_space) %> - - - <%= l(:label_comment_with_space) %> - -

    - <% end %> -
    -
    -
    - <% end %> + <%= render :partial => 'news/news_all_replies' %>
    -
  • -
    - <%= 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, :homepage => homepage}, - :remote => true, - :method => 'get', - :title => l(:button_reply)) if !comment.root.locked? %> - - - <% if comment.author == User.current %> - <%= link_to( - l(:button_delete), - {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage}, - :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/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 783193e46..874a6b403 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -294,28 +294,12 @@ <% count=activity.journals_for_messages.count %>
    -
    -
    回复 - ︿ - <%= count>0 ? "(#{count})" : "" %> - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - -
    -
    - <%if count>3 %> - - <% end %> -
    + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity} %> <% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %>
    - <%=render :partial => 'users/homework_replies', :locals => {:comments => comments, :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id} %> + <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id} %>
    <% end %> diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index c9fe344ba..3225a1a8b 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -40,16 +40,14 @@
    <% 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/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
    <% end %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 48daa6e95..0c16a4367 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -81,7 +81,7 @@ <% all_comments = []%> <% count=get_all_children(all_comments, 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} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 18f16b068..f46282ff8 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -62,6 +62,7 @@
    + <% count=activity.comments.count %>
    <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> @@ -69,31 +70,32 @@ <% comments = activity.comments.reorder("created_on desc").limit(3) %> <% if count > 0 %>
    - <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'News', :activity_id => activity.id} %> +
    + <% end %> + <% if activity.commentable? %> +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    +
    + <% if User.current.logged? %> +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + +
    + + +
    +

    + <% end%> +
    + <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
    +
    +
    <% end %> - -
    -
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
    -
    - <% if User.current.logged? %> -
    - <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> - -
    - - -
    -

    - <% end%> -
    - <% else %> - <%= render :partial => "users/show_unlogged" %> - <% end %> -
    -
    -
    -
    -
  • -
    - <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> -
    -
    -
    - <%= link_to comment.user.show_name, user_path(comment.user_id), :class => "newsBlue mr10 f14" %> - <%= time_from_now(comment.created_on) %> -
    - <% unless comment.m_parent_id.nil? %> - <% parents_rely = [] %> - <% parents_rely = get_reply_parents parents_rely, comment %> - <% length = parents_rely.length %> -
    - <% if length <= 3 %> - <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> - <% else %> -
    -
    -
    - <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %> -
    - <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> -
    -
    - - - <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %> -
    - <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> -
    - <% end %> -
    - <% end %> -
    - <%= comment.notes.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 => 'HomeworkCommon', :is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, - :remote => true, - :method => 'get', - :title => l(:button_reply)) %> - - - - <% if User.current.admin? ||is_teacher || comment.user == User.current%> - <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, - :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> - <% end %> - -
    -
    -
    -

    -
    -
    -
  • - <% end %> - \ No newline at end of file diff --git a/app/views/users/_journal_reply_banner.html.erb b/app/views/users/_journal_reply_banner.html.erb deleted file mode 100644 index 25175542f..000000000 --- a/app/views/users/_journal_reply_banner.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -
    -
    - 回复 - ︿ - <%= count>0 ? "(#{count})" : "" %> - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - -
    -
    <%#= format_date(activity.updated_on) %>
    - <%if count>3 %> - - <% end %> -
    \ No newline at end of file diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb index c6f9d91b0..10a8e2b55 100644 --- a/app/views/users/_message_replies.html.erb +++ b/app/views/users/_message_replies.html.erb @@ -13,7 +13,7 @@
    <%= 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) %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
    <% if !comment.parent.nil? && !comment.parent.parent.nil? %> <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> @@ -28,6 +28,7 @@ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% if type == 'Message' %> <%= link_to( l(:button_reply), @@ -37,7 +38,7 @@ :title => l(:button_reply)) %> - <% if comment.course_destroyable_by?(User.current) %> + <% if comment.course_destroyable_by?(User.current) %> <%= link_to( l(:button_delete), delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board), @@ -48,6 +49,61 @@ :title => l(:button_delete) ) %> <% end %> + <% elsif type == 'JournalsForMessage' %> + + <%= 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 || User.current.admin? %> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> + <% end %> + <% elsif type == 'OrgDocumentComment' %> + + <%= 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 %> + <% elsif type == 'BlogComment' %> + + <%= 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, :homepage => homepage}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) if !comment.root.locked? %> + + + <% if comment.author == User.current %> + <%= link_to( + l(:button_delete), + {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage}, + :method => :delete, + :remote => true, + :class => 'fr mr20', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete)) %> + <% end %> + <% end %>
    diff --git a/app/views/users/_message_reply_banner.html.erb b/app/views/users/_message_reply_banner.html.erb deleted file mode 100644 index 0c8cda379..000000000 --- a/app/views/users/_message_reply_banner.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -
    -
    - 回复 - ︿ - <%= count>0 ? "(#{count})" : "" %> - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> - -
    -
    <%#= format_date(activity.updated_on) %>
    - <%if count>3 %> - - <% end %> -
    \ No newline at end of file diff --git a/app/views/users/_journal_replies.html.erb b/app/views/users/_news_replies.html.erb similarity index 58% rename from app/views/users/_journal_replies.html.erb rename to app/views/users/_news_replies.html.erb index e6b9f6f7b..e6f28b653 100644 --- a/app/views/users/_journal_replies.html.erb +++ b/app/views/users/_news_replies.html.erb @@ -13,20 +13,20 @@
    <%= 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) %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
    - <% if !comment.parent.nil? && !comment.parent.parent.nil? %> + <% if !comment.parent.nil? %> <% parents_rely = [] %> - <% parents_rely = get_reply_parents_no_root parents_rely, comment %> + <% parents_rely = get_reply_parents parents_rely, comment %> <% length = parents_rely.length %>
    <% if length <= 3 %> - <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> <% else %>
    - <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
    <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
    @@ -56,22 +56,36 @@
    - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + + <%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %> - + <% if type == 'HomeworkCommon' %> + <%= 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}, + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, :remote => true, :method => 'get', :title => l(:button_reply)) %> - - - <% if comment.creator_user == User.current || User.current.admin? %> - <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id}, + + + <% if User.current.admin? ||is_teacher || comment.user == User.current%> + <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %> - <% end %> + <% end %> + <% elsif type == 'News' %> + + <%= 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)) %> + + + <%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) if News.find(activity_id).author == User.current %> + <% end %>
    diff --git a/app/views/users/_org_document_replies.html.erb b/app/views/users/_org_document_replies.html.erb deleted file mode 100644 index ce26cf70c..000000000 --- a/app/views/users/_org_document_replies.html.erb +++ /dev/null @@ -1,60 +0,0 @@ -
      - <% 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/_project_message.html.erb b/app/views/users/_project_message.html.erb index d1bb99296..df75e8385 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -82,7 +82,7 @@ <%# 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} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index cdceb490d..4c7ec2b04 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -62,11 +62,11 @@ <% count=activity.comments.count %>
    <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> - + <% comments = activity.comments.reorder("created_on desc").limit(3) %> <% if count > 0 %>
    - <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'News', :activity_id => activity.id} %>
    <% end %> diff --git a/app/views/users/_reply_banner.html.erb b/app/views/users/_reply_banner.html.erb index 25175542f..43aebb89c 100644 --- a/app/views/users/_reply_banner.html.erb +++ b/app/views/users/_reply_banner.html.erb @@ -10,9 +10,27 @@
    <%#= format_date(activity.updated_on) %>
    <%if count>3 %> + <% if activity.class.to_s == 'HomeworkCommon' && is_in_course == -1 %> + + 展开更多 + + <% elsif activity.class.to_s == 'HomeworkCommon' %> + + 展开更多 + + <% elsif activity.class.to_s == 'Message' %> + + 展开更多 + + <% elsif activity.class.to_s == 'BlogComment' %> + + 展开更多 + + <% else %> + + 展开更多 + + <% 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 cb8b2e0ff..d1aad2d48 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -33,7 +33,6 @@ <%= hidden_field_tag 'is_course', params[:is_course], :value => @is_course %> <%= hidden_field_tag 'is_board', params[:is_board], :value => @is_board %> <%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %> - <%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %> <%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@activity_id %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
    @@ -47,7 +46,6 @@ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_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 %> <%= hidden_field_tag 'homepage', params[:homepage], :value => @homepage %>
    @@ -65,7 +63,16 @@

    <% end%> - <% end %> + <% elsif @type == 'News' %> + <%= form_for('new_form', :url => {:controller => '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/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index a19bfc016..b6cd9ebc3 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -44,13 +44,13 @@ <% all_comments = []%> <% count=get_all_children(all_comments, activity).count %>
    - <%= render :partial => 'users/blog_comment_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/blog_comments_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0}%>
    <% end %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 4c8e17d5d..87277c80f 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -306,28 +306,12 @@ <% count=homework_common.journals_for_messages.count %>
    -
    -
    回复 - ︿ - <%= count>0 ? "(#{count})" : "" %> - - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%> - -
    -
    - <%if count>3 %> - - <% end %> -
    + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => homework_common, :user_activity_id => -1, :is_in_course => is_in_course,:course_activity=>-1} %> <% comments = homework_common.journals_for_messages.reorder("created_on desc").limit(3) %> <% if count > 0 %>
    - <%=render :partial => 'users/homework_replies', :locals => {:comments => comments, :is_in_course => is_in_course, :course_activity=> -1, :is_teacher => is_teacher, :user_activity_id => -1} %> + <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :is_in_course => is_in_course,:course_activity=>-1, :is_teacher => is_teacher, :user_activity_id => -1} %>
    <% end %> diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index dfbe751ef..7880cde99 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -64,15 +64,14 @@
    <% all_comments = []%> <% count=get_all_children(all_comments, activity).count %> - <%# allow_delete = (activity.user == User.current || User.current.admin?) %>
    - <%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> + <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> <% all_comments = []%> <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
    - <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
    <% end %> diff --git a/app/views/users/_user_syllabus_list.html.erb b/app/views/users/_user_syllabus_list.html.erb index 8e33696d6..b8bc55d47 100644 --- a/app/views/users/_user_syllabus_list.html.erb +++ b/app/views/users/_user_syllabus_list.html.erb @@ -59,7 +59,7 @@ <% end %> <% if courses.count > 3 %>
  • - 共<%=courses.count %>个课程,点击全部展开 + 共<%=courses.count %>个班级,点击全部展开
  • <% end %> <% end %> diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index b5ccdad9e..78640033a 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -1,13 +1,15 @@ <% if params[:type] == 'HomeworkCommon' %> -$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>'); +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>'); <% elsif params[:type] == 'JournalsForMessage' %> -$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>'); +$('#reply_div_<%= @user_activity_id %>').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}) %>'); <% elsif params[:type] == 'Message' %> $('#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}) %>'); +$('#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, :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}) %>'); +$('#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}) %>'); +<% elsif params[:type] == 'News' %> +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_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 %> diff --git a/app/views/users/show_all_replies.js.erb b/app/views/users/show_all_replies.js.erb index 2d4321bce..7b47b29d8 100644 --- a/app/views/users/show_all_replies.js.erb +++ b/app/views/users/show_all_replies.js.erb @@ -1,7 +1,7 @@ <% unless @comment.parent.nil? %> <% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>"); - <% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' ) %> + <% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment') %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>"); <% else %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>"); diff --git a/config/routes.rb b/config/routes.rb index 539d78df3..83d3bc68c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -207,6 +207,12 @@ RedmineApp::Application.routes.draw do resources :apply_project_masters delete 'apply_project_masters', :to => 'apply_project_masters#delete' + resources :comments do + member do + post 'reply' + get 'quote' + end + end # resources :organization, :except => [:show] do # # end diff --git a/db/migrate/20160719013955_add_column_to_comments.rb b/db/migrate/20160719013955_add_column_to_comments.rb new file mode 100644 index 000000000..6d0201c49 --- /dev/null +++ b/db/migrate/20160719013955_add_column_to_comments.rb @@ -0,0 +1,7 @@ +class AddColumnToComments < ActiveRecord::Migration + def change + add_column :comments, :parent_id, :integer + add_column :comments, :comments_count, :integer, :default => 0 + add_column :comments, :reply_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 32d29d31a..928adfe9b 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 => 20160709015740) do +ActiveRecord::Schema.define(:version => 20160719013955) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -387,6 +387,9 @@ ActiveRecord::Schema.define(:version => 20160709015740) do t.text "comments" t.datetime "created_on", :null => false t.datetime "updated_on", :null => false + t.integer "parent_id" + t.integer "comments_count", :default => 0 + t.integer "reply_id" end add_index "comments", ["author_id"], :name => "index_comments_on_author_id" @@ -562,9 +565,9 @@ ActiveRecord::Schema.define(:version => 20160709015740) do t.integer "excellent_option", :default => 0 t.integer "is_copy", :default => 0 t.integer "visits", :default => 0 + t.integer "syllabus_id" t.string "invite_code" t.string "qrcode" - t.integer "syllabus_id" end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true diff --git a/lib/redmine.rb b/lib/redmine.rb index cfd8b6824..ed40b4c04 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -198,7 +198,7 @@ Redmine::AccessControl.map do |map| map.project_module :news do |map| map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true - map.permission :comment_news, {:comments => :create} + map.permission :comment_news, {:comments => [:create, :reply]} end map.contest_module :contestnotifications do |map| From f3c95906d8df80d977b274fa0675746bf6e858df Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Jul 2016 10:30:48 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E7=9A=84=E4=BA=8C=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/issues_controller.rb | 22 +++--- app/controllers/users_controller.rb | 9 +++ app/models/journal.rb | 1 + app/views/blog_comments/show.html.erb | 9 +-- app/views/issues/_issue_replies.html.erb | 79 +++++++++---------- .../issues/_issue_reply_ke_form.html.erb | 20 ++--- app/views/issues/add_reply.js.erb | 11 ++- app/views/issues/delete_journal.js.erb | 7 +- app/views/issues/reply.js.erb | 7 +- app/views/messages/_course_show.html.erb | 9 +-- .../messages/_org_subfield_show.html.erb | 9 +-- app/views/messages/_project_show.html.erb | 9 +-- app/views/news/_news_all_replies.html.erb | 31 +------- app/views/org_document_comments/show.html.erb | 9 +-- .../_org_subfield_message.html.erb | 2 +- .../users/_comment_reply_detail.html.erb | 13 ++- app/views/users/_course_message.html.erb | 2 +- app/views/users/_message_contents.html.erb | 50 ++++++------ app/views/users/_message_replies.html.erb | 9 +-- app/views/users/_news_contents.html.erb | 29 +++++++ app/views/users/_news_replies.html.erb | 51 +++++------- app/views/users/_project_issue_reply.html.erb | 2 +- app/views/users/_project_message.html.erb | 2 +- app/views/users/_reply_to.html.erb | 10 +++ app/views/users/all_journals.js.erb | 2 +- .../20160720094503_add_column_to_journal.rb | 7 ++ db/schema.rb | 5 +- 27 files changed, 214 insertions(+), 202 deletions(-) create mode 100644 app/views/users/_news_contents.html.erb create mode 100644 db/migrate/20160720094503_add_column_to_journal.rb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 44f0d15f4..921d7d12b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -473,7 +473,6 @@ class IssuesController < ApplicationController def reply @issue = Issue.find(params[:id]) @jour = Journal.find(params[:journal_id]) - @tempContent = "
    #{ll(Setting.default_language, :text_user_wrote, @jour.user.realname.blank? ? @jour.user.login: @jour.user.realname)}
    #{@jour.notes.html_safe}
    ".html_safe respond_to do |format| format.js end @@ -482,17 +481,17 @@ class IssuesController < ApplicationController #给issue添加journ。回复内容包含 对某个被回复的journ的内容 def add_reply if User.current.logged? - jour = Journal.new - jour.user_id = User.current.id - jour.notes = params[:quote]+params[:notes] + jour = Journal.find(params[:journal_id]) @issue = Issue.find params[:id] - jour.journalized = @issue - jour.save - update_user_activity(@issue.class,@issue.id) - update_forge_activity(@issue.class,@issue.id) + 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 + respond_to do |format| + format.js + end end end end @@ -501,7 +500,8 @@ class IssuesController < ApplicationController def delete_journal @issue = Issue.find(params[:id]) Journal.destroy(params[:journal_id]) - respond_to do |format| + @user_activity_id = params[:user_activity_id] + respond_to do |format| format.js end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6b9e8f4c9..2d16f1a2b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -98,6 +98,8 @@ class UsersController < ApplicationController @comment = OrgDocumentComment.find params[:comment].to_i when 'Comment' @comment = Comment.find params[:comment].to_i + when 'Journal' + @comment = Journal.find params[:comment].to_i end end @@ -142,6 +144,11 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'News' + when 'Issue' + @reply = Journal.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'Issue' end respond_to do |format| format.js @@ -3329,6 +3336,8 @@ class UsersController < ApplicationController when 'Issue' obj = Issue.where('id = ?', params[:id].to_i).first @journals = obj.journals.reorder("created_on desc") + @type = 'Issue' + @user_activity_id = params[:div_id].to_i if params[:div_id] when 'BlogComment' obj = BlogComment.where('id = ?', params[:id].to_i).first @user_activity_id = params[:div_id].to_i if params[:div_id] diff --git a/app/models/journal.rb b/app/models/journal.rb index 0f88fcb7f..d2cc9e539 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -37,6 +37,7 @@ class Journal < ActiveRecord::Base has_many :at_messages, as: :at_message, dependent: :destroy acts_as_attachable attr_accessor :indice + acts_as_tree :counter_cache => :comments_count, :order => "#{Journal.table_name}.created_on ASC" acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" }, :description =>:notes, diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index bde98d456..f5c7c9094 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -135,13 +135,8 @@ <%= 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 %> + <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> + <% if !comment.content_detail.blank? %>
    <%= comment.content_detail.html_safe %> diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 7b5383c1e..344987913 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -1,55 +1,55 @@ +
    <% end %> \ No newline at end of file diff --git a/app/views/courses/_course_heroes.html.erb b/app/views/courses/_course_heroes.html.erb index ea05eea53..4699c12d2 100644 --- a/app/views/courses/_course_heroes.html.erb +++ b/app/views/courses/_course_heroes.html.erb @@ -1,9 +1,9 @@ <% hero_homework_scores = hero_homework_score(course, "desc") %> <% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
      -

      +

      <% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %> - <%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => '' %> + <%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => 'sy_cblack' %> <% else %> 班级英雄榜 <% end %> diff --git a/app/views/courses/_recommendation.html.erb b/app/views/courses/_recommendation.html.erb index 1db2edf57..ea129577b 100644 --- a/app/views/courses/_recommendation.html.erb +++ b/app/views/courses/_recommendation.html.erb @@ -1,25 +1,15 @@ <% exc_course = excellent_course_recommend(course) %> <% unless exc_course.length == 0 %> -
        -

        <%= l(:label_homework_recommendation) %>:

        - <% exc_course.each do |e_course| %> -
      • <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %> -
        -

        <%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %>

        -

        - <% if visable_attachemnts_incourse(e_course).count > 0 %> - <%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts_incourse(e_course).count, course_files_path(e_course), :class => "linkBlue2" %>) - <% end %> - <% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %> - <%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>) - <% end %> -

        -

        -
        -
        +
          + <% exc_course.each_with_index do |e_course, i| %> +
        • + <%= i+1 %> + <%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle fl mb10" %> +

          作业<%=e_course.homework_commons.where("publish_time <= '#{Date.today}'").count %> + 资源<%=visable_attachemnts_incourse(e_course).count %> +

        • <% end %> -
        <% end %> diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb index 52a971826..c41edf680 100644 --- a/app/views/courses/_tool_expand.html.erb +++ b/app/views/courses/_tool_expand.html.erb @@ -1,47 +1,53 @@ <% course_file_num = visable_attachemnts_incourse(@course).count%> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> +<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> +
      • + 问答区 + <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %> +
      • +<% end %> <% if show_nav?(@course.homework_commons.count) %> - +
      • + 作业 + <%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %> +
      • <% end %> <% if show_nav?(@course.news.count) %> - +
      • + 通知 + <%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %> +
      • <% end %> <% if show_nav?(course_file_num) %> - -<% end %> -<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> - + <% end %> <% if show_nav?(course_feedback_count) %> - +
      • + 留言 + <%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%> +
      • <% end %> <% if show_nav?(course_poll_count) %> - +
      • + @course.id) %>">问卷调查 + <%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %> +
      • <% end %> -<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %> - +<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %> +<% if show_nav?(count) %> +
      • + 在线测验 + <%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %> +
      • +<% end %> +<% if show_nav?(0) %> +
      • + 统计 + +
      • <% end %> \ No newline at end of file diff --git a/app/views/courses/feedback.html.erb b/app/views/courses/feedback.html.erb index c45259efd..5eae03656 100644 --- a/app/views/courses/feedback.html.erb +++ b/app/views/courses/feedback.html.erb @@ -1,5 +1,7 @@ <% reply_allow = JournalsForMessage.create_by_user? User.current %> +
        +

        <%= l(:label_contest_userresponse) %>

        @@ -9,4 +11,5 @@ :locals => { :contest => @contest, :journals => @jour, :state => false} %> -<% html_title(l(:label_course_feedback)) -%> \ No newline at end of file +<% html_title(l(:label_course_feedback)) -%> +
        \ No newline at end of file diff --git a/app/views/courses/statistics_course.html.erb b/app/views/courses/statistics_course.html.erb new file mode 100644 index 000000000..ce3d65743 --- /dev/null +++ b/app/views/courses/statistics_course.html.erb @@ -0,0 +1,5 @@ +
        +
        +

        统计功能即将上线,届时我们一起享受教育大数据的红利吧!

        +
        +
        \ No newline at end of file diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb index 9d70511e8..50df61cc9 100644 --- a/app/views/exercise/_exercise_form.html.erb +++ b/app/views/exercise/_exercise_form.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/exercise/_exercise_teacher.html.erb b/app/views/exercise/_exercise_teacher.html.erb index ce3928817..78bf2b7be 100644 --- a/app/views/exercise/_exercise_teacher.html.erb +++ b/app/views/exercise/_exercise_teacher.html.erb @@ -1,7 +1,7 @@ diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 8637273f1..68adfb4d4 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -1,9 +1,7 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> +
        <%= render :partial => 'exercises_list'%> -
        \ No newline at end of file +
        +

    \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 02f161589..1cbe058a1 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -1,7 +1,7 @@ + + + + + + + + + +
    +
    +
    +
    +
    + <%=render :partial=>'layouts/project_info' %> +
    + +
    +
      +
    • <%= l(:label_main_teacher)%> :  <%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %>
    • +
    • <%= l(:label_class_period)%> :  <%= @course.class_period %> <%= l(:label_class_hour) %>
    • +
    • <%= l(:label_main_term)%> :  <%= current_time_and_term @course %>
    • + <% if @course.school%> +
    • <%= l(:label_course_organizers)%> :  <%= @course.school%>
    • + <% end%> +
    +
    + + <%# 更新访问数,刷新的时候更新访问次数 %> + <% update_visiti_count @course %> + <%# over %> + + + <%# 课程活跃度 %> +
    + <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> + <%# 课程英雄榜 %> + <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> + + <% if @course.description && !@course.description.blank? %> +
    +
    +

    <%= l(:label_course_brief_introduction)%>:

    +
    + <%= textilizable(@course.description) if @course.description && !@course.description.blank? %> +
    +
    +
    + + + + +
    +
    + <% end %> +
    +

    <%= l(:label_tag)%>:

    +
    + <%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %> +
    +
    +
    + + <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> +
    访问计数 <%= @course.visits.to_i %> (自2016年5月)
    +
    + +
    + <%= yield %> + <%#= render_flash_messages %> + <%#= call_hook :view_layouts_base_content %> +
    + +
    + +
    +
    + +
    +<%= render :partial => 'layouts/footer' %> +
    + +<%= render :partial => 'layouts/new_feedback' %> + + +<%= call_hook :view_layouts_base_body_bottom %> + + + + \ No newline at end of file diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb new file mode 100644 index 000000000..bd152ac6e --- /dev/null +++ b/app/views/layouts/_course_base_info.html.erb @@ -0,0 +1,55 @@ +<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> +<% teacher_num = TeacherAndAssistantCount(@course) %> +<% student_num = studentCount(@course) %> +<% course_file_num = visable_attachemnts_incourse(@course).count %> +

    + <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %> +  >  + <%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %> +

    + +<% if is_teacher %> +
    +
      +
    • +
        +
      • <%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %>
      • +
      • <%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %>
      • +
      • <%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %>
      • +
      • <%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %>
      • +
      +
    • +
    +
    +<% end %> + +
    + +
    +

    邀请码
    <%=@course.generate_invite_code %>

    +
    +
    +
    +

    <%=@course.name %>

    + <%=@course.is_public == 0 ? '私有' : '公开' %> +

    + 教师:<%= course_teacher_link teacher_num %> + 学生:<%= course_student_link student_num %> + 资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %> +

    +
    +
    +

    + 主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %> + 学时:<%= @course.class_period %>学时 + 学期:<%= current_time_and_term @course %> + 单位:<%= @course.school ? @course.school : '无' %> +

    + + <% unless is_teacher %> +
    <%= join_in_course_header(@course, User.current) %>
    + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 1d749c5e8..9332ade4f 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -17,8 +17,8 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup'%> - <%= javascript_include_tag "course","sy_public", "syllabus","header","attachments",'prettify' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%> + <%= javascript_include_tag "course","header","attachments",'prettify' %> <%= yield :header_tags -%> @@ -40,7 +40,7 @@ - \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 57969faa5..cd85b8067 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -1,4 +1,5 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> +

    @@ -221,3 +222,4 @@

    +
    \ No newline at end of file diff --git a/app/views/poll/statistics_result.html.erb b/app/views/poll/statistics_result.html.erb index da89bf26e..fb9e9d26b 100644 --- a/app/views/poll/statistics_result.html.erb +++ b/app/views/poll/statistics_result.html.erb @@ -1,4 +1,5 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> +

    @@ -32,4 +33,5 @@

    +
    \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 6bdc3753e..3ec6232db 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -7,7 +7,7 @@