Module: BulmaPhlex::Rails::CardHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/bulma_phlex/rails/card_helper.rb

Overview

# Card Helper

This module provides method ‘turbo_frame_content` to create a card with a turbo frame as its content.

Instance Method Summary collapse

Instance Method Details

#turbo_frame_content(*ids, src: nil, target: nil, **attributes) ⇒ Object

Renders a Bulma-styled card with a Turbo Frame as its content. This uses the same signatures as ‘turbo_frame_tag`, with the addition of two optional attributes: `pending_message` and `pending_icon`.

The two pending attributes have the following defaults:

  • pending_message: “Loading…”

  • pending_icon: “fas fa-spinner fa-pulse”



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bulma_phlex/rails/card_helper.rb', line 21

def turbo_frame_content(*ids, src: nil, target: nil, **attributes)
  pending_message = attributes.delete(:pending_message) || "Loading..."
  pending_icon = attributes.delete(:pending_icon) || "fas fa-spinner fa-pulse"

  content do
    turbo_frame_tag ids, src: src, target: target, **attributes do
      span(class: "icon") { i class: pending_icon }
      span { plain pending_message }
    end
  end
end