Class: EasyAdmin::Permissions::Controller::BasicRoleDeniedComponent

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

Instance Method Summary collapse

Constructor Details

#initialize(role:) ⇒ BasicRoleDeniedComponent

Returns a new instance of BasicRoleDeniedComponent.



145
146
147
# File 'lib/easy_admin/permissions/controller.rb', line 145

def initialize(role:)
  @role = role
end

Instance Method Details

#callObject



149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/easy_admin/permissions/controller.rb', line 149

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">Role Required</h2>
        <p class="text-gray-600">You need the '#{@role}' role 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