Sha256: d002bc312d3377775b4b0443b4feec9710ce2418a048c71e4d135e48a9d71844

Contents?: true

Size: 678 Bytes

Versions: 4

Compression:

Stored size: 678 Bytes

Contents

module PgEngine
  module FlashHelper
    def render_turbo_stream_flash_messages
      turbo_stream.prepend 'flash', partial: 'layouts/flash'
    end

    def render_turbo_stream_title
      # rubocop:disable Rails/SkipsModelValidations
      turbo_stream.update_all 'title', "#{breadcrumbs.last&.name} - #{Rails.application.class.module_parent_name}"
      # rubocop:enable Rails/SkipsModelValidations
    end

    def flash_type_to_class(flash_type)
      case flash_type
      when 'notice'
        'info'
      when 'error'
        'danger'
      when 'alert'
        'warning'
      when 'success'
        'success'
      else
        flash_type
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pg_rails-7.0.6 pg_engine/app/helpers/pg_engine/flash_helper.rb
pg_rails-7.0.5 pg_engine/app/helpers/pg_engine/flash_helper.rb
pg_rails-7.0.4 pg_engine/app/helpers/pg_engine/flash_helper.rb
pg_rails-7.0.3 pg_engine/app/helpers/pg_engine/flash_helper.rb