matestack-ui-bootstrap 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +17 -5
  3. data/lib/matestack/ui/bootstrap.rb +96 -17
  4. data/{app/concepts → lib}/matestack/ui/bootstrap/apps/admin_template.rb +14 -7
  5. data/lib/matestack/ui/bootstrap/base_component.rb +13 -0
  6. data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +13 -0
  7. data/{app/concepts → lib}/matestack/ui/bootstrap/components/accordion.rb +18 -16
  8. data/{app/concepts → lib}/matestack/ui/bootstrap/components/alert.js +12 -9
  9. data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
  10. data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
  11. data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
  12. data/{app/concepts → lib}/matestack/ui/bootstrap/components/breadcrumb.rb +12 -10
  13. data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
  14. data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
  15. data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
  16. data/{app/concepts → lib}/matestack/ui/bootstrap/components/carousel.js +21 -18
  17. data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
  18. data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
  19. data/{app/concepts → lib}/matestack/ui/bootstrap/components/collapse.js +20 -17
  20. data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
  21. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.js +5 -2
  22. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +29 -25
  23. data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
  24. data/{app/concepts → lib}/matestack/ui/bootstrap/components/list_group.rb +32 -29
  25. data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +24 -21
  26. data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
  27. data/{app/concepts → lib}/matestack/ui/bootstrap/components/navbar.rb +37 -28
  28. data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
  29. data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +11 -9
  30. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.js +4 -1
  31. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +25 -21
  32. data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +19 -19
  33. data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
  34. data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
  35. data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
  36. data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
  37. data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
  38. data/{app/concepts → lib}/matestack/ui/bootstrap/components/toast.js +22 -19
  39. data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
  40. data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +4 -1
  41. data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.rb +20 -18
  42. data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
  43. data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.rb +22 -16
  44. data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.scss +0 -0
  45. data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/content.rb +23 -19
  46. data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/filter.rb +6 -2
  47. data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/paginate.rb +16 -11
  48. data/lib/matestack/ui/bootstrap/form/checkbox.rb +81 -0
  49. data/lib/matestack/ui/bootstrap/form/input.rb +116 -0
  50. data/lib/matestack/ui/bootstrap/form/radio.rb +55 -0
  51. data/lib/matestack/ui/bootstrap/form/select.rb +63 -0
  52. data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
  53. data/lib/matestack/ui/bootstrap/form/switch.rb +32 -0
  54. data/lib/matestack/ui/bootstrap/index.js +24 -0
  55. data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
  56. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
  57. data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
  58. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +5 -2
  59. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.rb +10 -10
  60. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
  61. data/lib/matestack/ui/bootstrap/registry.rb +169 -0
  62. data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
  63. data/lib/matestack/ui/bootstrap/version.rb +1 -1
  64. metadata +67 -72
  65. data/app/assets/images/avatar-placeholder.png +0 -0
  66. data/app/assets/images/icons/bootstrap-icons.svg +0 -1
  67. data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
  68. data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
  69. data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
  70. data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -69
  71. data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
  72. data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
  73. data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -86
  74. data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
  75. data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
  76. data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
  77. data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -48
  78. data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
  79. data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
  80. data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -83
  81. data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
  82. data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
  83. data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -99
  84. data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -112
  85. data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -57
  86. data/app/concepts/matestack/ui/bootstrap/form/select.rb +0 -53
  87. data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -21
  88. data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -99
  89. data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
  90. data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
  91. data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
  92. data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -61
  93. data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -17
  94. data/app/javascript/matestack-ui-bootstrap/index.js +0 -24
  95. data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
  96. data/app/matestack/bootstrap/form/submit.rb +0 -20
  97. data/config/routes.rb +0 -2
  98. data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,27 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Avatar < Matestack::Ui::Component
