在新闻子页面里增加新闻描述,评论框放置新闻上端,内容倒置。

This commit is contained in:
huangjingquan 2013-08-09 09:50:08 +08:00
parent b2af215ee1
commit 1c41cbd4b5
3 changed files with 46 additions and 29 deletions

View File

@ -44,13 +44,13 @@
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(news.author), :class => "avatar") %></td> <td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(news.author), :class => "avatar") %></td>
<td><table width="580px" border="0"> <td><table width="580px" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong><%=link_to_user(news.author)if news.respond_to?(:author) %></strong> <a class="font_lighter"><%= l(:label_project_newshare)%></a> <%= link_to h(news.title), news_path(news) %></td> <td colspan="2" valign="top"><strong><%=link_to_user(news.author)if news.respond_to?(:author) %></strong> <span class="font_lighter"><%= l(:label_project_newshare)%></span> <%= link_to h(news.title), news_path(news) %></td>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580px" ><span class="font_description"><%= textilizable(news, :description) %></span></td> <td colspan="2" width="580px" ><span class="font_description"><%= textilizable(news, :description) %></span></td>
</tr> </tr>
<tr> <tr>
<td align="left"><a class="font_lighter"> <%= news.created_on %></a></td> <td align="left"><span class="font_lighter"> <%= news.created_on %></span></td>
<td width="200" align="right" class="a"><%= link_to l(:label_project_newother),news_path(news)%><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %></td> <td width="200" align="right" class="a"><%= link_to l(:label_project_newother),news_path(news)%><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count >= 0 %></td>
</tr> </tr>
</table></td> </table></td>

View File

@ -8,7 +8,7 @@
<%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %> <%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %>
</div> </div>
<h3><%=h @news.title %></h3> <h3><strong><%=h @news.title %></strong></h3>
<% if authorize_for('news', 'edit') %> <% if authorize_for('news', 'edit') %>
<div id="edit-news" style="display:none;"> <div id="edit-news" style="display:none;">
@ -36,32 +36,11 @@
</div> --> </div> -->
<!--add by huang: show subnew--> <!--add by huang: show subnew-->
<div id="comments" style="margin-bottom:16px;"> <div id="comments" style="margin-bottom:16px;">
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<% @comments.each do |comment| %>
<% next if comment.new_record? %>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(comment.author), :class => "avatar")%></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%=link_to_user(comment.author) if comment.respond_to?(:author) %>
</strong> <a class="font_lighter"><%= l(:label_project_newadd) %></a><%= l(:label_comment_plural) %></td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"> <%= textilizable(comment.comments) %></p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"> <%= @news.created_on %></a></td>
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
</tr>
</table></td>
</tr>
</table>
<% end if @comments.any? %>
</div>
<div style="margin-bottom:15px">
<span class="font_description"><%= @news.description %></span>
<!--add comment-->
<% if @news.commentable? %> <% if @news.commentable? %>
<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p> <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
@ -78,3 +57,32 @@
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %> <%= stylesheet_link_tag 'scm' %>
<% end %> <% end %>
<!--dispaly comments-->
<div class="line_heng"></div>
</div>
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(comment.author), :class => "avatar")%></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%=link_to_user(comment.author) if comment.respond_to?(:author) %>
</strong> <span class="font_lighter"><%= l(:label_project_newadd) %></span><%= l(:label_comment_plural) %></td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"> <%= textilizable(comment.comments) %></p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= @news.created_on %></span></td>
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
</tr>
</table></td>
</tr>
</table>
<% end if @comments.any? %>
</div>

View File

@ -253,6 +253,15 @@ ul.tool li{list-style-type:none;
.line_under{ .line_under{
border-bottom: 1px dashed rgb(204, 204, 204); border-bottom: 1px dashed rgb(204, 204, 204);
} }
.line_heng{
width: 670px;
height: 1px;
margin-top:5px;
border: 0px;
background-color:#D5D5D5;
color: #D5D5D5;
}
ul.user_project_sort{margin:0px; padding-left:0em;} ul.user_project_sort{margin:0px; padding-left:0em;}
ul.user_project_sort li{list-style-type:none; ul.user_project_sort li{list-style-type:none;
height:auto;} height:auto;}