Class: Global::Error

Inherits:
Components::Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::TurboFrameTag
Defined in:
app/components/databasium/global/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(message: nil, details: nil, type: nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
# File 'app/components/databasium/global/error.rb', line 8

def initialize(message: nil, details: nil, type: nil)
  @message = message
  @details = details
  @type = type
end

Instance Method Details

#view_templateObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/databasium/global/error.rb', line 14

def view_template
  div(id: "error") do
    div(
      class:
        "absolute top-20 left-1/2 -translate-x-1/2 px-4 z-50 transition-opacity duration-1000 ease-in-out",
      data: {
        controller: "error"
      }
    ) { render_error if @message || @details }
  end
end