2
-
3
- optional :text, :bg_variant, :text_variant, :img_path, :size, class: { as: :bs_class }
4
-
5
- def response
6
- if text.present? && img_path.nil?
7
- div class: "rounded-circle bg-#{bg_variant || 'primary'} text-#{text_variant || 'white'} text-center p-2 #{bs_class}",
8
- attributes: { style: "height: #{height}px; width: #{width}px; display: inline-block;"} do
9
- plain text
10
- end
11
- else
12
- div class: "rounded-circle text-#{text_variant || 'white'} text-center p-2 #{bs_class}",
13
- attributes: { style: "height: #{height}px; width: #{width}px; display: inline-block; background-image: url(#{img_path}); background-size: contain;"} do
14
- plain text
15
- end
16
- end
17
- end
18
-
19
- def height
20
- size || 40
21
- end
22
-
23
- def width
24
- size || 40
25
- end
26
-
27
- end
@@ -1,30 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Badge < Matestack::Ui::Component
2
-
3
- optional class: { as: :bs_class }
4
- optional :text, :variant, :rounded, :visually_hidden
5
-
6
- def response
7
- span badge_attributes do
8
- plain text if text
9
- yield_components
10
- end
11
- span class: "visually-hidden", text: visually_hidden if visually_hidden.present?
12
- end
13
-
14
- protected
15
-
16
- def badge_attributes
17
- html_attributes.merge(
18
- class: badge_classes
19
- )
20
- end
21
-
22
- def badge_classes
23
- [].tap do |classes|
24
- classes << 'badge'
25
- classes << (variant.present? ? "bg-#{variant}" : "bg-secondary")
26
- classes << "rounded-pill" if rounded
27
- classes << bs_class
28
- end.join(' ').strip
29
- end
30
- end
@@ -1,69 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Button < Matestack::Ui::Component
2
-
3
- optional :text, :type, :variant, :size, :outline
4
- optional attributes: { as: :bs_attrs }, class: { as: :bs_class }
5
- optional transition: { as: :bs_btn_transition }
6
- optional action: { as: :bs_btn_action }
7
- optional onclick: { as: :bs_btn_onclick }
8
- optional link: { as: :bs_btn_link }
9
-
10
- def response
11
- if bs_btn_transition.present? && bs_btn_transition.is_a?(Hash)
12
- transition button_attributes.merge(bs_btn_transition.merge({attributes: { role: "button"} })) do
13
- inner_response
14
- end
15
- elsif bs_btn_action.present? && bs_btn_action.is_a?(Hash)
16
- action button_attributes.merge(bs_btn_action.merge({attributes: { role: "button"} })) do
17
- inner_response
18
- end
19
- elsif bs_btn_onclick.present? && bs_btn_onclick.is_a?(Hash)
20
- onclick button_attributes.merge(bs_btn_onclick.merge({attributes: { role: "button"} })) do
21
- inner_response
22
- end
23
- elsif bs_btn_link.present? && bs_btn_link.is_a?(Hash)
24
- link button_attributes.merge(bs_btn_link.merge({attributes: { role: "button"} })) do
25
- inner_response
26
- end
27
- else
28
- button_response
29
- end
30
- end
31
-
32
- def button_response
33
- button button_attributes do
34
- inner_response
35
- end
36
- end
37
-
38
- def inner_response
39
- plain text if text
40
- yield_components
41
- end
42
-
43
- protected
44
-
45
- def button_attributes
46
- html_attributes.merge(
47
- type: type || 'button',
48
- class: button_classes,
49
- attributes: bs_attrs
50
- )
51
- end
52
-
53
- def button_classes
54
- [].tap do |classes|
55
- classes << 'btn'
56
- # btn variants outlined or solid background
57
- if outline
58
- classes << "btn-outline-#{variant.to_s.gsub('_', '-') || 'primary'}"
59
- else
60
- classes << (variant ? "btn-#{variant.to_s.gsub('_', '-')}" : 'btn-primary')
61
- end
62
- # btn size
63
- classes << "btn-#{size}" if size
64
- # custom classes
65
- classes << bs_class
66
- end.join(' ').strip
67
- end
68
-
69
- end
@@ -1,36 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::ButtonGroup < Matestack::Ui::Component
2
-
3
- optional class: { as: :bs_class }
4
- optional label: { as: :bs_label }
5
- optional :toolbar, :size, :vertical
6
-
7
- def response
8
- div buttongroup_attributes do
9
- yield_components
10
- end
11
- end
12
-
13
- protected
14
-
15
- def buttongroup_attributes
16
- attributes = {}.tap do |hash|
17
- hash[:class] = buttongroup_classes
18
- hash[:attributes] = {
19
- role: "#{toolbar ? :toolbar : :group}",
20
- 'aria-label': bs_label
21
- }
22
- end
23
- html_attributes.merge(
24
- attributes
25
- )
26
- end
27
-
28
- def buttongroup_classes
29
- [].tap do |classes|
30
- classes << ("btn-#{toolbar ? :toolbar : :group}#{'-vertical' if vertical}")
31
- classes << "btn-group-#{size}" if size.present?
32
- classes << bs_class
33
- end.join(' ').strip
34
- end
35
-
36
- end
@@ -1,100 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Card < Matestack::Ui::Component
2
-
3
- optional class: { as: :bs_class }
4
-
5
- # header attributes, expects a hash or string
6
- # possible keys `:class, :text`
7
- optional :header
8
- # footer attributes, expects a hash or string
9
- # possible keys `:class, :text`
10
- optional :footer
11
-
12
- optional :title, :body, :subtitle # body attributes
13
- optional :img_path, :img_pos, :alt_text # image attributes
14
-
15
- optional :content_wrapper_class # class for content wrapper -> useful for content padding without affecting top image
16
-
17
- optional :slots # passed in slots for card header or footer
18
-
19
- def response
20
- div card_attributes do
21
- if header || slots && slots[:header]
22
- header_partial
23
- end
24
-
25
- img_partial :top unless img_pos == :bottom
26
- div class: content_wrapper_class do
27
- body_partial if title || body || slots && slots[:body]
28
-
29
- # custom body components
30
- # needed a div otherwise it will be displayed below footer
31
- div class: "p-3 pt-1" do yield_components end
32
-
33
- img_partial :bottom if img_pos == :bottom
34
-
35
- footer_partial if footer || slots && slots[:footer]
36
- end
37
- end
38
- end
39
-
40
- protected
41
-
42
- def header_partial
43
- header = self.header.is_a?(Hash) ? self.header : { text: self.header }
44
- div class: "card-header #{header[:class]}" do
45
- plain header[:text] if header[:text].present?
46
- slot slots[:header] if slots && slots[:header]
47
- end
48
- end
49
-
50
- def body_partial
51
- div class: "card-body" do
52
- # title
53
- card_title(title, "card-title")
54
- # subtitle
55
- card_title(subtitle, 6, "card-subtitle text-muted")
56
- # body
57
- if body.is_a? Hash
58
- paragraph class: "card-text #{body[:class]}", text: body[:text]
59
- elsif body
60
- paragraph class: "card-text", text: body
61
- end
62
- slot slots[:body] if slots && slots[:body]
63
- end
64
- end
65
-
66
- def footer_partial
67
- footer = self.footer.is_a?(Hash) ? self.footer : { text: self.footer }
68
- div class: "card-footer #{footer[:class]}" do
69
- plain footer[:text] if footer[:text].present?
70
- slot slots[:footer] if slots && slots[:footer]
71
- end
72
- end
73
-
74
- def img_partial pos
75
- img class: "card-img-#{pos}", path: img_path, alt: alt_text if img_path.present?
76
- end
77
-
78
- def card_attributes
79
- html_attributes.except(:title).merge(
80
- class: card_classes
81
- )
82
- end
83
-
84
- def card_classes
85
- [].tap do |classes|
86
- classes << 'card'
87
- classes << bs_class
88
- end.join(' ').strip
89
- end
90
-
91
- def card_title(options, default_size = 5, title_class)
92
- if options.is_a? Hash
93
- heading size: (options[:size] || default_size), class: "#{options[:class]} #{title_class}",
94
- text: options[:text]
95
- elsif options
96
- heading size: default_size, class: title_class, text: options
97
- end
98
- end
99
-
100
- end
@@ -1,86 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Carousel < Matestack::Ui::VueJsComponent
2
- vue_js_component_name "matestack-ui-bootstrap-carousel"
3
-
4
- optional :start, :controls, :indicators, :fade, :interval, :variant
5
- optional :items, class: { as: :bs_class }
6
- # possible keys for items: path, title, text, interval
7
- # event trigger
8
- optional :cycle_on, :pause_on, :prev_on, :next_on
9
-
10
- def setup
11
- @component_config["carousel-id"] = carousel_id
12
- end
13
-
14
- def response
15
- div carousel_attributes do
16
- # carousel indicator
17
- indicator_partial if indicators.present?
18
- # carousel content
19
- div class: "carousel-inner" do
20
- yield_components
21
- carousel_partial if items
22
- end
23
- controls_partial if controls
24
- end
25
- end
26
-
27
- protected
28
-
29
- def indicator_partial
30
- ol class: "carousel-indicators" do
31
- items.size.times do |index|
32
- li data: { "bs-target": "##{carousel_id}", 'bs-slide-to': index },
33
- class: "#{'active' if index == (start || 0) }"
34
- end
35
- end
36
- end
37
-
38
- def carousel_partial
39
- items.each_with_index do |item, index|
40
- div class: "carousel-item #{'active' if index == (start || 0) } #{item[:class]}".strip,
41
- data: { "bs-interval": item[:interval] } do
42
- img class: "d-block w-100", path: item[:path]
43
- if item[:title] || item[:text]
44
- div class: "carousel-caption d-none d-md-block #{item[:title_class]}" do
45
- heading size: 5, text: item[:title]
46
- paragraph text: item[:text]
47
- end
48
- end
49
- end
50
- end
51
- end
52
-
53
- def controls_partial
54
- link class: "carousel-control-prev", data: { "bs-target": "##{carousel_id}", "bs-slide": :prev }, attributes: { 'role': "button" } do
55
- span class: "carousel-control-prev-icon", attributes: { 'aria-hidden': "true" }
56
- span class: "visually-hidden", text: "Previous"
57
- end
58
- link class: "carousel-control-next", data: { "bs-target": "##{carousel_id}", "bs-slide": :next }, attributes: { 'role': "button" } do
59
- span class: "carousel-control-next-icon", attributes: { 'aria-hidden': "true" }
60
- span class: "visually-hidden", text: "Next"
61
- end
62
- end
63
-
64
- def carousel_attributes
65
- html_attributes.merge(
66
- id: carousel_id,
67
- class: carousel_classes,
68
- data: { "bs-ride": 'carousel', "bs-interval": (interval || 5000) }
69
- )
70
- end
71
-
72
- def carousel_classes
73
- [].tap do |classes|
74
- classes << 'carousel slide'
75
- classes << 'carousel-fade' if fade
76
- classes << 'carousel-dark' if variant == :dark
77
- #custom classes
78
- classes << bs_class
79
- end.join(' ').strip
80
- end
81
-
82
- def carousel_id
83
- @carousel_id ||= "matestack-carousel-#{SecureRandom.hex}"
84
- end
85
-
86
- end
@@ -1,43 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Collapse < Matestack::Ui::VueJsComponent
2
- vue_js_component_name "matestack-ui-bootstrap-collapse"
3
-
4
- optional :multi, :labelledby, :parent, class: { as: :bs_class }
5
- optional :card # possible keys: class, text
6
- # event trigger
7
- optional :toggle_on, :show_on, :hide_on, :dispose_on
8
-
9
- def response
10
- div collapse_attributes do
11
- card_partial if card
12
- yield_components
13
- end
14
- end
15
-
16
- protected
17
-
18
- def card_partial
19
- tmp_card = card.is_a?(Hash) ? self.card : { text: self.card }
20
- div class: "card card-body #{tmp_card[:class]}".strip do
21
- plain tmp_card[:text]
22
- end
23
- end
24
-
25
- def collapse_attributes
26
- html_attributes.merge(
27
- class: collapse_classes,
28
- data: { "bs-parent": parent },
29
- attributes: { 'aria-labelledby': "#{labelledby}" }
30
- )
31
- end
32
-
33
- def collapse_classes
34
- [].tap do |classes|
35
- classes << 'collapse'
36
- # mulit target
37
- classes << 'multi-collapse' if multi
38
- #custom classes
39
- classes << bs_class
40
- end.join(' ').strip
41
- end
42
-
43
- end
@@ -1,19 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Icon < Matestack::Ui::Component
2
-
3
- requires :name
4
- optional :size
5
- optional class: { as: :bs_class }
6
-
7
- def response
8
- plain " <svg class='bi #{bs_class}' width='#{get_size}' height='#{get_size}' fill='currentColor'>
9
- <use xlink:href='#{image_url("icons/bootstrap-icons.svg")}##{name}'/>
10
- </svg>".html_safe
11
- end
12
-
13
- def get_size
14
- size || 20
15
- end
16
-
17
-
18
-
19
- end
@@ -1,106 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Modal < Matestack::Ui::VueJsComponent
2
- vue_js_component_name 'matestack-ui-bootstrap-modal'
3
-
4
- # header attributes, expects a hash or string
5
- # possible keys `:class, :text, :size`
6
- optional :header
7
- # body attributes, expects a hash or string
8
- # possible keys `:class, :text`
9
- optional :body
10
- # footer is a dismiss button, expects a hash or string for button text
11
- # possible keys `:class, :text`
12
- optional :footer
13
- optional :fade, :size
14
- optional :fullscreen # fullscreen attribute, expects boolean or bootstrap breakpoint
15
- optional :static, :keyboard, :scrollable, :centered
16
- optional :modal_dialog_class, class: { as: :bs_class }, id: { as: :bs_id }
17
- # event trigger
18
- optional :toggle_on, :show_on, :hide_on, :handle_update_on, :dispose_on
19
-
20
- optional :slots
21
-
22
- def response
23
- div modal_attributes do
24
- div class: dialog_classes do
25
- div class: "modal-content" do
26
- header_partial if header || (slots && slots[:header])
27
- body_partial if body || slots && slots[:body]
28
- footer_partial if footer || (slots && slots[:footer])
29
- yield_components
30
- end
31
- end
32
- end
33
- end
34
-
35
- protected
36
-
37
- def header_partial
38
- header = self.header.is_a?(Hash) ? self.header : { text: self.header }
39
- div class: "modal-header" do
40
- if slots && slots[:header]
41
- slot slots[:header]
42
- else
43
- heading size: (header[:size] || 5), class: "modal-title #{header[:class]}", text: header[:text] if header[:text].present?
44
- bs_close dismiss: 'modal'
45
- end
46
- end
47
- end
48
-
49
- def body_partial
50
- body = self.body.is_a?(Hash) ? self.body : { text: self.body }
51
- div class: "modal-body #{body[:class]}".strip do
52
- if slots && slots[:body]
53
- slot slots[:body]
54
- else
55
- plain body[:text] if body[:text].present?
56
- end
57
- end
58
- end
59
-
60
- def footer_partial
61
- footer = self.footer.is_a?(Hash) ? self.footer : { text: self.footer }
62
- div class: "modal-footer" do
63
- slot slots[:footer] if slots && slots[:footer]
64
- if footer[:text].present?
65
- button class: "btn #{footer[:class].present? ? footer[:class] : 'btn-secondary'}",
66
- data: { "bs-dismiss": 'modal' }, attributes: { type: 'button' },
67
- text: footer[:text]
68
- end
69
- end
70
- end
71
-
72
- def modal_attributes
73
- attributes = {}.tap do |hash|
74
- hash[:class] = modal_classes
75
- hash[:attributes] = { 'tabindex': "-1", 'aria-labelledby': "#{bs_id}Label", 'aria-hidden': "true" }
76
- hash[:data] = {}.tap do |data|
77
- data[:backdrop] = "static" if static
78
- data[:keyboard] = "false" if keyboard
79
- end
80
- end
81
- html_attributes.merge(
82
- attributes
83
- )
84
- end
85
-
86
- def modal_classes
87
- [].tap do |classes|
88
- classes << 'modal'
89
- classes << 'fade' if fade || !fade.present?
90
- classes << bs_class
91
- end.join(' ').strip
92
- end
93
-
94
- def dialog_classes
95
- [].tap do |classes|
96
- classes << 'modal-dialog'
97
- classes << 'modal-dialog-centered' if centered
98
- classes << 'modal-dialog-scrollable' if scrollable
99
- classes << "modal-#{size}" if size
100
- if fullscreen.present?
101
- classes << (fullscreen == true ? 'modal-fullscreen' : "modal-fullscreen-#{fullscreen}-down")
102
- end
103
- classes << modal_dialog_class
104
- end.join(' ').strip
105
- end
106
- end