diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 61105bc45..db16f63d6 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -43,6 +43,14 @@ class StudentWorkController < ApplicationController end def index + # 消息状态更新 + @homework.course_messages.each do |homework_message| + if User.current.id == homework_message.user_id + homework_message.update_attributes(:viewed => true) + end + end + + # 消息end #设置作业对应的forge_messages表的viewed字段 query_student_work = @homework.course_messages query_student_work.each do |query| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 281924f55..5bd124fb9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -106,15 +106,17 @@ class UsersController < ApplicationController return end # 当前用户查看消息,则设置消息为已读 - course_querys = @user.course_messages - forge_querys = @user.forge_messages - user_querys = @user.user_feedback_messages - forum_querys = @user.memo_messages - if User.current.id == @user.id - course_querys.update_all(:viewed => true) - forge_querys.update_all(:viewed => true) - user_querys.update_all(:viewed => true) - forum_querys.update_all(:viewed => true) + if params[:viewed] == "all" + course_querys = @user.course_messages + forge_querys = @user.forge_messages + user_querys = @user.user_feedback_messages + forum_querys = @user.memo_messages + if User.current.id == @user.id + course_querys.update_all(:viewed => true) + forge_querys.update_all(:viewed => true) + user_querys.update_all(:viewed => true) + forum_querys.update_all(:viewed => true) + end end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index d6368b4a0..812873045 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -5,7 +5,7 @@
  • 服务协议|
  • <%= l(:label_surpport_group)%>|
  • -
  • <%= l(:label_forums)%>
  • +
  • <%= l(:label_forums)%>
  • diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index d965c92e7..29020560d 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -29,6 +29,11 @@
    +<% if params[:type].nil? %> +
    + 有 <%= User.current.count_new_message %> 封未读<%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> +
    +<% end %> <% if @message_alls.count >0 %> <%# 课程消息 %> <% unless @message_alls.nil? %> @@ -52,7 +57,11 @@
  • <%= link_to ma.course_message.comments.html_safe, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id }, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", - :title => "#{ma.course_message.comments.html_safe}" %>
  • + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> +
    + <%= ma.course_message.comments.html_safe %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -80,11 +89,21 @@ @@ -150,11 +169,23 @@
  • <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %>
  • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %> "><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %>
  • -
  • - <%=link_to ma.forge_message.parent_id.nil? ? ma.forge_message.subject.html_safe : ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project, - :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, - :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", - :title => "#{ma.forge_message.subject.html_safe}" %>
  • + <% if ma.forge_message.parent_id.nil? %> +
  • + <%=link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project, + :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, + :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", + :title => "#{ma.forge_message.subject.html_safe}" %>
  • + <% else %> +
  • + <%=link_to ma.forge_message.content.html_safe, project_boards_path(ma.forge_message.project, + :parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id, + :topic_id => ma.forge_message.id),:class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %>
  • +
    + <%= ma.forge_message.content.html_safe %> +
    + <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -180,7 +211,9 @@ ">评论了新闻:
  • <%= link_to "#{ma.forge_message.comments.html_safe}", - {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.forge_message.comments.html_safe}"%>
  • + {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :title => "#{ma.forge_message.comments.html_safe}" %> +
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -196,9 +229,21 @@ <%=link_to ma.memo.author, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher" %> " ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %> -
  • - <%= link_to ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content}" %> -
  • + <% if ma.memo.parent_id.nil? %> +
  • + <%= link_to ma.memo.subject, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :title => "#{ma.memo.subject}" %> +
  • + <% else %> +
  • + <%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %> +
  • +
    + <%= ma.memo.content.html_safe %> +
    + <% end %>
  • <%= time_tag(ma.memo.created_at).html_safe %>
  • <% end %> @@ -215,8 +260,13 @@ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
  • - <%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.journals_for_message.notes}" %> + <%= link_to ma.journals_for_message.notes.html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + :onmouseover =>"message_titile_show($(this),event)", + :onmouseout => "message_titile_hide($(this))" %>
  • +
    + <%= ma.journals_for_message.notes.html_safe %> +
  • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
  • @@ -236,6 +286,17 @@
    + diff --git a/db/migrate/20150829024549_course_messages.rb b/db/migrate/20150829024549_course_messages.rb index 666ccdaeb..34f4e9ef2 100644 --- a/db/migrate/20150829024549_course_messages.rb +++ b/db/migrate/20150829024549_course_messages.rb @@ -3,6 +3,7 @@ class CourseMessages < ActiveRecord::Migration def up Course.all.each do |course| transaction do + put course.id course.course_messages << CourseMessage.new(:user_id => course.tea_id,:course_id => course.id) # 作业 course.homework_commons.each do |homework_common| diff --git a/db/migrate/20150829081822_update_message_time.rb b/db/migrate/20150829081822_update_message_time.rb index fe670e9b8..09e42b6d1 100644 --- a/db/migrate/20150829081822_update_message_time.rb +++ b/db/migrate/20150829081822_update_message_time.rb @@ -11,6 +11,7 @@ class UpdateMessageTime < ActiveRecord::Migration cmessage.created_at = cmessage.course_message.created_on end cmessage.save + puts cmessage.id course_all_message = MessageAll.where("message_type = '#{cmessage.class.to_s}' and message_id = '#{cmessage.id}'").first course_all_message.created_at = cmessage.created_at diff --git a/db/migrate/20150829130302_update_forge_message_time.rb b/db/migrate/20150829130302_update_forge_message_time.rb index 70811c307..295cafea6 100644 --- a/db/migrate/20150829130302_update_forge_message_time.rb +++ b/db/migrate/20150829130302_update_forge_message_time.rb @@ -11,6 +11,7 @@ class UpdateForgeMessageTime < ActiveRecord::Migration fmessage.created_at = fmessage.forge_message.created_on end fmessage.save + puts fmessage.id forge_all_message = MessageAll.where("message_type = '#{fmessage.class.to_s}' and message_id = '#{fmessage.id}'").first forge_all_message.created_at = fmessage.created_at diff --git a/db/migrate/20150901004812_update_memo_message_time.rb b/db/migrate/20150901004812_update_memo_message_time.rb index e512282a0..80ae557fc 100644 --- a/db/migrate/20150901004812_update_memo_message_time.rb +++ b/db/migrate/20150901004812_update_memo_message_time.rb @@ -11,6 +11,7 @@ class UpdateMemoMessageTime < ActiveRecord::Migration memo_message.created_at = memo_message.memo.created_on end memo_message.save + puts memo_message.id memo_messages = MessageAll.where("message_type = '#{memo_message.class.to_s}' and message_id = '#{memo_message.id}'").first memo_messages.created_at = memo_message.created_at diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index f9ebece36..31f0efe81 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -1,6 +1,6 @@ function init_editor(params){ var editor = params.kindutil.create(params.textarea, { - resizeType : 0,minWidth:"1px",width:"100%",minHeight:"40px", + resizeType : 0,minWidth:"1px",width:"100%",minHeight:"28px", items:['emoticons'], afterChange:function(){//按键事件 nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index e15509580..1e1739bda 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -525,7 +525,7 @@ a.replyGrey1 {color:#888888;} a.replyGrey1:hover {color:#4b4b4b;} a.newsBlue {color:#269ac9;} a.newsBlue:hover {color:#297fb8;} -a.newsBlack {color:#000000; font-size:13px; font-weight:bold} +a.newsBlack {color:#4b4b4b; font-size:13px; font-weight:bold} a.menuGrey {color:#808080;} a.menuGrey:hover {color:#fe7d68;} .navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index a22831b2c..a4eaa7f0a 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -391,16 +391,17 @@ blockquote { border-right: 1px solid #e0e0e0; border-top: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; - padding-left: .6em; - padding-top: .6em; - padding-right: .6em; - padding-bottom: .6em; + padding-left: 0.6em; + padding-top: 0.6em; + padding-right: 0.6em; + padding-bottom: 0.6em; margin-left: 1.4em; - margin-right: .4em; + margin-right: 0.4em; border-radius: 4px; font-family: "Microsoft YaHei"; - background: url(http://test.forge.trustie.net/images/requirements/xreference.jpg.pagespeed.ic.h4inUJNyH0.jpg); + /*background: url('../images/requirements/reference.jpg');*/ background-size: 100% 100%; + margin-top:5px; } /*上传项目图片*/ .upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}