左二和右二文字隐藏时的更多显示

This commit is contained in:
Tim 2016-05-10 10:30:28 +08:00
parent 2461a5c918
commit c8e0ffbdae
3 changed files with 58 additions and 29 deletions

View File

@ -24,8 +24,9 @@
</h3>
<span class="txt-grey"><%= format_date activity.updated_at %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.name.to_s, student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
@ -37,16 +38,13 @@
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg",:style=>"display:block;" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% end %>
<%= link_to activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.content.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
@ -62,8 +60,9 @@
</h3>
<span class="txt-grey"><%= format_date activity.created_on %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.title.to_s, news_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Poll" %>
<% activity = Poll.find(act.org_act_id) %>
@ -86,8 +85,9 @@
</h3>
<span class="txt-grey"><%= format_date activity.published_at %></span>
<div class="sn-news-txt">
<p><%= activity.polls_description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.polls_description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", poll_name, Setting.protocol + "://" + Setting.host_name + "/poll/" + activity.id.to_s + "/poll_result", :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% end %>
<% end %>
@ -116,8 +116,9 @@
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.subject.to_s, issue_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "Message" %>
<% activity = Message.find(act.org_act_id) %>
@ -128,17 +129,14 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"sn-news-bigimg",:style=>"display:block;" %>
<% end %>
<h3>
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
<% end %>
<h3> <!--+"(帖子标题)"-->
<%= link_to activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date activity.updated_on %></span>
<div class="sn-news-txt">
<p><%= activity.content.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.parent_id.nil? ? activity.subject.to_s.html_safe : activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% elsif act.org_act_type == "News" %>
<% activity = News.find(act.org_act_id) %>
@ -154,8 +152,9 @@
</h3>
<span class="txt-grey">2016-04-08</span>
<div class="sn-news-txt">
<p><%= activity.description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", activity.description.to_s.html_safe, news_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% end %>
<% end %>
@ -190,8 +189,9 @@
</h3>
<span class="txt-grey"><%= format_date document.created_at %></span>
<div class="sn-news-txt">
<p><%= document.content.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= document.content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% else activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
@ -209,17 +209,14 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "380", :height => "165"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class =>"sn-news-bigimg",:style=>"display:block;" %>
<% end %>
<h3>
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to message.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h3-title" %>
<% else %>
<%= link_to message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h3-title" %>
<% end %>
<h3> <!--+"(帖子标题)"-->
<%= link_to message.parent_id.nil? ? message.subject.to_s.html_safe : message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => '_blank', :class => "h3-title" %>
</h3>
<span class="txt-grey"><%= format_date message.created_on %></span>
<div class="sn-news-txt">
<p><%= content.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= content.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", message.parent_id.nil? ? message.subject.to_s.html_safe : message.parent.subject.to_s.html_safe, board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% else %>
<div class="sn-news-bigbox fl">
@ -237,7 +234,14 @@
</h3>
<span class="txt-grey"><%= format_date message.created_on %></span>
<div class="sn-news-txt">
<p><%= content.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= content.to_s.html_safe %></div>
</div>
<div class="sn-read-more">
<% if message.parent_id.nil? %>
<%=link_to "查看全文>>", message.subject.to_s.html_safe, board_message_path(message.board,message), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<% else %>
<%=link_to "查看全文>>", message.parent.subject.to_s.html_safe, board_message_path(message.board,activity), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<% end %>
</div>
</div>
<% end %>
@ -256,8 +260,9 @@
</h3>
<span class="txt-grey"><%= format_date news.created_on %></span>
<div class="sn-news-txt">
<p><%= news.description.to_s.html_safe %></p>
<div class="sn-news-wrap"><%= news.description.to_s.html_safe %></div>
</div>
<div class="sn-read-more"><%=link_to "查看全文>>", news.title.to_s, news_path(news), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
</div>
<% end %>
<% end %>
@ -266,4 +271,14 @@
<% end %>
<% end %>
<script>
$(".sn-read-more").hide();
$(".sn-news-txt").each(function(){
var txtHeight = $(this).children().height();
if (txtHeight > 180){
$(this).next().show();
}
});
</script>

View File

@ -23,7 +23,8 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt sn-w229"><%=link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></p>
<p class="fl sn-index-txt sn-w229"><%=link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %></p>
<p class="fl sn-f12 sn-read-all" style="display:none;"><%=link_to "查看全文>>", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "sn-link-grey2" %></p>
<div class="cl"></div>
</div>
<% else activity.container_type == 'OrgSubfield' %>
@ -39,6 +40,7 @@
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt sn-w229"><%=link_to message.content.to_s.html_safe, board_message_url_in_org(message.board.id, message.id), :target => "_blank" %></p>
<p class="fl sn-f12 sn-read-all" style="display:none;"><%=link_to "查看全文>>", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "sn-link-grey2" %></p>
<div class="cl"></div>
</div>
<% else %>
@ -51,6 +53,7 @@
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt sn-w229"><%=link_to message.content.to_s.html_safe, board_message_path(message.board, activity), :target => "_blank" %></p>
<p class="fl sn-f12 sn-read-all" style="display:none;"><%=link_to "查看全文>>", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "sn-link-grey2" %></p>
<div class="cl"></div>
</div>
<% end %>
@ -66,6 +69,7 @@
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %>
<% end %>
<p class="fl sn-index-txt sn-w229"><%=link_to news.description.to_s.html_safe, news_path(news), :target => "_blank" %></p>
<p class="fl sn-f12 sn-read-all" style="display:none;"><%=link_to "查看全文>>", org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "sn-link-grey2" %></p>
<div class="cl"></div>
</div>
<% end %>
@ -96,3 +100,12 @@
</div>
<% end %>
<% end %>
<script>
$(".sn-index-txt").each(function(){
var wholeHeight = $(this).children().height();
if (wholeHeight > 54){
$(this).next().show();
}
});
</script>

View File

@ -52,6 +52,7 @@ a.sn-link-select {color:#809df9;}
.sn-ml15 {margin-left:15px;}
.sn-ml55 {margin-left:55px;}
.sn-mr0 {margin-right:0px !important;}
.sn-mr20 {margin-right:20px;}
.sn-mr50 {margin-right:50px;}
.sn-w229 {width:229px;}
/*头部样式*/