Module: BetterUi::General::Components::Panel::PanelHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/better_ui/general/components/panel/panel_helper.rb

Instance Method Summary collapse

Instance Method Details

#bui_panel(title: nil, body: nil, header: nil, footer: nil, theme: :white, style: :default, padding: :medium, radius: :small, **html_options, &block) ⇒ String

Genera un pannello usando BetterUi::General::Panel::Component

Examples:

Uso base

bui_panel(title: "Dashboard")
bui_panel(body: "Contenuto del pannello")

Pannello completo

bui_panel(
  title: "Impostazioni",
  body: "Configura le tue preferenze",
  footer: "Ultimo aggiornamento: oggi",
  theme: :blue
)

Con header personalizzato

bui_panel(
  header: "<h2>Header Custom</h2>",
  body: "Il mio contenuto",
  theme: :green,
  style: :raised
)

Pannello con stili avanzati

bui_panel(
  title: "Card Premium",
  body: "Contenuto speciale",
  theme: :violet,
  style: :bordered,
  padding: :large,
  radius: :large,
  id: "premium-panel",
  class: "special-panel"
)

Con contenuto block

bui_panel(title: "Lista Utenti", theme: :white) do
  "<ul><li>Utente 1</li><li>Utente 2</li></ul>".html_safe
end

Parameters:

  • title (String) (defaults to: nil)

    titolo del pannello (opzionale)

  • body (String) (defaults to: nil)

    contenuto HTML del pannello (opzionale)

  • header (String) (defaults to: nil)

    header personalizzato (opzionale)

  • footer (String) (defaults to: nil)

    footer del pannello (opzionale)

  • theme (Symbol) (defaults to: :white)

    tema del colore (:default, :white, etc.)

  • style (Symbol) (defaults to: :default)

    stile (:default, :flat, :raised, :bordered)

  • padding (Symbol) (defaults to: :medium)

    padding interno (:none, :small, :medium, :large)

  • radius (Symbol) (defaults to: :small)

    raggio dei bordi (:none, :small, :medium, :large, :full)

  • html_options (Hash)

    opzioni HTML aggiuntive

Returns:

  • (String)

    HTML del pannello renderizzato



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'app/helpers/better_ui/general/components/panel/panel_helper.rb', line 55

def bui_panel(
  title: nil,
  body: nil,
  header: nil,
  footer: nil,
  theme: :white,
  style: :default,
  padding: :medium,
  radius: :small,
  **html_options,
  &block
)
  render BetterUi::General::Panel::Component.new(
    title: title,
    body: body,
    header: header,
    footer: footer,
    theme: theme,
    style: style,
    padding: padding,
    radius: radius,
    **html_options
  ), &block
end