项目的管理员和课程的老师都有权限删除帖子和新闻/通知的回复

This commit is contained in:
cxt 2016-09-02 15:22:09 +08:00
parent e70334ea16
commit 613f974440
6 changed files with 16 additions and 18 deletions

View File

@ -104,18 +104,15 @@
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
</li>
<% if @topic.author.id == User.current.id %>
<li>
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.destroyable_by?(User.current) %>
</li>
<% end %>
<li>
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
</li>
<li>
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if @message.destroyable_by?(User.current) %>
</li>
<% if hidden_unproject_infos %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% else %>
@ -202,7 +199,7 @@
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
) if reply.destroyable_by?(User.current) %>
</span>
<div class="cl"></div>

View File

@ -82,7 +82,7 @@
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<%= render :partial => 'news/news_all_replies' %>
<%= render :partial => 'news/news_all_replies', :locals => {:object => @course} %>
</div>
</div>
<script type="text/javascript">

View File

@ -50,7 +50,7 @@
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @news.author == User.current %>
) if User.current.allowed_to?(:manage_news, object) %>
</span>
<div class="cl"></div>
</div>

View File

@ -86,7 +86,7 @@
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<%= render :partial => 'news/news_all_replies' %>
<%= render :partial => 'news/news_all_replies', :locals => {:object => @project} %>
</div>
</div>
<script type="text/javascript">

View File

@ -33,7 +33,7 @@
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.course_destroyable_by?(User.current) %>
<% if comment.course_destroyable_by?(User.current) || comment.destroyable_by?(User.current) %>
<%= link_to(
l(:button_delete),
delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board),

View File

@ -56,8 +56,9 @@
:title => l(:button_reply)) %>
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% news = News.find(activity_id) %>
<%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) if News.find(activity_id).author == User.current %>
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %>
<% elsif type == 'Issue' %>
<span style="position: relative" class="fr mr20">
<%= link_to(