ADD admin destroy dynamic_new

This commit is contained in:
Jasder 2019-10-21 17:09:26 +08:00
parent 2e4e631c6c
commit 418975c21e
4 changed files with 11 additions and 5 deletions

View File

@ -1,7 +1,8 @@
class DynamicNewsController < ApplicationController
layout 'admin', only: [:new, :index]
layout 'admin', only: [:new, :index, :destroy]
before_filter :require_admin, :only => [:new, :create, :destroy]
before_filter :find_dynamic_new, :only => [:show, :destroy]
def index
@ -36,10 +37,15 @@ class DynamicNewsController < ApplicationController
end
def destroy
@dynamic_new.destroy
redirect_to admin_dynamic_news_path
end
def show
end
private
def find_dynamic_new
@dynamic_new = DynamicNew.find params[:id]
end
end

View File

@ -2674,7 +2674,7 @@ class UsersController < ApplicationController
#Modified by nie
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
# redirect_to home_path
# redirect_to homes_path
render_404
return
end

View File

@ -55,7 +55,7 @@
</td>
<td class="buttons" style="vertical-align: middle;text-align:center">
<%= link_to("修改", upload_logo_school_path(dynamic_new.id,:school_name => @school_name), :class => 'icon icon-copy') %>
<%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
<%= link_to(l(:button_delete), dynamic_news_path(dynamic_new), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end %>

View File

@ -24,7 +24,7 @@
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<span>
<%#= link_to org.name,home_path(:organization => org.id) %>
<%#= link_to org.name,homes_path(:organization => org.id) %>
<%= link_to org.name, organization_path(org) %>
</span>
</td>