Feature: Rewamp super admin dashboard (#882)

This commit is contained in:
Sojan Jose
2020-05-24 22:44:26 +05:30
committed by GitHub
parent e49a200ee0
commit d8d14fc4a4
63 changed files with 2190 additions and 79 deletions

View File

@@ -2,10 +2,32 @@ class SuperAdmin::AccountUsersController < SuperAdmin::ApplicationController
# Overwrite any of the RESTful controller actions to implement custom behavior
# For example, you may want to send an email after a foo is updated.
#
# def update
# super
# send_foo_updated_email(requested_resource)
# end
def create
resource = resource_class.new(resource_params)
authorize_resource(resource)
redirect_resource = params[:redirect_to] == 'user' ? resource.user : resource.account
if resource.save
redirect_to(
[namespace, redirect_resource],
notice: translate_with_resource('create.success')
)
else
redirect_to(
[namespace, redirect_resource],
notice: resource.errors.full_messages.first
)
end
end
def destroy
if requested_resource.destroy
flash[:notice] = translate_with_resource('destroy.success')
else
flash[:error] = requested_resource.errors.full_messages.join('<br/>')
end
redirect_to([namespace, requested_resource.account])
end
# Override this method to specify custom lookup behavior.
# This will be used to set the resource for the `show`, `edit`, and `update`