添加了留言结果在用户动态里面显示

This commit is contained in:
huangjingquan 2013-12-04 21:24:52 +08:00
parent 6cede3d2be
commit 096f0eed03
5 changed files with 50 additions and 0 deletions

View File

@ -5,6 +5,8 @@ class JournalsForMessage < ActiveRecord::Base
belongs_to :jour, :polymorphic => true belongs_to :jour, :polymorphic => true
belongs_to :user belongs_to :user
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
after_create :act_as_activity #huang
def self.delete_message(message_id) def self.delete_message(message_id)
self.delete_all "id = #{message_id}" self.delete_all "id = #{message_id}"
@ -20,4 +22,9 @@ class JournalsForMessage < ActiveRecord::Base
message message
end end
def act_as_activity
if self.jour_type == 'Principal'
self.acts << Activity.new(:user_id => self.user_id)
end
end
end end

View File

@ -27,6 +27,27 @@
<td> <td>
<table width="580" border="0" class "info-break"> <table width="580" border="0" class "info-break">
<% case e.act_type %> <% case e.act_type %>
<% when 'JournalsForMessage' %>
<% if User.current.login == @user.login %>
<% if e.user_id == act.jour.id %>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{e.user.show_name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">给你留言了</td></tr>
<% else %>
<tr><td colspan="2" valign="top" class="font_lighter"><strong><%= link_to("#{e.user.show_name}", user_path(e.user_id)) %> 给 <%= link_to("#{act.jour.show_name}", user_path(act.jour.id)) %> 留言了</strong>&nbsp;<span class="font_lighter"></td></tr>
<% end %>
<% else %>
<tr><td colspan="2" valign="top"><strong><%= link_to("#{@user.show_name}", user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter">有了新的动态</td></tr>
<% end %>
<!-- end -->
<tr>
<td colspan="2" width="580" >
<p class="font_description">
<%=link_to act.notes, user_path(e.user_id) %>
</p></td>
</tr>
<tr>
<td>
<div style="display: inline-block; float: right; margin-top: 0px"></div>
<% when 'Bid' %> <% when 'Bid' %>
<tr> <tr>
<% if act.reward_type ==3 %> <% if act.reward_type ==3 %>

View File

@ -1407,6 +1407,7 @@ zh:
label_me: label_me:
label_my: label_my:
label_i: label_i:
label_you:
label_join_bidding: 参与了应标 label_join_bidding: 参与了应标
label_jion_bidding_homework: 已提交! label_jion_bidding_homework: 已提交!
label_bidding_user: 应标人: label_bidding_user: 应标人:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 KiB

After

Width:  |  Height:  |  Size: 859 KiB

View File

@ -122,8 +122,29 @@ div.sidebar-s p.location{
div.sidebar-t{ div.sidebar-t{
}
/*end*/
/*main-conten*/
div.main-content{
float: left;
width: 660px;
border-bottom: 1px dashed rgb(204, 204, 204);
margin-bottom: 10px;
font-size:14px;
}
div.main-content-f{
float:left;
width: 80px;
}
div.main-content-s{
float: left;
width: 580px;
} }
/**/ /**/
/*forums-index*/ /*forums-index*/
div.forums-index{ div.forums-index{
padding-left: 10px; padding-left: 10px;