Sha256: 3837ccc17cfdfcb9f7ca59d66050ebdc152d503b74bedf046e3d476517dff6de
Contents?: true
Size: 679 Bytes
Versions: 8
Compression:
Stored size: 679 Bytes
Contents
# frozen_string_literal: true module Blacklight module System class FlashMessageComponent < ViewComponent::Base renders_one :message with_collection_parameter :message def initialize(message: nil, type:) @message = message @classes = alert_class(type) end def before_render with_message { @message } if @message end def alert_class(type) case type.to_s when 'success' then "alert-success" when 'notice' then "alert-info" when 'alert' then "alert-warning" when 'error' then "alert-danger" else "alert-#{type}" end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems