课程(所有消息)--发布作业、新闻、问卷界面

This commit is contained in:
huang 2015-08-14 17:05:27 +08:00
parent 7ea0fac774
commit 17fad1f291
3 changed files with 54 additions and 75 deletions

View File

@ -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

View File

@ -129,6 +129,7 @@ class User < Principal
has_many :documents # 项目中关联的文档再次与人关联
# 关联虚拟表
has_many :forge_messages
has_many :course_messages
# end
# 虚拟转换

View File

@ -1,75 +1,52 @@
<div id="RSide" class="fl">
<div class="homepageRight">
<div class="resources">
<div class="resourcesBanner">
<div class="bannerName">消息</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><a href="javascript:void(0);" class="resourcesGrey">全部</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">作业消息</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">课程通知</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">讨论区回复</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">留言</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">申请消息</a></li>
</ul>
</li>
</ul>
</div>
<div class="homepageRight">
<div class="resources">
<div class="resourcesBanner">
<div class="bannerName">消息</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><a href="javascript:void(0);" class="resourcesGrey">全部</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">作业消息</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">课程通知</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">讨论区回复</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">留言</a></li>
<li><a href="javascript:void(0);" class="resourcesGrey">申请消息</a></li>
</ul>
</li>
</ul>
</div>
<div>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">发布作业</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">请写一到两个你认为Ruby中最吸引人的语句</a></li>
<li class="homepageNewsTime fl">10分钟前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">发布通知</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">请写一到两个你认为Ruby中最吸引人的语句</a></li>
<li class="homepageNewsTime fl">10分钟前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">提交作品</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">第一章作品</a></li>
<li class="homepageNewsTime fl">10分钟前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">指派任务</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">图片显示不全,请及时修改</a></li>
<li class="homepageNewsTime fl">10分钟前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">讨论区回复</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">课程作业设计稿什么时候出来?</a></li>
<li class="homepageNewsTime fl">1小时前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">给我留言</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">课程作业设计稿什么时候出来?</a></li>
<li class="homepageNewsTime fl">3天前</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">申请加入</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">课程名称/项目名称</a></li>
<li class="homepageNewsTime fl">2015.7.31</li>
</ul>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue">尹教授</a></li>
<li class="homepageNewsType fl">@我</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">明天去上课吗?</a></li>
<li class="homepageNewsTime fl">2015.7.23</li>
</ul>
<div>
<% @user_course_messages.each do |ucm| %>
<% if ucm.course_message_type == "News" %>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
<li class="homepageNewsType fl">发布通知</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"><%= ucm.course_message.title %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "HomeworkCommon" %>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布作业</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"><%= ucm.course_message.name %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Poll" %>
<ul class="homepageNewsList">
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布问卷</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"><%= ucm.course_message.polls_name %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
</div>
</div>
</div>
</div>
</div>