-
-
- 新建课程
-
-
-
-
-
-
diff --git a/public/stylesheets/images/resource_icon_list.png b/public/stylesheets/images/resource_icon_list.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b5bc6f58c73e58545a57fc4e29463d4ef7a0e9b
GIT binary patch
literal 2476
zcmaJ@eLR!>8sFo!6rNP_QkqFh*=%gt3}Iv~WT|;gv)vfBd$zIBybtNcOG3~2WX@BL
zULGu+h+~m@Bzoc$oxCM_ColUDAy4PrD|(*K`5fo|T=)I^UBA!w`d-)XdtHCr*$2J$
zX=@p2!C)|LvImI@t=`a^yGjH4HVkB9pv6$&<|jA=h6#jp9sqM@f}sGM%%+C}RDjNm
zk7)ylFqkTW`FS3MyMjCbjz!v7F|5&OI1YzI+hTDz^lmuD8jV3&Lx!_L+Y+!i0%i|<
z=|Mo*c+4;YmE^vZ3-TNg5ds01fIu^
zW2|l6&{zz9kLz+Q31q~w0ghlfmib4l-HNfwQDAeS%p`!viUXMLJdh3ldSwD@S
z@-4+OSFQ!OVk`RgqJ
zIcgIryJ8*OHKtML-Wtnx^NEmA=Ueeqm3;;S-2FaqbClK=_ugx4OnZ&x7|LUIX2y+`
ziN5%BN4w4G(GS+wuHS6=$D>_=hp*7zm=W(nc4<|v!jg8_zT?B>q|=6CyrM;MRbe-0
zKW8P1J#?t+tzN0kdy~>rvujnI6eD#N8Qwec*bW0)22L63vU06v?5i6-&A)5NQaaN+
zC9Wm3jv)d8KR10EroDcYiW1L7uGF@haFaJ--Lae?H>%{kI+UlUg&p-#2?
zoy@!xc3Xd({KF^M{sDcte63@~E2918b-xFNeo2+a30mR|GWs5+P-b=5)7zT^_djqV
z%R*?;S*D+oI#>Tpe&6kNX=Bngk4`ZW`R+ZN=0*#2`m5<;a{n3ahEjFA=`|?@kqg_1
zS{?0kx-8*`ifz{Fj`#BP48knbU@F`y7k?d;%R9xX=`YN2*5!HeqD@Jxpp}lW|Y
zY>dA!dlaMgT~BTADO`wZ#r)XKLOVI7JOcL5SFiJjADQ(%7R_jiWsRk0Hp)%Y8ux~6
zSD+oirmGHf#rc)BgR?9Hg3-~D1Jgm|%QnUe0>b$0LTTTnEf03j?JMo296xtC+<7Fv
z!~*R#6qg(q?#-Z7YlX`Xv$jQ
z@mnAF9=mc{Ui|)Jn2LOFtE+0HM3z3;T@|Ep9<{!tvbGAS2ow$>_UGV=JX)Ve9%!`r47QmY$I58QOnvUUxcANK6Vjk_>h
zpCa(Xn2n7-6w^0`*G}Z5Po~Ih<65p#tbQ3U*eI>oLR6c?nTZcvJxh^FytZ27q^P06
z^sSO&qXw_*p8b1Sy2T&-@~EPnE%V<@55Gv9
zDu21kTR)*(fBr&uY_GrKV)dH0RsmYUXR^)YtIa>&y|JpXy}tOUu-s5y`?)fEp;7-G
z$}2aMcIPucqo(XmNTpOg{DS=R(6eEd&mv`L;?a$u7zZ7TlSF~Zg&FaLx5)k6@HkRs
zLcOl`S51^+UhLgHRBv&+b<>sSPm0>`m4#k?QHos)0UA&E;`<3R9f|zzzsSqN!}2DF
z3dj6eGiBqkLnRSohCMEQ#%~5|ZC+1~=3wM4gl1hzr@P@G?Y=blxsgKX5qrC}r=-04
z li > a {
+ display: block;
+ padding: 3px 20px;
+ clear: both;
+ font-weight: normal;
+ line-height: 1.5;
+ color:#616060;
+ white-space: nowrap;
+}
+.dropdown-menu > li > a:hover{
+ color: #ffffff;
+ text-decoration: none;
+ background-color: #64bdd9;
+ outline:none;
+}
+
+/*发送资源弹窗*/
+/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
+.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
+.sendText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:140px; display:inline-block;}
+.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
+.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;}
+.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
+.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
+.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
+.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
+.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
+.sendCourseName {font-size:12px; color:#5f6060;}
+.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;}
+.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
+a.sendSourceText {font-size:14px; color:#ffffff;}
+
+/*上传资源弹窗*/
+.resourceUploadPopup {width:400px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
+.uploadText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:140px; display:inline-block;}
+.uploadBoxContainer {height:33px; line-height:33px; margin-top:10px; position:relative;}
+.uploadBox {width:100px; height:33px; line-height:33px; text-align:center; vertical-align:middle; background-color:#64bdd9; border-radius:3px; float:left; margin-right:12px;}
+a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; width:100px; height:33px;}
+.chooseFile {color:#ffffff; display:block; margin-left:32px;}
+.uploadResourceIntr {width:250px; height:33px; float:left; line-height:33px; font-size:12px;}
+.uploadResourceName {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444; margin-bottom:2px;}
+.uploadResourceIntr2 {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444;}
+.uploadType {margin:10px 0; border:1px solid #e6e6e6; width:100px; height:30px; outline:none; font-size:12px; color:#888888;}
+.uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;}
+
+
+/*新个人主页框架css*/
+.navContainer {width:100%; margin:0 auto; background-color:#15bccf;}
+.homepageContentContainer {width:100%; margin:0 auto; background-color:#eaebed;}
+.homepageContent {width:1000px; background-color:#eaebed; margin:0 auto;}
+.navHomepage {width:1000px; height:54px; background-color:#15bccf; margin:0 auto;}
+.navHomepageLogo {width:60px; height:54px; line-height:54px; vertical-align:middle; margin-left:2px; margin-right:40px;}
+.navHomepageMenu {margin-right:40px;display:inline-block;height:54px; line-height:54px; vertical-align:middle;}
+.navHomepageSearchBox {width:380px; border:none; outline:none; height:32px; margin-top:11px; background-color:#ffffff;}
+.navHomepageSearchInput {width:345px; height:32px; outline:none; border:none; float:left; padding-left:5px;; margin:0;}
+.homepageSearchIcon {width:30px; height:32px; background:url(../images/nav_icon.png) -8px 3px no-repeat; float:left;}
+a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-repeat;}
+.navHomepageNews {width:30px; display:block; float:right; margin-top:12px; position:relative;}
+.homepageNewsIcon {background:url(../images/nav_icon.png) -5px -85px no-repeat; width:30px; height:29px; display:block;}
+.newsActive {width:10px; height:10px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:17px; top:5px;}
+.navHomepageProfile {width:65px; display:block; float:right; margin-top:8px; margin-left:33px;}
+.homepageProfileMenuIcon {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:20px; height:25px; float:left; margin-top:15px;}
+a.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:12px; height:12px; float:left;}
+.homepageLeft {width:240px; float:left; margin-right:10px;}
+.homepageRight {width:750px; float:left;}
+.homepagePortraitContainer {width:238px; height:348px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px;}
+.homepagePortraitImage {width:208px; height:208px; margin:15px 16px 14px 16px;}
+.homepageFollow {}
+.homepageEditProfile {}
+.homepageImageName {font-size:16px; color:#484848; margin-left:15px; display:inline-block; margin-right:8px;}
+.homepageImageSex {float:left; top:116px; left:5px; width:14px; height:14px; display:inline-block;}
+.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:5px; margin-bottom:15px;}
+.homepageImageBlock {margin:0 26px; float:left; text-align:center; display:inline-block;}
+.homepageImageNumber {font-size:12px; color:#484848;}
+.homepageImageText {width:26px; font-size:12px; color:#888888;}
+.homepageVerDiv {height:28px; vertical-align:middle; width:1px; float:left; display:inline-block; background-color:#d1d1d1; margin-top:3px;}
+.homepageLeftMenuContainer {width:238px; border:1px solid #dddddd; border-bottom:none; background-color:#ffffff; margin-top:10px;}
+.homepageLeftMenuBlock {border-bottom:1px solid #dddddd; height:50px; line-height:50px; vertical-align:middle;}
+a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
+.homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;}
+.homepageRightBanner {}
+.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:35px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2;}
+.homepageRightBlock {}
+.homepageNewsList {width:710px; height:39px; line-height:39px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin:0 auto;}
+.homepageNewsPublisher {width:95px; font-size:12px; color:#15bccf; display:block;}
+.homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;}
+.homepageNewsContent {width:445px; font-size:12px; color:#4b4b4b; display:block;}
+.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
+a.homepageWhite {color:#ffffff;}
+a.homepageWhite:hover {color:#a1ebff}
+a.newsGrey {color:#4b4b4b;}
+a.newsGrey:hover {color:#000000;}
+a.newsBlue {color:#15bccf;}
+a.newsBlue:hover {color:#0781b4;}
\ No newline at end of file
diff --git a/spec/models/course_message_spec.rb b/spec/models/course_message_spec.rb
new file mode 100644
index 000000000..cddcdc0a1
--- /dev/null
+++ b/spec/models/course_message_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe CourseMessage, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
From 6051d0797d4018af815c3d45b31a681641451a89 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 14 Aug 2015 16:24:43 +0800
Subject: [PATCH 33/50] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E7=BB=93=E6=9E=9C=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 67 ++-------------------------
app/views/courses/search.html.erb | 12 ++---
2 files changed, 11 insertions(+), 68 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 71715035e..29f2e00f4 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -106,74 +106,17 @@ class CoursesController < ApplicationController
# 课程搜索
# add by nwb
def search
- courses_all = Course.all_course
- name = params[:name]
- if name.blank?
- @courses = []
- @courses_all = []
- @course_count = 0
- @course_pages = Paginator.new @course_count, per_page_option, params['page']
+ if params[:name].empty?
+ courses = Course.visible
+ @courses = paginateHelper courses,10
else
- @courses = courses_all.visible
- if params[:name].present?
- @courses_all = @courses.like(params[:name])
- else
- @courses_all = @courses;
- end
- @course_count = @courses_all.count
- @course_pages = Paginator.new @course_count, per_page_option, params['page']
-
- # 课程的动态数
- # @course_activity_count=Hash.new
- # @courses_all.each do |course|
- # @course_activity_count[course.id]=0
- # end
- #
- # case params[:course_sort_type]
- # when '0'
- # @courses = @courses_all.order("created_at desc")
- # @s_type = 0
- # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
- #
- # @course_activity_count=get_course_activity @courses,@course_activity_count
- #
- # when '1'
- # @courses = @courses_all.order("course_ac_para desc")
- # @s_type = 1
- # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
- #
- # @course_activity_count=get_course_activity @courses,@course_activity_count
- #
- # when '2'
- # @courses = @courses_all.order("watchers_count desc")
- # @s_type = 2
- # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
- #
- # @course_activity_count=get_course_activity @courses,@course_activity_count
- #
- # when '3'
- # @course_activity_count=get_course_activity @courses_all,@course_activity_count_array
- # @courses=handle_course @courses_all,@course_activity_count
- # @s_type = 3
- # @courses = @courses[@course_pages.offset, @course_pages.per_page]
- #
- # else
- # @s_type = 0
- # @courses = @courses_all.order("created_at desc")
- # @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
- #
- # @course_activity_count=get_course_activity @courses,@course_activity_count
- #
- # end
+ courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
+ @courses = paginateHelper courses,10
end
respond_to do |format|
format.html {
render :layout => 'course_base'
- scope = Course
- unless params[:closed]
- scope = scope.active
- end
}
format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb
index 98b056487..c19f9821a 100644
--- a/app/views/courses/search.html.erb
+++ b/app/views/courses/search.html.erb
@@ -39,17 +39,17 @@
<% end %>
-<% if @courses.size == 0 %>
-<%= render :partial => 'layouts/no_content'%>
+<% if @courses && !@courses.empty? %>
+
+ <%= render_course_hierarchy(@courses)%>
+
<% else %>
-
- <%= render_course_hierarchy(@courses)%>
-
+ <%= render :partial => 'layouts/no_content'%>
<% end %>
From 17fad1f2918c2e35f9f6cc99fdcb0761fde23b79 Mon Sep 17 00:00:00 2001
From: huang
Date: Fri, 14 Aug 2015 17:05:27 +0800
Subject: [PATCH 34/50] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=EF=BC=88=E6=89=80?=
=?UTF-8?q?=E6=9C=89=E6=B6=88=E6=81=AF=EF=BC=89--=E5=8F=91=E5=B8=83?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E3=80=81=E6=96=B0=E9=97=BB=E3=80=81=E9=97=AE?=
=?UTF-8?q?=E5=8D=B7=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 11 +--
app/models/user.rb | 1 +
app/views/users/user_messages.html.erb | 117 ++++++++++---------------
3 files changed, 54 insertions(+), 75 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 1579a23c4..bee68c419 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -98,11 +98,12 @@ class UsersController < ApplicationController
# 用户消息
def user_messages
- @user_messges = @user.forge_messages
- respond_to do |format|
- format.html{render :layout=>'base_users_new'}
- format.api
- end
+ @user_course_messages = @user.course_messages
+ @user_project_messges = @user.forge_messages
+ respond_to do |format|
+ format.html{render :layout=>'base_users_new'}
+ format.api
+ end
end
def user_projects_index
diff --git a/app/models/user.rb b/app/models/user.rb
index 3cd248c8a..bb9a6d0a1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -129,6 +129,7 @@ class User < Principal
has_many :documents # 项目中关联的文档再次与人关联
# 关联虚拟表
has_many :forge_messages
+ has_many :course_messages
# end
# 虚拟转换
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index e7fcb790a..1891a5a99 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -1,75 +1,52 @@
-
diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css
index 31657eae1..5a4a4c195 100644
--- a/public/stylesheets/public_new.css
+++ b/public/stylesheets/public_new.css
@@ -586,9 +586,10 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:35px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2;}
.homepageRightBlock {}
.homepageNewsList {width:710px; height:39px; line-height:39px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin:0 auto;}
+.homepageNewsPortrait {width:40px; display:block; margin-top:7px;}
.homepageNewsPublisher {width:95px; font-size:12px; color:#15bccf; display:block;}
.homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;}
-.homepageNewsContent {width:445px; font-size:12px; color:#4b4b4b; display:block;}
+.homepageNewsContent {width:405px; font-size:12px; color:#4b4b4b; display:block;}
.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;}
a.homepageWhite {color:#ffffff;}
a.homepageWhite:hover {color:#a1ebff}
From 2cb5292dc133766aa7ad87a7245df7f271a531fa Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 15 Aug 2015 00:08:05 +0800
Subject: [PATCH 37/50] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E6=B6=88=E6=81=AF=E5=9B=9E=E5=A4=8D?=
=?UTF-8?q?=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/message.rb | 48 ++++++++++++++++++++++++++
app/views/users/user_messages.html.erb | 9 +++++
2 files changed, 57 insertions(+)
diff --git a/app/models/message.rb b/app/models/message.rb
index eb86d47d6..aa62cd625 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -197,6 +197,54 @@ class Message < ActiveRecord::Base
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id)
end
end
+
+ # 课程讨论区添加消息
+ # 老师发帖所有人都能收到消息
+ # 学生发帖,有人回复则给该学生消息,没回复则不给其它人发送消息
+ # 帖子被回复的可以收到消息通知
+ def act_as_course_message
+ if self.course
+ if self.parent_id.nil? #主贴
+ self.course.members.each do |m|
+ if self.author.allowed_to?(:as_teacher, self.course) # 老师
+ if m.user_id != self.author_id # 自己的帖子不给自己发送消息
+ self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
+ end
+ end
+ end
+ else # 回帖
+ #if self.author.allowed_to?(:as_teacher, self.course) # 老师
+ self.course.members.each do |m|
+ if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
+ self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
+ end
+ end
+ #end
+ end
+ end
+ # if self.author.allowed_to?(:as_teacher, self.course) # 如果发帖人是老师
+ # self.course.members.each do |m|
+ # if self.parent_id.nil? # 主贴
+ # if m.user_id != self.author_id # 自己的帖子不给自己发送消息
+ # self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
+ # end
+ # else # 回帖只针对主贴发送消息
+ # if m.user_id == Message.find(self.parent_id).author_id
+ # self.course_messages << CourseMessage.new(:user_id => self.parent_id, :course_id => self.board.course_id, :viewed => false)
+ # end
+ # end
+ # end
+ # else # 学生只针对主贴回复
+ # unless self.parent_id.nil?
+ # self.course.members.each do |m|
+ # if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
+ # self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
+ # end
+ # end
+ # end
+ # end
+ #end
+ end
#更新用户分数 -by zjc
def be_user_score
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index 84aace520..204ed2c08 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -50,6 +50,15 @@
<%= time_tag(ucm.course_message.created_at).html_safe %>
<% end %>
+ <% if ucm.course_message_type == "Message" %>
+
+ 
+ - <%= ucm.course_message.author %>
+ - 发布帖子
+ - <%= ucm.course_message.subject %>
+ - <%= time_tag(ucm.course_message.created_on).html_safe %>
+
+ <% end %>
<% end %>
From ed8c4ac906f864b3c5fd1118954be0dc4f229da4 Mon Sep 17 00:00:00 2001
From: huang
Date: Sat, 15 Aug 2015 02:11:18 +0800
Subject: [PATCH 38/50] =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=B1=BB=E5=9E=8B?=
=?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 26 +++++++++++---
app/models/user.rb | 20 +++++++++++
app/views/users/user_messages.html.erb | 40 ++++++++++++++--------
public/stylesheets/public_new.css | 47 +++++++++++++++++++++++++-
4 files changed, 113 insertions(+), 20 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index bee68c419..c6dfb9b54 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -98,12 +98,28 @@ class UsersController < ApplicationController
# 用户消息
def user_messages
- @user_course_messages = @user.course_messages
- @user_project_messges = @user.forge_messages
- respond_to do |format|
- format.html{render :layout=>'base_users_new'}
- format.api
+ if @user.course_messages
+ if params[:type].nil?
+ @user_course_messages = @user.course_messages
+ @user_project_messges = @user.forge_messages
+ else
+ case params[:type]
+ when 'homework'
+ @user_course_messages = @user.course_messages
+ #@user_course_messages = ForgeMessage.find_by_sql("select * from course_messages where user_id='#{@user.id}' and course_message_type = 'HomeworkCommon' order by created_at desc;")
+ when 'message'
+ @user_course_messages = @user.course_message_message
+ when 'news'
+ @user_course_messages = @user.course_message_new
+ when 'poll'
+ @user_course_messages = @user.course_message_poll
end
+ end
+ respond_to do |format|
+ format.html{render :layout=>'base_users_new'}
+ format.api
+ end
+ end
end
def user_projects_index
diff --git a/app/models/user.rb b/app/models/user.rb
index bb9a6d0a1..4bc249673 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -134,6 +134,10 @@ class User < Principal
# 虚拟转换
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
+ has_many :course_messages_homeworks, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="HomeworkCommon"'
+ has_many :course_messages_polls, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="Poll"'
+ has_many :course_messages_messages, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="Message"'
+ has_many :course_messages_news, :class_name => 'ForgeMessage', :conditions => 'forge_message_type="News"'
has_many :issue_assigns, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Issue"'
has_many :status_updates, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Journal"'
# 邮件邀请状态
@@ -248,6 +252,22 @@ class User < Principal
# count = self.journals_for_messages(:conditions => ["status=? and is_readed = ? " ,1, 0]).count
end
+ def course_message_homework user
+ user.course_messages_homeworks
+ end
+
+ def course_message_poll
+ self.course_messages_polls
+ end
+
+ def course_message_new
+ self.course_messages_news
+ end
+
+ def course_message_message
+ self.course_messages_messages
+ end
+
# 查询指派给我的缺陷记录
def count_new_issue_assign_to
self.issue_assigns
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index 204ed2c08..687a694bb 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -6,20 +6,20 @@
-
- - 全部
- - @我
- - 作业消息
- - 课程通知
- - 指派给我
- - 讨论区回复
- - 留言
- - 申请消息
+ - <%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %>
+
+ - <%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %>
+ - <%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %>
+ - <%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %>
+
+ - <%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %>
+ <% if !@user_course_messages.nil? %>
<% @user_course_messages.each do |ucm| %>
<% if ucm.course_message_type == "News" %>
@@ -27,7 +27,7 @@
- <%= ucm.course_message.author %>
- 发布通知
-
- <%= link_to format_activity_title("#{l(:label_news)}: #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %>
+ <%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %>
- <%= time_tag(ucm.course_message.created_on).html_safe %>
<% end %>
@@ -37,7 +37,7 @@
<%= ucm.course_message.user %>
发布作业
- <%= link_to format_activity_title("#{ucm.course_message.name}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %>
+ <%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id) %>
<%= time_tag(ucm.course_message.created_at).html_safe %>
<% end %>
@@ -46,7 +46,8 @@
<%= ucm.course_message.user %>
发布问卷
-
<%= ucm.course_message.polls_name %>
+
+ <%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id) %>
<%= time_tag(ucm.course_message.created_at).html_safe %>
<% end %>
@@ -54,13 +55,24 @@
<% end %>
<% end %>
+ <% else %>
+
你没有新消息!
+ <% end %>
diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css
index 5a4a4c195..a14aa6759 100644
--- a/public/stylesheets/public_new.css
+++ b/public/stylesheets/public_new.css
@@ -596,4 +596,49 @@ a.homepageWhite:hover {color:#a1ebff}
a.newsGrey {color:#4b4b4b;}
a.newsGrey:hover {color:#000000;}
a.newsBlue {color:#15bccf;}
-a.newsBlue:hover {color:#0781b4;}
\ No newline at end of file
+a.newsBlue:hover {color:#0781b4;}
+
+/***** Flash & error messages ****/
+#errorExplanation, div.flash, .nodata, .warning, .conflict {
+ padding: 4px 4px 4px 30px;
+ margin-bottom: 12px;
+ font-size: 1.1em;
+ border: 2px solid;
+}
+
+div.flash {margin-top: 8px;}
+
+div.flash.error, #errorExplanation {
+ background: url(../images/exclamation.png) 8px 50% no-repeat;
+ background-color: #ffe3e3;
+ border-color: #dd0000;
+ color: #880000;
+}
+
+div.flash.notice {
+ background: url(../images/true.png) 8px 5px no-repeat;
+ background-color: #dfffdf;
+ border-color: #9fcf9f;
+ color: #005f00;
+}
+
+div.flash.warning, .conflict {
+ background: url(../images/warning.png) 8px 5px no-repeat;
+ background-color: #FFEBC1;
+ border-color: #FDBF3B;
+ color: #A6750C;
+ text-align: left;
+}
+
+.nodata, .warning {
+ text-align: center;
+ background-color: #FFEBC1;
+ border-color: #FDBF3B;
+ color: #A6750C;
+}
+
+#errorExplanation ul { font-size: 0.9em;}
+#errorExplanation h2, #errorExplanation p { display: none; }
+
+.conflict-details {font-size:80%;}
+/***** end Flash & error messages ****/
\ No newline at end of file
From ac4d529ebc5ab9eb0b1039514948dd72cd144251 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 15 Aug 2015 10:45:56 +0800
Subject: [PATCH 39/50] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=8F=96=E6=B6=88=EF=BC=8C=E5=B9=B6=E8=AE=BE=E5=AE=9A=E5=8C=BF?=
=?UTF-8?q?=E8=AF=84=E4=B8=BA=E5=86=85=E7=BD=AE=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 44 +++++++--------
app/views/boards/_form.html.erb | 2 +-
app/views/boards/show.html.erb | 55 ++-----------------
.../_homework_detail_manual_form.html.erb | 2 +-
app/views/homework_common/new.html.erb | 28 +++-------
config/locales/my/zh.yml | 1 -
config/locales/projects/zh.yml | 1 -
7 files changed, 37 insertions(+), 96 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 21f781a1a..87c1e288b 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -19,28 +19,28 @@ class HomeworkCommonController < ApplicationController
end
def new
- # @homework_type = "1"
- #
- # @homework = HomeworkCommon.new
- # @homework.safe_attributes = params[:homework_common]
- # @homework.late_penalty = 2
- # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
- #
- # if @homework_type == "1"
- # #匿评作业相关属性
- # @homework_detail_manual = HomeworkDetailManual.new
- # @homework_detail_manual.ta_proportion = 0.6
- # @homework_detail_manual.absence_penalty = 2
- # @homework_detail_manual.evaluation_num = 3
- # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
- # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
- # @homework.homework_detail_manual = @homework_detail_manual
- # elsif @homework_type == "2"
- # #编程作业相关属性
- # @homework_detail_programing = HomeworkDetailPrograming.new
- # @homework.homework_detail_programing = @homework_detail_programing
- # end
+ @homework_type = "1"
+
+ @homework = HomeworkCommon.new
+ @homework.safe_attributes = params[:homework_common]
+ @homework.late_penalty = 2
+ @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.publish_time = Time.now.strftime('%Y-%m-%d')
+
+ if @homework_type == "1"
+ #匿评作业相关属性
+ @homework_detail_manual = HomeworkDetailManual.new
+ @homework_detail_manual.ta_proportion = 0.6
+ @homework_detail_manual.absence_penalty = 2
+ @homework_detail_manual.evaluation_num = 3
+ @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
+ @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
+ @homework.homework_detail_manual = @homework_detail_manual
+ elsif @homework_type == "2"
+ #编程作业相关属性
+ @homework_detail_programing = HomeworkDetailPrograming.new
+ @homework.homework_detail_programing = @homework_detail_programing
+ end
respond_to do |format|
format.html
end
diff --git a/app/views/boards/_form.html.erb b/app/views/boards/_form.html.erb
index 47ae0672d..a4f58dcc3 100644
--- a/app/views/boards/_form.html.erb
+++ b/app/views/boards/_form.html.erb
@@ -1,7 +1,7 @@
<%= error_messages_for @board %>
-
+
<%= f.text_field :name, :required => true %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb
index 5520f526d..609294161 100644
--- a/app/views/boards/show.html.erb
+++ b/app/views/boards/show.html.erb
@@ -1,12 +1,5 @@