From 2f2ad38cdf7d9dcc0a2ba21f962e3c5cea02762d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 16 Oct 2015 09:30:44 +0800 Subject: [PATCH 01/35] =?UTF-8?q?1.=E7=94=A8=E6=88=B7=E8=A2=AB=E6=8B=89?= =?UTF-8?q?=E5=85=A5=E9=A1=B9=E7=9B=AE=EF=BC=8C=E5=8F=91=E9=80=81=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E6=B6=88=E6=81=AF=E7=BB=99=E8=AF=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=EF=BC=9B=202.=E7=94=A8=E6=88=B7=E8=A2=AB=E7=A7=BB=E5=87=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=BB=99=E8=AF=A5=E7=94=A8=E6=88=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 7 +++- app/controllers/projects_controller.rb | 8 ++++ app/views/users/_user_message_forge.html.erb | 42 ++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 6271a6832..6bb61e6a1 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -81,8 +81,12 @@ class MembersController < ApplicationController user_ids.each do |user_id| members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id) - ## added by nie + #给新成员发送加入项目的消息,发送者id放在ForgeMessage的forge_message_id字段中, + #forge_message_type设置为JoinProject + forge_join = ForgeMessage.new(:user_id =>user_id, :forge_message_id=>User.current.id,:project_id => @project.id,:forge_message_type=>"JoinProject", :viewed => false) + forge_join.save + ## added by nie if (params[:membership][:role_ids]) role = Role.find(params[:membership][:role_ids][0]) project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) if role.allowed_to?(:is_manager) @@ -301,6 +305,7 @@ class MembersController < ApplicationController grade.destroy end end + ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id) end respond_to do |format| format.html { redirect_to_settings_in_projects } diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 90974b376..d26e465ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -534,6 +534,14 @@ class ProjectsController < ApplicationController project_invite_messages.each do |project_invite_message| project_invite_message.update_attribute(:viewed, true) end + #更新被加入项目消息的viewed字段 + join_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "JoinProject") + join_project_messages.each do |join_project| + join_project.update_attribute(:viewed, true) + end + #更新被移出项目消息的viewed字段 + remove_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "RemoveFromProject") + remove_project_messages.update_all(:viewed => true) end def message_invite(message_id, key) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index b93122bd2..653771f2a 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -20,6 +20,48 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + <% if ma.forge_message_type == "JoinProject" %> + + <% end %> + + <% if ma.forge_message_type == "RemoveFromProject" %> + + <% end %> <% if ma.forge_message_type == "ProjectInvite" %> <% inviter = User.find(ma.forge_message_id) %> From 2160d508f30d74721c228d9e2942e9f4f96fe5f2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 16 Oct 2015 10:31:10 +0800 Subject: [PATCH 02/35] =?UTF-8?q?1.=E6=9B=B4=E6=94=B9=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BB=A5=E5=8F=8A=E7=A7=BB=E5=87=BA=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=B6=88=E6=81=AF=E7=9A=84=E6=8F=90=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=202.=E5=AF=B9=E4=BA=8E=E5=8F=91=E5=B8=83=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=B6=88=E6=81=AF=EF=BC=8C=E5=BD=93=E4=BD=9C=E4=B8=9A=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=9B=203.=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E2=80=9C=E5=85=A8=E9=83=A8=E2=80=9D=E6=94=B9?= =?UTF-8?q?=E6=88=90=E2=80=9C=E6=89=80=E6=9C=89=E6=B6=88=E6=81=AF=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- .../users/_selector_for_messages.html.erb | 4 ++-- app/views/users/_user_message_course.html.erb | 2 +- app/views/users/_user_message_forge.html.erb | 20 ++++++++++++++----- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3de491421..10b55d1cd 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -145,7 +145,7 @@ class UsersController < ApplicationController when 'forge_news' @message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc") when 'apply' - @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject') and user_id =?", @user).order("created_at desc") + @message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user).order("created_at desc") #贴吧消息 when 'forum' diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index e7884fc60..10c7e3e34 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -19,7 +19,7 @@
  • <%= link_to "项目任务", user_message_path(User.current, :type => 'issue'), :class => "homepageTypePTask postTypeGrey" %>
  • <%= link_to "项目讨论", user_message_path(User.current, :type => 'forge_message'), :class => "homepagePostTypeForum postTypeGrey" %>
  • <%= link_to "项目新闻", user_message_path(User.current, :type => 'forge_news'), :class => "homepageTypePNews postTypeGrey" %>
  • -
  • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "homepageTypeUApply postTypeGrey" %>
  • +
  • <%= link_to "加入项目", user_message_path(User.current, :type => 'apply'), :class => "homepageTypeUApply postTypeGrey" %>
  • @@ -27,7 +27,7 @@
    • 更多
    • -
    • <%= link_to "全部",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
    • +
    • <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
    • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
    • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "homepageTypeSystem postTypeGrey" %>
    • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
    • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index d4b61e966..d9b4f7a3d 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -37,7 +37,7 @@
    • <%= time_tag(ma.created_at).html_safe %>
    <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && !ma.course_message.nil? %> @@ -52,12 +57,17 @@ ">将您移出了项目:
  • - <%= link_to ma.project, project_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + <%= link_to ma.project, member_project_path(ma.project), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -71,7 +81,7 @@
  • <%=link_to inviter, user_path(inviter), :class => "newsBlue homepageNewsPublisher" %> - '>邀请你加入项目 + '>邀请你加入项目:
  • <% if ma.user.member_of?(ma.project) %>
  • From 4d246de1c64c3fe80117bf617d2e214c8604d83e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 16 Oct 2015 15:07:09 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E8=A2=AB=E6=8B=89?= =?UTF-8?q?=E5=85=A5=E6=88=96=E8=80=85=E7=A7=BB=E5=87=BA=E6=9F=90=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E9=A1=B9=E7=9B=AE=E5=AF=B9=E5=BA=94=E7=9A=84=E6=B6=88?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E5=BD=93=E7=94=A8=E6=88=B7=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90=EF=BC=8C=E5=BA=94=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 2 +- app/views/users/_user_message_forge.html.erb | 38 +++++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index d9b4f7a3d..36318c20b 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -102,7 +102,7 @@

    课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)

    作业标题:<%= ma.course_message.name %>

    提交截止:<%= ma.course_message.end_time %>  24点

    -

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> @ 24点

    +

    匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %>  24点

    迟交扣分:<%= ma.course_message.late_penalty %>分

    请同学们抓紧时间提交自己的作品,谢谢!

    <% else %> diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index a7777a59a..9a9bec10d 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -36,12 +36,19 @@ :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -62,12 +69,19 @@ :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • From 1b2bbdc577570c7488a8bb0c1a7b85370289e165 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 16 Oct 2015 16:56:27 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E4=B8=AD=E6=9C=89=E6=8D=A2=E8=A1=8C=E7=9A=84=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B0=86=E6=8D=A2=E8=A1=8C=E5=8F=98=E6=88=90?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=20=E5=A6=82=E6=9E=9C=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=AD=A6=E6=A0=A1id?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E8=AF=9D=EF=BC=8C=E9=82=A3=E4=B9=88?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E9=9C=80=E8=A6=81=E5=8E=BB=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BA=86=E3=80=82=20=E5=A6=82=E6=9E=9C=E6=98=AF=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E5=AD=A6=E6=A0=A1=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E7=BC=98=E6=95=85=EF=BC=8C=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E8=AF=B4=E6=98=8E=E5=AD=A6=E6=A0=A1=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E6=98=AF=E4=BB=8E=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index d0125cd3b..b991ee32a 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -527,7 +527,7 @@ } function changeValue(value,data){ //console.log(value+","+data) - $("input[name='province']").val(value); + $("input[name='province']").val(value); $("input[name='occupation']").val(data); $("#search_school_result_list").hide(); $("#hint").hide(); @@ -570,7 +570,7 @@ var i = 0; $("#search_school_result_list").html(''); for (; i < data.length; i++) { - link = '' + data[i].school.name + '
    '; + link = '' + data[i].school.name + '
    '; $("#search_school_result_list").append(link); } $("#search_school_result_list").css('left', $(e.target).offset().left); @@ -601,7 +601,10 @@ } }) $("input[name='province']").on('focus', function (e) { - if($(e.target).val() == ''){ + if($(e.target).val() == ''){ // + return; + } + if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在,不用去找了。 return; } $.ajax({ @@ -612,7 +615,7 @@ var i = 0; $("#search_school_result_list").html(''); for (; i < data.length; i++) { - link = '' + data[i].school.name + '
    '; + link = '' + data[i].school.name + '
    '; $("#search_school_result_list").append(link); } $("#search_school_result_list").css('left', $(e.target).offset().left); @@ -658,8 +661,10 @@ <% if( !@act.nil? && @act == 'password') %> $("#users_tb_2").click(); <% end %> - $('#my_account_form_link').click(function(){ + $('#my_account_form_link').click(function(e){ if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 + $("#hint").html('学校必须是从下拉列表中选择的').show(); + e.stopImmediatePropagation(); return; } $('#my_account_form_btn').click(); From f25015c6b8f2695ccb4d0af273fea0b14aa1d6b3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 16 Oct 2015 16:59:00 +0800 Subject: [PATCH 05/35] =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E5=90=8D=E5=AD=97?= =?UTF-8?q?=E4=B8=AD=E6=9C=89=E6=8D=A2=E8=A1=8C=E7=9A=84=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=B0=86=E6=8D=A2=E8=A1=8C=E5=8F=98=E6=88=90?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=20=E5=A6=82=E6=9E=9C=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C=E5=AD=A6=E6=A0=A1id?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E8=AF=9D=EF=BC=8C=E9=82=A3=E4=B9=88?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E9=9C=80=E8=A6=81=E5=8E=BB=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BA=86=E3=80=82=20=E5=A6=82=E6=9E=9C=E6=98=AF=E5=9B=A0?= =?UTF-8?q?=E4=B8=BA=E5=AD=A6=E6=A0=A1=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E7=BC=98=E6=95=85=EF=BC=8C=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E8=AF=B4=E6=98=8E=E5=AD=A6=E6=A0=A1=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E6=98=AF=E4=BB=8E=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index b991ee32a..b439adaac 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -663,7 +663,7 @@ <% end %> $('#my_account_form_link').click(function(e){ if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 - $("#hint").html('学校必须是从下拉列表中选择的').show(); + $("#hint").html('学校必须是从下拉列表中选择的,不能手动修改').show(); e.stopImmediatePropagation(); return; } From 86cd27eb1742304ecfe2b9aa674c1da57c505054 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 16 Oct 2015 17:30:46 +0800 Subject: [PATCH 06/35] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=B6=88=E6=81=AF=E7=9A=84=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E2=80=9C=E7=B3=BB=E7=BB=9F=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E2=80=9D=EF=BC=8C=E8=80=8C=E9=9D=9E=E2=80=9C=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_selector_for_messages.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 10c7e3e34..66f9ec7a3 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -29,7 +29,7 @@
  • 更多
  • <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
  • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
  • -
  • <%= link_to "系统消息", user_system_messages_path(User.current), :class => "homepageTypeSystem postTypeGrey" %>
  • +
  • <%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %>
  • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
  • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
  • From 7dd6618345136e208f81e1e238d9aef6ef161fa0 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 16 Oct 2015 17:32:17 +0800 Subject: [PATCH 07/35] =?UTF-8?q?=E9=9D=9E=E8=AF=BE=E7=A8=8B=E6=88=90?= =?UTF-8?q?=E5=91=98=E4=B8=8D=E8=83=BD=E5=B0=86=E5=B8=96=E5=AD=90=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6=E5=92=8C=E9=94=81=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 6 ++++-- app/views/boards/_course_show.html.erb | 2 +- public/stylesheets/courses.css | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index a5cbc1c1e..61bbb85d2 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -4,17 +4,19 @@
    - +