给超级管理员增加删除课程的权限

This commit is contained in:
cxt 2017-03-17 09:43:46 +08:00
parent fcae5e9690
commit b6996da6db
3 changed files with 26 additions and 18 deletions

View File

@ -1,17 +1,25 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a>
<% else %>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>取消</a>
<% end %>
<div id="muban_popup_box" style="width:470px;">
<div class="muban_popup_top">
<h3 class="fl">删除课程</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div style='text-align:center;font-family: "微软雅黑","宋体"' class="mt20 f14">
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
<div style='width:164px; margin:0 auto; margin-top: 15px; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<a href='javascript:void(0);' class='sy_btn_grey fl mr5' style="margin-left: 25px;" onclick='hideModal()'>取消</a>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'sy_btn_blue fl', :method => 'delete'%>
<% else %>
<a href='javascript:void(0);' class='sy_btn_blue' onclick='hideModal()'>确定</a>
<% end %>
<div class="cl"></div>
</div>
</div>

View File

@ -1,2 +1,2 @@
var htmlvalue = "<%=escape_javascript(render :partial => 'delete_syllabus') %>";
pop_up_box(htmlvalue,500,30,50);
pop_box_new(htmlvalue, 470, 30);

View File

@ -46,7 +46,7 @@
<li>
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
</li>
<% if User.current == syllabus.user %>
<% if User.current == syllabus.user || User.current.admin? %>
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<% end %>
</ul>