Module: Bootstrap5Helper
- Defined in:
- lib/bootstrap5_helper.rb,
lib/bootstrap5_helper/nav.rb,
lib/bootstrap5_helper/tab.rb,
lib/bootstrap5_helper/card.rb,
lib/bootstrap5_helper/alert.rb,
lib/bootstrap5_helper/badge.rb,
lib/bootstrap5_helper/modal.rb,
lib/bootstrap5_helper/toast.rb,
lib/bootstrap5_helper/dropup.rb,
lib/bootstrap5_helper/callout.rb,
lib/bootstrap5_helper/dropend.rb,
lib/bootstrap5_helper/overlay.rb,
lib/bootstrap5_helper/railtie.rb,
lib/bootstrap5_helper/spinner.rb,
lib/bootstrap5_helper/version.rb,
lib/bootstrap5_helper/dropdown.rb,
lib/bootstrap5_helper/accordion.rb,
lib/bootstrap5_helper/component.rb,
lib/bootstrap5_helper/constants.rb,
lib/bootstrap5_helper/dropstart.rb,
lib/bootstrap5_helper/offcanvas.rb,
lib/bootstrap5_helper/initialize.rb,
lib/bootstrap5_helper/input_group.rb,
lib/bootstrap5_helper/page_header.rb,
lib/bootstrap5_helper/tab/content.rb,
lib/bootstrap5_helper/overlay/menu.rb,
lib/bootstrap5_helper/configuration.rb,
lib/bootstrap5_helper/accordion/item.rb,
lib/bootstrap5_helper/card_with_nav_tab.rb,
lib/bootstrap5_helper/offcanvas/content.rb
Overview
:nodoc:
Defined Under Namespace
Classes: Accordion, Alert, Badge, Callout, Card, CardWithNavTab, Component, Configuration, Constants, Dropdown, Dropend, Dropstart, Dropup, InputGroup, Modal, Nav, Offcanvas, Overlay, PageHeader, Railtie, Spinner, Tab, Toast
Constant Summary collapse
- VERSION =
'1.1.3'.freeze
Class Method Summary collapse
-
.config {|@_bs5h_config| ... } ⇒ Bootstrap5Helper::Configuration
Simple interface for exposing the configuration object.
Instance Method Summary collapse
-
#accordion_helper(opts = {}) {|Accordion| ... } ⇒ Accordion
Creates a single Accordion element.
-
#alert_helper(*args, &block) ⇒ Alert
Creates an Alert component.
-
#badge_helper(*args, &block) ⇒ Badge
Creates a badge component.
- #callout_helper(*args, &block) ⇒ Object
-
#card_helper(opts = {}) {|Card| ... } ⇒ Card
Creates a Card component.
- #card_with_nav_tab_helper(*args) {|CardWithNavTab| ... } ⇒ CardWithNavTab
-
#dropdown_helper(*args) {|Dropdown| ... } ⇒ Dropdown
Generates a Dropdown component.
-
#dropend_helper(*args) {|Dropend| ... } ⇒ Dropend
Generates a Dropend component.
-
#dropstart_helper(*args) {|Dropstart| ... } ⇒ Dropstart
Generates a Dropstart component.
-
#dropup_helper(*args) {|Dropdup| ... } ⇒ Dropup
Generates a Dropup component.
-
#input_group_helper(*args, &block) ⇒ InputGroup
Generates a input group component.
-
#modal_helper(opts = {}) {|Modal| ... } ⇒ Modal
Generates Modal windows.
-
#nav_helper(*args) {|Nav| ... } ⇒ Nav
Generates Nav components.
-
#offcanvas_helper(*args) {|Offcanvas| ... } ⇒ Offcanvas
Generates a Offcanvas component.
-
#page_header_helper(*args, &block) ⇒ PageHeader
Generates a page header, similiar to bootstrap 3.
-
#spinner_helper(opts = {}, &block) ⇒ Spinner
Generates spinner annimations.
-
#tab_helper(*args) {|Tab| ... } ⇒ Tab
Generates a Tab component.
Class Method Details
.config {|@_bs5h_config| ... } ⇒ Bootstrap5Helper::Configuration
Simple interface for exposing the configuration object.
13 14 15 16 17 |
# File 'lib/bootstrap5_helper/initialize.rb', line 13 def config yield @_bs5h_config if block_given? @_bs5h_config end |
Instance Method Details
#accordion_helper(opts = {}) {|Accordion| ... } ⇒ Accordion
Creates a single Accordion element.
40 41 42 |
# File 'lib/bootstrap5_helper.rb', line 40 def accordion_helper(opts = {}, &block) Accordion.new(self, opts, &block) end |
#alert_helper(context, opts) ⇒ Alert #alert_helper(opts) ⇒ Alert
Creates an Alert component.
68 69 70 |
# File 'lib/bootstrap5_helper.rb', line 68 def alert_helper(*args, &block) Alert.new(self, *args, &block) end |
#badge_helper(context, opts) ⇒ Badge #badge_helper(opts) ⇒ Badge
Creates a badge component. Badges have a context variable. Providing nothing will give you the ‘secondary` context.
100 101 102 |
# File 'lib/bootstrap5_helper.rb', line 100 def badge_helper(*args, &block) Badge.new(self, *args, &block) end |
#callout_helper(*args, &block) ⇒ Object
Internal helper, used with personal Bootstrap modifications.
107 108 109 |
# File 'lib/bootstrap5_helper.rb', line 107 def callout_helper(*args, &block) Callout.new(self, *args, &block) end |
#card_helper(opts = {}) {|Card| ... } ⇒ Card
Creates a Card component.
164 165 166 |
# File 'lib/bootstrap5_helper.rb', line 164 def card_helper(opts = {}, &block) Card.new(self, opts, &block) end |
#card_with_nav_tab_helper(context, opts) ⇒ CardWithNavTab #card_with_nav_tab_helper(opts) ⇒ CardWithNavTab
Internal helper, used with personal Bootstrap modifications.
186 187 188 |
# File 'lib/bootstrap5_helper.rb', line 186 def card_with_nav_tab_helper(*args, &block) CardWithNavTab.new(self, *args, &block) end |
#dropdown_helper(tag, opts) ⇒ Dropdown #dropdown_helper(opts) ⇒ Dropdown
Generates a Dropdown component.
255 256 257 |
# File 'lib/bootstrap5_helper.rb', line 255 def dropdown_helper(*args, &block) Dropdown.new(self, *args, &block) end |
#dropend_helper(tag, opts) ⇒ Dropend #dropend_helper(opts) ⇒ Dropend
Generates a Dropend component.
327 328 329 |
# File 'lib/bootstrap5_helper.rb', line 327 def dropend_helper(*args, &block) Dropend.new(self, *args, &block) end |
#dropstart_helper(tag, opts) ⇒ Dropstart #dropstart_helper(opts) ⇒ Dropstart
Generates a Dropstart component.
303 304 305 |
# File 'lib/bootstrap5_helper.rb', line 303 def dropstart_helper(*args, &block) Dropstart.new(self, *args, &block) end |
#dropup_helper(tag, opts) ⇒ Dropup #dropup_helper(opts) ⇒ Dropup
Generates a Dropup component.
279 280 281 |
# File 'lib/bootstrap5_helper.rb', line 279 def dropup_helper(*args, &block) Dropup.new(self, *args, &block) end |
#input_group_helper(context, options) ⇒ InputGroup #input_group_helper(opts) ⇒ InputGroup
Generates a input group component.
540 541 542 |
# File 'lib/bootstrap5_helper.rb', line 540 def input_group_helper(*args, &block) InputGroup.new(self, *args, &block) end |
#modal_helper(opts = {}) {|Modal| ... } ⇒ Modal
Generates Modal windows.
366 367 368 |
# File 'lib/bootstrap5_helper.rb', line 366 def modal_helper(opts = {}, &block) Modal.new(self, opts, &block) end |
#nav_helper(tag, opts) ⇒ Nav #nav_helper(opts) ⇒ Nav
Generates Nav components.
408 409 410 |
# File 'lib/bootstrap5_helper.rb', line 408 def nav_helper(*args, &block) Nav.new(self, *args, &block) end |
#offcanvas_helper(position, options) ⇒ Offcanvas #offcanvas_helper(options) ⇒ Offcanvas
Generates a Offcanvas component.
@example:
```erb
<%= offcanvas_helper :top, id: 'off_canvas_example1' do |off| %>
<%= off.button 'Open sidebar', class: 'btn btn-primary' %>
<%= off.content do |c| %>
<%= c.header do %>
<%= c.title { 'Sidebar content' } %>
<%= c.close_button %>
<% end %>
<%= c.body do %>
<p>Some content in the sidebar!</p>
<% end %>
<% end %>
<% end %>
```
@example:
```erb
<%= offcanvas_helper scrollable: true, id: 'off_canvas_example2' do |off| %>
<%= off.link class: 'btn btn-danger' do %>
<strong>*</strong> Open sidebar 2
<% end %>
<%= off.content do |c| %>
<%= c.header do %>
<%= c.title { 'Sidebar content 2' } %>
<%= c.close_button class: 'btn btn-info' do %>
Close
<% end %>
<% end %>
<%= c.body do %>
<p>Some content in the sidebar 2!</p>
<% end %>
<% end %>
<% end %>
```
473 474 475 |
# File 'lib/bootstrap5_helper.rb', line 473 def offcanvas_helper(*args, &block) Offcanvas.new(self, *args, &block) end |
#page_header_helper(tag, opts) ⇒ PageHeader #page_header_helper(opts) ⇒ PageHeader
Generates a page header, similiar to bootstrap 3
501 502 503 |
# File 'lib/bootstrap5_helper.rb', line 501 def page_header_helper(*args, &block) PageHeader.new(self, *args, &block) end |