Class: EasyAdmin::Permissions::Controller::BasicPermissionDeniedComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_admin/permissions/controller.rb

Overview

Basic fallback components for when full components aren’t defined

Instance Method Summary collapse

Constructor Details

#initialize(permission:) ⇒ BasicPermissionDeniedComponent

Returns a new instance of BasicPermissionDeniedComponent.



126
127
128
# File 'lib/easy_admin/permissions/controller.rb', line 126

def initialize(permission:)
  @permission = permission
end

Instance Method Details

#callObject



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/easy_admin/permissions/controller.rb', line 130

def call
  <<~HTML
    <div class="flex items-center justify-center min-h-96">
      <div class="text-center">
        <div class="text-6xl text-gray-400 mb-4">🔒</div>
        <h2 class="text-2xl font-bold text-gray-900 mb-2">Permission Denied</h2>
        <p class="text-gray-600">You need the '#{@permission}' permission to access this resource.</p>
        <a href="javascript:history.back()" class="inline-block mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">Go Back</a>
      </div>
    </div>
  HTML
end