右一模式

This commit is contained in:
huang 2016-06-02 18:41:00 +08:00
parent 76732a3034
commit 0b3ec0322f
3 changed files with 57 additions and 47 deletions

View File

@ -66,11 +66,40 @@ module OrganizationsHelper
def org_user_by_type obj
case obj.act_type
when "Message"
user = obj.act.author
when "News"
user = obj.act.author
when "HomeworkCommon"
user = obj.act.user
when "Issue"
user = obj.act.author
end
end
def org_title_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.subject : obj.act.parent.subject
when "News"
user = obj.act.title
when "HomeworkCommon"
user = obj.act.name
when "Issue"
user = obj.act.subject
end
end
def org_content_by_type obj
case obj.act_type
when "Message"
user = obj.act.parent_id.nil? ? obj.act.content : obj.act.parent.content
when "News"
user = obj.act.description
when "HomeworkCommon"
user = obj.act.description
when "Issue"
user = obj.act.description
end
end
#排列下拉框

View File

@ -5,44 +5,32 @@
<% else %>
<ul class="por_news_list clear">
<% @acts.each do |obj| %>
<% if obj.act_type = "Message" %>
<% user = org_user_by_type(obj) %>
<% title = org_title_by_type(obj) %>
<% content = org_content_by_type(obj) %>
<% message = obj.act %>
<% title = message.parent_id.nil? ? message.subject : message.parent.subject %>
<li>
<%= link_to image_tag(url_to_avatar(user),:width => "43", :height => "43", :class => "por_users_img"), user_path(user), :target => "_blank", :class => "fl" %>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name fl", :target => "_blank" %>
<span class="fl">&nbsp;:&nbsp;</span>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> message.content, :maxheight => 40, :maxwordsnum => 28, :maxwidth => 0, :cl => ""} %>
</p>
<p><span class="por_time fl"><%= time_from_now(message.created_on) %> </span>
<!--<a href="javascript:void(0);" target="_blank" class="por_zan fr">50</a>-->
</p>
</div>
<div class="cl"></div>
</li>
<% elsif obj.act_type = "News" %>
<% elsif obj.act_type = "HomeworkCommon" %>
<% elsif obj.act_type = "Issue" %>
<% end %>
<% user = org_user_by_type(obj) %>
<% title = org_title_by_type(obj) %>
<% content = org_content_by_type(obj) %>
<li>
<%= link_to image_tag(url_to_avatar(user),:width => "43", :height => "43", :class => "por_users_img"), user_path(user), :target => "_blank", :class => "fl" %>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<%= link_to user.show_name, user_path(user), :class => "por_hot_name fl", :target => "_blank" %>
<span class="fl">&nbsp;:&nbsp;</span>
<% if obj.act_type = "Message" %>
<%= link_to title, board_message_path(obj.act.board.id, obj.act.id) %>
<% elsif obj.act_type = "News" %>
<%= link_to title, news_path(obj.act.id) %>
<% elsif obj.act_type = "HomeworkCommon" %>
<%= link_to title, student_work_index_url_in_org(obj.act.id) %>
<% elsif obj.act_type = "Issue" %>
<%= link_to title, issue_path(obj.act.id) %>
<% end %>
</p>
<p><span class="por_time fl"><%= time_from_now(obj.act.created_on) %> </span>
<!--<a href="javascript:void(0);" target="_blank" class="por_zan fr">50</a>-->
</p>
</div>
<div class="cl"></div>
</li>
<% end %>
<li >
<a href="javascript:void(0);" target="_blank" class="fl"><img src="/images/org_custom/homepageImage.jpg" width="43" height="43" alt="" class="por_users_img"/></a>
<div class="por_news_txt fl">
<p class="por_news_p fl">
<a href="javascript:void(0);" target="_blank" class=" por_hot_name fl"> 叮当当 </a><span class="fl">&nbsp;:&nbsp;</span>
Trustie社区新版上线了必须支持一下比以前好用很多....
</p>
<p><span class="por_time fl">1分钟前 </span><a href="javascript:void(0);" target="_blank" class="por_zan fr">500</a></p>
</div>
<div class="cl"></div>
</li>
</ul>
<% end %>
</div><!--por_news end-->

View File

@ -1,16 +1,9 @@
<% if cl.nil? %>
<span class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<p class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<span id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</span>
</span>
<% else %>
<p class="<%= cl %>" id="activity_description_<%= user_activity_id %>">
<span id="intro_content_<%= user_activity_id%>">
<%= content.to_s.html_safe%>
</span>
</p>
<% end %>
</p>
<script type="text/javascript">
$("#intro_content_<%= user_activity_id %>").hide();