增加留言、指派给我

This commit is contained in:
ouyangxuhua 2015-08-18 14:43:15 +08:00
parent 4bc0e0eb69
commit 3e4f726855
2 changed files with 34 additions and 3 deletions

View File

@ -126,6 +126,9 @@ class UsersController < ApplicationController
when 'issue'
@user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc")
@user_course_messages = nil
when 'journal'
@user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc")
@user_course_messages = nil
end
respond_to do |format|
format.html{render :layout=>'base_users_new'}

View File

@ -14,6 +14,7 @@
<!--<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>-->
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %></a></li>
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "指派给我",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'issue'} %></a></li>
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问题更新",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'journal'} %></a></li>
</ul>
</li>
</ul>
@ -76,9 +77,36 @@
<!--项目消息-->
<% unless @user_forge_messages.nil? %>
<% @user_forge_messages.each do |ufm| %>
<% if ufm.forge_message_type == "Issue" %>
22222
<% end %>
<% if ufm.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.author), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.author %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">发了问题给我</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.subject}"), issue_path(:id => ufm.forge_message.id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ufm.forge_message_type == "Journal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(ufm.forge_message.user), :width => "30", :height => "30") %></a>
</li>
<li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.user %></a>
</li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">发了留言给我</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ufm.forge_message.notes}"), issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% end %>
<% else %>