diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 334101bb0..3f49abb23 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -599,8 +599,19 @@ class AdminController < ApplicationController #学校列表 def schools - + @order = "" + @sort = "" @schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC") + if params[:sort] && (params[:order] == 'num') + @order = params[:order] + @sort = params[:sort] + @schools.each do |school| + count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count + school[:infocount] = count.to_i + end + @sort == 'asc' ? (@schools = @schools.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@schools = @schools.sort{|x,y| y[:infocount] <=> x[:infocount]}) + end + @school_count = @schools.count @school_pages = Paginator.new @school_count, 30, params['page'] || 1 diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index 9d90cb9f2..e80c56e49 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -40,7 +40,7 @@ class AvatarController < ApplicationController @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) # 用户头像上传时进行特别处理 - if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project') + if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') diskfile += "temp" @urlfile += "temp" end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index c4935a1af..ca6484e49 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -96,6 +96,9 @@ class MyController < ApplicationController elsif params[:project] @project = Project.find params[:project] diskfile = disk_filename('Project', @project.id) + elsif params[:organization] + @organization = Organization.find params[:organization] + diskfile = disk_filename('Organization', @organization.id) else @user = User.current diskfile = disk_filename('User', @user.id) @@ -116,6 +119,9 @@ class MyController < ApplicationController when 'Project' @project = Project.find params[:source_id] diskfile = disk_filename('Project', @project.id) + when 'Organization' + @organization = Organization.find params[:source_id] + diskfile = disk_filename('Organization', @organization.id) end end diskfile1 = diskfile + 'temp' diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 5e13149df..64f85b5db 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -1402,7 +1402,7 @@ class StudentWorkController < ApplicationController end def find_or_save_student_work(is_test) - student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first if student_work.nil? @homework.student_works.build( name: params[:title], @@ -1413,7 +1413,7 @@ class StudentWorkController < ApplicationController unless @homework.save logger.debug @homework.errors.full_messages else - student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first end end student_work diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b385fe610..8e729b083 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -983,7 +983,7 @@ class UsersController < ApplicationController @user = User.current @homework = HomeworkCommon.find(params[:homework_id]) @is_test = params[:is_test] == 'true' - @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: @is_test).first if @student_work.nil? @student_work = StudentWork.new end @@ -1660,55 +1660,117 @@ class UsersController < ApplicationController course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" project_types = "('Message','Issue','Project')" principal_types = "JournalsForMessage" + container_type = '' + act_type = '' if params[:type].present? case params[:type] when "course_homework" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'HomeworkCommon' when "course_news" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'News' when "course_message" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Message' when "course_poll" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Poll' when "course_journals" - @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'JournalsForMessage' when "project_issue" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Project' + act_type = 'Issue' when "project_message" - @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Course' + act_type = 'Message' when "user_journals" - @user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Principal' + act_type = 'JournalsForMessage' when "current_user" - @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) - else - if @user == User.current - blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" - else - blog_ids = "("+@user.blog.id.to_s+")" - end - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + - "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ - "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + - "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + container_type = 'Principal' + act_type = 'Principal' + end + end + if container_type != '' && act_type != '' + if container_type == 'Course' + sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'" + elsif container_type == 'Project' + sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'" + elsif container_type == 'Principal' && act_type == 'JournalsForMessage' + sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}" + elsif container_type == 'Principal' && act_type == 'Principal' + sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))" + end + if User.current != @user + sql += "and user_id = #{@user.id}" end else - # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) - # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" - # 减少数据库交互 - if @user == User.current - watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) - user_ids = "(" + @user.id.to_s + watched_user_ids + ")" + if User.current != @user + blog_ids = "("+@user.blog.id.to_s+")" + sql = "user_id = #{@user.id} and((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids}))" else - user_ids = "(" + @user.id.to_s + ")" - end - watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}") - blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")" - - @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + - "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ - "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + - "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) - end + blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})" + end + end + @user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10) + # if params[:type].present? + # case params[:type] + # when "course_homework" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_news" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_message" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_poll" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + # when "course_journals" + # @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) + # when "project_issue" + # @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) + # when "project_message" + # @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) + # when "user_journals" + # @user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10) + # when "current_user" + # @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) + # else + # if @user == User.current + # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # else + # blog_ids = "("+@user.blog.id.to_s+")" + # end + # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + # "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + # "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + # "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + # end + # else + # # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) + # # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" + # # 减少数据库交互 + # if @user == User.current + # watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) + # user_ids = "(" + @user.id.to_s + watched_user_ids + ")" + # else + # user_ids = "(" + @user.id.to_s + ")" + # end + # watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}") + # blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")" + # + # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + # "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ + # "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + + # "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) + # end # @user_activities = paginateHelper @user_activities,500 @type = params[:type] respond_to do |format| diff --git a/app/helpers/school_helper.rb b/app/helpers/school_helper.rb index 075d2b039..daa0550ef 100644 --- a/app/helpers/school_helper.rb +++ b/app/helpers/school_helper.rb @@ -1,6 +1,6 @@ module SchoolHelper def schoolMember_num school - count = student_num(school) + teacher_num(school) + count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count count.to_s end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 4f0a2ca6d..2ecb5516f 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -22,8 +22,12 @@ module StudentWorkHelper end #获取指定用户对某一作业的评分结果 - def student_work_score work,user - StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last + def student_work_score work,user,reviewer_role=0 + if reviewer_role != 0 + StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id,:reviewer_role => reviewer_role).last + else + StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last + end end #获取指定评分的角色 diff --git a/app/models/at_message.rb b/app/models/at_message.rb index 4c3ca9b74..5a175fe76 100644 --- a/app/models/at_message.rb +++ b/app/models/at_message.rb @@ -184,8 +184,10 @@ class AtMessage < ActiveRecord::Base when 'JournalsForMessage' if at_message.jour_type == 'Principal' {controller: :users, action: :user_messages, id: at_message.at_user} - else + elsif at_message.jour_type == 'HomeworkCommon' {controller: :homework_common, action: :index, course: at_message.jour.course_id} + elsif at_message.jour_type == 'Course' + {controller: :courses, action: :feedback, id: at_message.jour_id} end else diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb index f52d1f060..42bec6551 100644 --- a/app/views/admin/schools.html.erb +++ b/app/views/admin/schools.html.erb @@ -20,8 +20,8 @@ 学校名称 - - 用户数 + + <%= link_to '用户数', admin_schools_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'num') %> 创建时间 diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index c2fa23242..2c7411629 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,4 @@ -<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project') %> +<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') %> var imgSpan = $("img[nhname='avatar_image']"); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); <% else %> diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index f5c7c9094..45a621816 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -134,7 +134,7 @@
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
-
+
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> <% if !comment.content_detail.blank? %> @@ -161,7 +161,8 @@ l(:button_delete), {:controller => 'blog_comments', :action => 'destroy', :id => comment.id}, :method => :delete, - :class => 'fr mr20', + :id => "delete_reply_#{comment.id}", + :class => 'fr mr20 undis', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) ) %> diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 993c767d6..c71e5ade4 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -11,27 +11,27 @@ $("#relateProject,.relatePInfo").mouseout(function(){ $(".relatePInfo").css("display","none"); }) - $(".homepagePostPortrait").mouseover(function(){ - onImage = true; - $(this).children(".userCard").css("display","block"); - }) - $(".homepagePostPortrait").mouseout(function(){ - var cur = $(this); - onImage = false; - setTimeout(function(){ - if (onUserCard == false && onImage == false){ - $(cur).children(".userCard").css("display", "none"); - } - }, 500); - }) - $(".userCard").mouseover(function(){ - onUserCard = true; - $(this).css("display","block"); - }) - $(".userCard").mouseout(function(){ - onUserCard = false; - $(this).css("display","none"); - }) +// $(".homepagePostPortrait").mouseover(function(){ +// onImage = true; +// $(this).children(".userCard").css("display","block"); +// }) +// $(".homepagePostPortrait").mouseout(function(){ +// var cur = $(this); +// onImage = false; +// setTimeout(function(){ +// if (onUserCard == false && onImage == false){ +// $(cur).children(".userCard").css("display", "none"); +// } +// }, 500); +// }) +// $(".userCard").mouseover(function(){ +// onUserCard = true; +// $(this).css("display","block"); +// }) +// $(".userCard").mouseout(function(){ +// onUserCard = false; +// $(this).css("display","none"); +// }); $(".coursesLineGrey").mouseover(function(){ $(this).css("color","#ffffff"); }) diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index 067064c07..35e0726a8 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -5,7 +5,7 @@
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
-
+
@@ -28,17 +28,17 @@ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%> - <% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %> - <%= link_to(l(:label_bid_respond_delete), - {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, - :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', - :class => "delete", :title => l(:button_delete)) %> - <% end %> <% if reply_allow %> <%#= link_to l(:label_bid_respond_quote),'', {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> <%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %> <% end %> + <% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %> + <%= link_to(l(:label_bid_respond_delete), + {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :id => "delete_reply_#{journal.id}", + :class => "delete undis", :title => l(:button_delete)) %> + <% end %>
<% ids = 'project_respond_form_'+ journal.id.to_s%> diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index e157ea155..02db5e766 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -218,8 +218,12 @@ <% end %>
- <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> - <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %> + <% if exercise.time == -1 %> + <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> + <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %> + <% else %> + <%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:84px;",:format => 'js',:remote=>true %> + <% end %>
diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb index 070238a81..1bc8dc132 100644 --- a/app/views/issues/_issue_replies.html.erb +++ b/app/views/issues/_issue_replies.html.erb @@ -10,7 +10,7 @@
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
-
+
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
@@ -40,7 +40,8 @@ l(:button_delete), {:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id}, :method => :get, - :class => 'fr mr20', + :id => "delete_reply_#{comment.id}", + :class => 'fr mr20 undis', :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete) ) if comment.user_id == User.current.id %> diff --git a/app/views/issues/update.js.erb b/app/views/issues/update.js.erb index 16ca863e4..bd4385340 100644 --- a/app/views/issues/update.js.erb +++ b/app/views/issues/update.js.erb @@ -6,7 +6,7 @@ $("#issue_detail").show(); $("#issue_edit").hide(); $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); -$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') +$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>'); //edit里的编辑器貌似显示不出来,所以手动js生成。 issue_desc_editor = KindEditor.create('#issue_description', {"width":"85%", diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index c2fe181fe..65c065672 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -31,7 +31,7 @@