新闻界面添加删除功能

This commit is contained in:
huangjingquan 2013-11-01 10:01:16 +08:00
parent 5febe8a58d
commit 775ebc3607
2 changed files with 83 additions and 75 deletions

View File

@ -1,3 +1,4 @@
<!-- added by huang -->
<div style="padding-bottom: 10px">
<% if @project.project_type == 1%>
<%= link_to(l(:label_news_notice),
@ -48,20 +49,25 @@
<!--add by huang :list news-->
<div style="padding-top: 15px">
<% if @newss.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<table width="660px" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(news.author), :class => "avatar"), user_path(news.author) %></td>
<td><table width="580px" border="0">
<td>
<table width="580px" border="0">
<% if @project.project_type == 1 %>
<tr>
<td colspan="2" valign="top"><strong><%=link_to_user(news.author)if news.respond_to?(:author) %></strong> <span class="font_lighter"><%= l(:label_project_notice)%></span> <%= 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_notice)%></span><span><%= link_to h(news.title), news_path(news) %></span>
<span style="float: right"><%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span></td>
</tr>
<% else %>
<tr>
<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>
<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><span> <%= link_to h(news.title), news_path(news) %></span>
<span style="float: right"> <%= delete_link news_path(news) if User.current.allowed_to?(:manage_news, @project) %> </span></td>
</tr>
<% end %>
<tr>
@ -75,7 +81,8 @@
</tr>
</table>
<% end %>
<% end %></div>
<% end %>
</div>
<!--end-->
<div style="padding-right: 10px">
<div class="pagination">
@ -93,4 +100,5 @@
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title(l(:label_news_plural)) -%> </div>
<% html_title(l(:label_news_plural)) -%>
</div>