Commit e6ea2336 authored by o's avatar o

redirect on success

parent 4f185a86
Pipeline #4143 failed with stages
in 13 seconds
......@@ -26,6 +26,8 @@ class ResourcesAdminController < ApplicationController
def update
@params = params
uid = params[:uid]
@resource_name = (
params[:resource_name] if resource_list.include? params[:resource_name])
case params[:commit]
when 'delete'
......@@ -33,7 +35,6 @@ class ResourcesAdminController < ApplicationController
when 'purge'
@res = api.resource_purge(uid)
when 'create'
@resource_name = params[:resource_name]
if resource_list.include? @resource_name
data = {}
params.each do |name, v|
......@@ -57,7 +58,10 @@ class ResourcesAdminController < ApplicationController
end
else
flash[:danger] = :failed
return
end
flash[:success] = :success
redirect_to resources_admin_path(resource_name: @resource_name)
rescue ApiError => e
flash[:danger] = e.api_msg
end
......
......@@ -31,6 +31,7 @@
<h4>Existing:</h4>
<% @resources.each do |res| %>
<%= form_tag do %>
<%= hidden_field_tag 'resource_name', @resource_name %>
<%= hidden_field_tag 'uid', res['uid'] %>
<div class="tooltipsummary"><%= res['resource']['email'] %>
......@@ -57,6 +58,7 @@
<h4>Deleted:</h4>
<% @deleted_resources.each do |res| %>
<%= form_tag do %>
<%= hidden_field_tag 'resource_name', @resource_name %>
<%= hidden_field_tag 'uid', res['uid'] %>
<div class="tooltipsummary"><%= res['resource']['email'] %>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment