diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index f2b5b1af0..1579a23c4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -98,7 +98,7 @@ class UsersController < ApplicationController
# 用户消息
def user_messages
- #@user_messges = User.current.forge_messages
+ @user_messges = @user.forge_messages
respond_to do |format|
format.html{render :layout=>'base_users_new'}
format.api
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index 5fe01db96..217c7d770 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -15,12 +15,14 @@ class HomeworkCommon < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
+ # 课程消息
+ has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
acts_as_attachable
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
- after_create :act_as_activity, :send_mail, :act_as_course_activity
+ after_create :act_as_activity, :send_mail, :act_as_course_activity, :act_as_course_message
after_destroy :delete_kindeditor_assets
def act_as_activity
@@ -34,6 +36,17 @@ class HomeworkCommon < ActiveRecord::Base
end
end
+ #课程作业消息记录
+ def act_as_course_message
+ if self.course
+ self.course.members.each do |m|
+ if m.user_id != self.user_id
+ self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
+ end
+ end
+ end
+ end
+
#删除对应的图片
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
diff --git a/app/models/poll.rb b/app/models/poll.rb
index 34a381246..c5a6a294d 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -10,7 +10,9 @@ class Poll < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
- after_create :act_as_activity, :act_as_course_activity
+ # 课程消息
+ has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
+ after_create :act_as_activity, :act_as_course_activity, :act_as_course_message
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
:description => :polls_description,
@@ -35,4 +37,16 @@ class Poll < ActiveRecord::Base
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
end
end
+
+ # 发布问卷,出了发布者外,其他人都能收到消息通知
+ def act_as_course_message
+ if self.polls_type == "Course"
+ Course.find(self.polls_group_id).members.each do |m|
+ if m.user_id != self.user_id
+ self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.polls_group_id, :viewed => false)
+ end
+ end
+ end
+ end
+
end
diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb
index 463381db8..e7fcb790a 100644
--- a/app/views/users/user_messages.html.erb
+++ b/app/views/users/user_messages.html.erb
@@ -1,117 +1,75 @@
-
-
-
- 新建课程
-
-
-
-
-
-
diff --git a/public/stylesheets/images/resource_icon_list.png b/public/stylesheets/images/resource_icon_list.png
new file mode 100644
index 000000000..1b5bc6f58
Binary files /dev/null and b/public/stylesheets/images/resource_icon_list.png differ
diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css
index 7389dff8a..31657eae1 100644
--- a/public/stylesheets/public_new.css
+++ b/public/stylesheets/public_new.css
@@ -445,3 +445,154 @@ div.ke-statusbar{height:1px; border-top:none;}
/*a.f_grey {color:#666666;}*/
/*a.f_grey:hover {color:#000000;}*/
+
+/*主类容左右分栏*/
+#LSide{ width:240px; }
+#RSide{ width:730px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;}
+
+
+/*资源库*/
+.resources {width:730px; background-color:#ffffff;}
+.resourcesBanner {width:730px; height:40px; background-color:#eaeaea; margin-bottom:10px;}
+.bannerName {background:#64bdd9; color:#ffffff; height:40px; line-height:40px; width:90px; text-align:center; font-weight:normal; vertical-align:middle; font-size: 16px; float:left;}
+.resourcesSelect {width:40px; height:40px; float:right; position:relative;}
+.resourcesSelected {width:25px; height:20px;}
+.resourcesIcon {margin-top:15px; display:block; position:relative; background:url(images/resource_icon_list.png) 0px 0px no-repeat; width:25px; height:20px;}
+.resourcesIcon:hover { background:url(images/resource_icon_list.png) 0px -25px no-repeat;}
+.resourcesType {width:50px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:35px; padding:5px 10px; left:-30px; font-size:12px; color:#888888; display:none;}
+a.resourcesGrey {font-size:12px; color:#888888;}
+a.resourcesGrey:hover {font-size:12px; color:#15bccf;}
+.resourcesBanner ul li:hover ul.resourcesType {display:block;}
+ul li:hover ul {display:block;}
+.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}
+.uploadIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:30px; height:30px; margin-left:-3px;}
+a.uploadText {color:#ffffff; font-size:14px;}
+.resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:right; background-color:#ffffff;}
+.searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;}
+.searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;}
+.resourcesSearchBanner {height:34px; margin-bottom:10px;}
+.resourcesListTab {width:730px; height:40px; background-color:#f6f6f6; border-bottom:1px solid #eaeaea; font-size:14px; color:#7a7a7a;}
+.resourcesListCheckbox {width:40px; height:40px; line-height:40px; text-align:center; vertical-align:middle;}
+.resourcesCheckbox {padding:0px; margin:0px; margin-top:14px; width:12px; height:12px;}
+.resourcesListName {width:135px; height:40px; line-height:40px; text-align:left;}
+.resourcesListSize {width:110px; height:40px; line-height:40px; text-align:center;}
+.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;}
+.resourcesListUploader {width:130px; height:40px; line-height:40px; text-align:center;}
+.resourcesListTime {width:165px; height:40px; line-height:40px; text-align:center;}
+.resourcesList {width:730px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px;}
+a.resourcesBlack {font-size:12px; color:#4c4c4c;}
+a.resourcesBlack:hover {font-size:12px; color:#000000;}
+.dropdown-menu {
+ position: absolute;
+ top: 100%;
+ left: 0;
+ z-index: 1000;
+ display: none;
+ float: left;
+ min-width: 80px;
+ padding: 5px 0;
+ margin: 2px 0 0;
+ font-size: 12px;
+ text-align: left;
+ background-color: #fff;
+ -webkit-background-clip: padding-box;
+ background-clip: padding-box;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
+ box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
+}
+.dropdown-menu > 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