diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4ed7804ea..93c0c18cd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1820,7 +1820,7 @@ class UsersController < ApplicationController # 自己的主页显示消息 # 系统消息为管理员发送,我的消息中包含有系统消息 @message_alls = [] - messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc") + messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" , @user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc") messages.each do |message_all| mess = message_all.message unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1) @@ -1872,7 +1872,7 @@ class UsersController < ApplicationController @applied_message_alls << mess end elsif message_all.message_type == "CourseMessage" - if (mess.course_message_type == "JoinCourse" && mess.status == 0) + if mess.course_message_type == "JoinCourseRequest" && mess.status == 0 @applied_message_alls << mess end end @@ -2079,12 +2079,12 @@ class UsersController < ApplicationController @message_alls << mess end elsif (message_all.message_type == "AppliedMessage" ) - if (mess.applied_type == "AppliedProject" && mess.status == 1) || (mess.applied_type == "ApplyAddSchools" && mess.status == 0) + if (mess.applied_type == "AppliedProject" && mess.status == 1) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 ) @message_alls << mess end elsif message_all.message_type == "CourseMessage" - if (mess.course_message_type == "JoinCourse" && mess.status == 0) - @message_alls << mess + if mess.course_message_type == "JoinCourseRequest" && mess.status == 0 + @message_alls << mess end end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index cc203ee63..ed504c5db 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -33,6 +33,12 @@ module UsersHelper result = unsolved_issues_count + unfinished_homework_count + unfinished_test_count + unfinished_poll_count + anonymous_evaluation_count + unapproval_homework end + # 判断某个时间再多少天前 + # params[:num] 天数 + def many_days_ago time, num + time > Time.now - 86400 * num + end + def issue_list(issues, &block) ancestors = [] issues.each do |issue| diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 1b4f38ec5..83f204bb4 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -8,8 +8,8 @@ <%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%> diff --git a/app/views/layouts/base_course_community.html.erb b/app/views/layouts/base_course_community.html.erb index f902ae2d5..8eed02482 100644 --- a/app/views/layouts/base_course_community.html.erb +++ b/app/views/layouts/base_course_community.html.erb @@ -52,7 +52,7 @@ <%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %> <% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
- <%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %> + <%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
<% if is_current_user %> diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index dfa6afb0a..1e31674f4 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -161,13 +161,13 @@ <% if is_current_user %>

- <%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" %> + <%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank"%>

<%# if hidden_unproject_infos %>