This commit is contained in:
sw 2015-08-10 17:29:14 +08:00
commit 733eeaf34f
4 changed files with 18 additions and 8 deletions

View File

@ -39,9 +39,14 @@ class CoursesController < ApplicationController
else
@state = 5 #未登录
end
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
# if @state == 1 || @state == 3
# respond_to course_path(course.id)
# else
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
#end
rescue Exception => e
@state = 4 #已经加入了课程
respond_to do |format|

View File

@ -262,9 +262,11 @@ class UsersController < ApplicationController
# modified by fq
def user_newfeedback
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
if User.current == @user
jours.update_all(:is_readed => true, :status => false)
jours.each do |journal|
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
end
end
@jour = paginateHelper jours,10
@state = false

View File

@ -291,9 +291,10 @@ class User < Principal
name
end
## end
# 查询用户未读过的记录
def count_new_jour
count = self.new_jours.count
count = self.journals_for_messages.where("status=?", 1).count
end
#added by nie

View File

@ -6,12 +6,14 @@
alert("加入成功");
hideModal($("#popbox02"));
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
<% elsif @state == 5 %>