Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq
This commit is contained in:
commit
3db692dc39
|
@ -33,6 +33,10 @@ class SystemMessagesController < ApplicationController
|
|||
# POST /products
|
||||
# POST /products.json
|
||||
def create
|
||||
unless User.current.admin?
|
||||
render_403
|
||||
return
|
||||
end
|
||||
@system_messages = SystemMessage.new
|
||||
@system_messages.content = params[:system_message][:content]
|
||||
@system_messages.user_id = User.current.id
|
||||
|
|
|
@ -114,8 +114,10 @@ class UsersController < ApplicationController
|
|||
message_new_time.save
|
||||
else
|
||||
message_new_time = OnclickTime.where("user_id =?", User.current).first
|
||||
message_last_time = message_new_time.onclick_time
|
||||
message_new_time.update_attributes(:onclick_time => Time.now)
|
||||
end
|
||||
@user_system_messages = SystemMessage.where("created_at >?", message_last_time)
|
||||
# 当前用户查看消息,则设置消息为已读
|
||||
if params[:viewed] == "all"
|
||||
course_querys = @user.course_messages
|
||||
|
|
|
@ -39,6 +39,18 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# 系统消息 %>
|
||||
<% @user_system_messages.each do |usm| %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);">ddddddddddddddd</a></li>
|
||||
<li class="homepageNewsPubType fl">Trustiep平台<span class="homepageNewsType fl">发布新消息:</span></li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to usm.content, {:controller => 'system_messages', :action => 'index'},
|
||||
:class =>"newsGrey",
|
||||
:title => "#{usm.content.html_safe}" %></li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%# 课程消息 %>
|
||||
<% unless @message_alls.nil? %>
|
||||
<% @message_alls.each do |ma| %>
|
||||
|
|
Loading…
Reference in New Issue