matestack-ui-bootstrap 1.4.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +17 -5
  3. data/README.md +53 -19
  4. data/lib/matestack/ui/bootstrap.rb +97 -17
  5. data/{app/concepts → lib}/matestack/ui/bootstrap/apps/admin_template.rb +14 -7
  6. data/lib/matestack/ui/bootstrap/base_component.rb +13 -0
  7. data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +13 -0
  8. data/lib/matestack/ui/bootstrap/components/accordion.rb +58 -0
  9. data/{app/concepts → lib}/matestack/ui/bootstrap/components/alert.js +12 -9
  10. data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
  11. data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
  12. data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
  13. data/lib/matestack/ui/bootstrap/components/breadcrumb.rb +50 -0
  14. data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
  15. data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
  16. data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
  17. data/{app/concepts → lib}/matestack/ui/bootstrap/components/carousel.js +21 -18
  18. data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
  19. data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
  20. data/{app/concepts → lib}/matestack/ui/bootstrap/components/collapse.js +20 -17
  21. data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
  22. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.js +5 -2
  23. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +31 -26
  24. data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
  25. data/lib/matestack/ui/bootstrap/components/list_group.rb +148 -0
  26. data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +24 -21
  27. data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
  28. data/lib/matestack/ui/bootstrap/components/navbar.rb +163 -0
  29. data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
  30. data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +15 -13
  31. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.js +4 -1
  32. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +26 -22
  33. data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +24 -24
  34. data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
  35. data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
  36. data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
  37. data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
  38. data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
  39. data/{app/concepts → lib}/matestack/ui/bootstrap/components/toast.js +27 -18
  40. data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
  41. data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +4 -1
  42. data/lib/matestack/ui/bootstrap/components/tooltip.rb +66 -0
  43. data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
  44. data/lib/matestack/ui/bootstrap/content/smart_collection/collection.rb +120 -0
  45. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/collection.scss +0 -0
  46. data/lib/matestack/ui/bootstrap/content/smart_collection/content.rb +118 -0
  47. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/filter.rb +7 -3
  48. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/paginate.rb +19 -14
  49. data/lib/matestack/ui/bootstrap/form/checkbox.rb +90 -0
  50. data/lib/matestack/ui/bootstrap/form/input.rb +118 -0
  51. data/lib/matestack/ui/bootstrap/form/radio.rb +57 -0
  52. data/lib/matestack/ui/bootstrap/form/select.rb +63 -0
  53. data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
  54. data/lib/matestack/ui/bootstrap/form/switch.rb +32 -0
  55. data/lib/matestack/ui/bootstrap/form/textarea.rb +49 -0
  56. data/lib/matestack/ui/bootstrap/index.js +24 -0
  57. data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
  58. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
  59. data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
  60. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +5 -2
  61. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.rb +10 -10
  62. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
  63. data/lib/matestack/ui/bootstrap/registry.rb +173 -0
  64. data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
  65. data/lib/matestack/ui/bootstrap/version.rb +1 -1
  66. data/lib/tasks/matestack/ui/bootstrap_tasks.rake +25 -25
  67. metadata +68 -76
  68. data/app/assets/images/avatar-placeholder.png +0 -0
  69. data/app/assets/images/icons/bootstrap-icons.svg +0 -1
  70. data/app/concepts/matestack/ui/bootstrap/components/accordion.rb +0 -53
  71. data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
  72. data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
  73. data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
  74. data/app/concepts/matestack/ui/bootstrap/components/breadcrumb.rb +0 -46
  75. data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -54
  76. data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
  77. data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
  78. data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -85
  79. data/app/concepts/matestack/ui/bootstrap/components/chart.js +0 -232
  80. data/app/concepts/matestack/ui/bootstrap/components/chart.rb +0 -71
  81. data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
  82. data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
  83. data/app/concepts/matestack/ui/bootstrap/components/list_group.rb +0 -83
  84. data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
  85. data/app/concepts/matestack/ui/bootstrap/components/navbar.rb +0 -120
  86. data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -33
  87. data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
  88. data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
  89. data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -81
  90. data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
  91. data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
  92. data/app/concepts/matestack/ui/bootstrap/components/tooltip.rb +0 -82
  93. data/app/concepts/matestack/ui/bootstrap/content/collection/collection.rb +0 -112
  94. data/app/concepts/matestack/ui/bootstrap/content/collection/content.rb +0 -101
  95. data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -90
  96. data/app/concepts/matestack/ui/bootstrap/form/date.js +0 -38
  97. data/app/concepts/matestack/ui/bootstrap/form/date.rb +0 -98
  98. data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -123
  99. data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -65
  100. data/app/concepts/matestack/ui/bootstrap/form/select.haml +0 -11
  101. data/app/concepts/matestack/ui/bootstrap/form/select.rb +0 -74
  102. data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -20
  103. data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -90
  104. data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
  105. data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
  106. data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
  107. data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -63
  108. data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -13
  109. data/app/javascript/matestack-ui-bootstrap/index.js +0 -26
  110. data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
  111. data/config/routes.rb +0 -2
  112. data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,4 +1,4 @@
1
- module Matestack::Ui::Bootstrap::Content::Collection::Filter
1
+ module Matestack::Ui::Bootstrap::Content::SmartCollection::Filter
2
2
 
3
3
  def filter_partial
4
4
  collection_filter collection.config do
@@ -18,15 +18,19 @@ module Matestack::Ui::Bootstrap::Content::Collection::Filter
18
18
 
19
19
  def filter_input(key, config)
20
20
  attributes = {
21
+ id: key,
21
22
  key: key,
22
23
  type: :text,
23
24
  placeholder: config[:placeholder] || key.to_s,
25
+ label: config[:label]
24
26
  }
25
27
  case config[:type]
26
28
  when :select
27
- collection_filter_select attributes.merge(class: 'form-select', options: config[:options])
29
+ bs_form_select attributes.merge(options: config[:options])
30
+ when :checkbox
31
+ bs_form_checkbox attributes.merge(options: config[:options])
28
32
  else
29
- collection_filter_input attributes.merge(class: 'form-control')
33
+ bs_form_input attributes.merge(class: 'smart-collection-filter')
30
34
  end
31
35
  end
32
36
 
@@ -1,11 +1,11 @@
1
- module Matestack::Ui::Bootstrap::Content::Collection::Paginate
1
+ module Matestack::Ui::Bootstrap::Content::SmartCollection::Paginate
2
2
 
3
3
  def paginate_partial
4
4
  div class: "current-pagination-state ps-2" do
5
5
  small do
6
- plain "showing #{@collection.from}"
7
- plain "to #{@collection.to}"
8
- plain "of #{@collection.filtered_count}"
6
+ plain "showing #{@collection.from} "
7
+ plain "to #{@collection.to} "
8
+ plain "of #{@collection.filtered_count} "
9
9
  if (@collection.base_count - @collection.filtered_count) > 0
10
10
  plain "(#{@collection.base_count - @collection.filtered_count} hidden by filter)"
11
11
  end
@@ -15,9 +15,9 @@ module Matestack::Ui::Bootstrap::Content::Collection::Paginate
15
15
  end
16
16
 
17
17
  def pagination_nav_partial
18
- nav class: "table-responsive", attributes: { style: "display: -webkit-box;" } do
18
+ nav class: "table-responsive", style: "display: -webkit-box;" do
19
19
  ul class: ul_classes do
20
- li class: "page-item #{ 'disabled' if current_page == 1 }" do
20
+ li class: "page-item previous #{ 'disabled' if current_page == 1 }" do
21
21
  collection_content_previous class: 'page-link' do
22
22
  bs_icon name: "chevron-left", size: 10
23
23
  end
@@ -30,7 +30,7 @@ module Matestack::Ui::Bootstrap::Content::Collection::Paginate
30
30
  end
31
31
  unless current_page == 6
32
32
  li class: "page-item disabled" do
33
- link class: 'page-link', path: "#" do
33
+ a class: 'page-link', path: "#" do
34
34
  plain "..."
35
35
  end
36
36
  end
@@ -48,7 +48,7 @@ module Matestack::Ui::Bootstrap::Content::Collection::Paginate
48
48
  if @collection.pages.count >= 9 && last_page-current_page > 4
49
49
  unless current_page == last_page-5
50
50
  li class: "page-item disabled" do
51
- link class: 'page-link', path: "#" do
51
+ a class: 'page-link', path: "#" do
52
52
  plain "..."
53
53
  end
54
54
  end
@@ -59,7 +59,7 @@ module Matestack::Ui::Bootstrap::Content::Collection::Paginate
59
59
  end
60
60
  end
61
61
  end
62
- li class: "page-item #{ 'disabled' if current_page == last_page }" do
62
+ li class: "page-item next #{ 'disabled' if current_page == last_page }" do
63
63
  collection_content_next class: 'page-link' do
64
64
  bs_icon name: "chevron-right", size: 10
65
65
  end
@@ -77,15 +77,20 @@ module Matestack::Ui::Bootstrap::Content::Collection::Paginate
77
77
  end
78
78
 
79
79
  def current_page
80
- current_offset = params["#{bs_id}-offset"].try(:to_i)
81
- (current_offset/paginate)+1 if current_offset && paginate.present?
80
+ current_offset = params["#{context.id}-offset"].try(:to_i)
81
+ if current_offset && context.paginate.present?
82
+ (current_offset/context.paginate)+1
83
+ elsif context.paginate.present?
84
+ 1
85
+ end
82
86
  end
87
+
83
88
 
84
89
  def last_page
85
- if @collection.filtered_count%paginate == 0
86
- (@collection.filtered_count/paginate)
90
+ if @collection.filtered_count%context.paginate == 0
91
+ (@collection.filtered_count/context.paginate)
87
92
  else
88
- (@collection.filtered_count/paginate)+1
93
+ (@collection.filtered_count/context.paginate)+1
89
94
  end
90
95
  end
91
96
 
@@ -0,0 +1,90 @@
1
+ class Matestack::Ui::Bootstrap::Form::Checkbox < Matestack::Ui::VueJs::Components::Form::Checkbox
2
+
3
+ include Matestack::Ui::Bootstrap::Registry
4
+
5
+ vue_name "matestack-ui-core-form-checkbox"
6
+
7
+ optional :form_text
8
+ optional :disabled
9
+ optional :variant
10
+
11
+ def response
12
+ div class: "matestack-ui-bootstrap-form-checkbox" do
13
+ label input_label, class: "form-label", ":for": id if input_label && multiple?
14
+ render_options
15
+ render_errors
16
+ render_form_text unless context.form_text.nil? # otherwise renders empty div
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def bootstrap_attributes
23
+ classes = 'form-check-input'
24
+ classes = [options[:class], classes].join(' ')
25
+ {
26
+ class: classes,
27
+ disabled: context.disabled
28
+ }
29
+ end
30
+
31
+ def multiple?
32
+ checkbox_options.present?
33
+ end
34
+
35
+ def render_options
36
+ # multiple
37
+ if multiple?
38
+ checkbox_options.to_a.each do |item|
39
+ checkbox_wrapper do
40
+ input options.merge(checkbox_attributes(item)).merge(bootstrap_attributes)
41
+ bootstrap_label text: item_label(item), for_input: item_id(item)
42
+ end
43
+ end
44
+ # checked/unchecked checkbox (true/false checkbox)
45
+ else
46
+ checkbox_wrapper do
47
+ input true_false_checkbox_attributes.merge(type: :hidden, id: nil, value: 0)
48
+ input true_false_checkbox_attributes.merge(type: :checkbox, ":id": item_id(1)).merge(bootstrap_attributes)
49
+
50
+ bootstrap_label text: input_label, for_input: item_id(1)
51
+ end
52
+ end
53
+ end
54
+
55
+ def checkbox_wrapper(options = {}, &block)
56
+ wrapper_attributes = (options[:attributes] || {}).merge({
57
+ class: "form-check #{'form-check-inline' if context.variant == :inline}"
58
+ })
59
+ div wrapper_attributes do
60
+ yield if block_given?
61
+ end
62
+ end
63
+
64
+ def bootstrap_label(text:, for_input:)
65
+ label text, ":for": for_input, class: 'form-check-label'
66
+ end
67
+
68
+ def render_errors
69
+ if display_errors?
70
+ div class: 'invalid-feedback', 'v-for': "error in #{error_key}", style: "display: block;" do
71
+ plain '{{ error }}'
72
+ end
73
+ end
74
+ end
75
+
76
+ def error_class
77
+ 'is-invalid'
78
+ end
79
+
80
+ def checkbox_options
81
+ super || {}
82
+ end
83
+
84
+ def render_form_text
85
+ div class: "form-text form-text-for-#{attribute_key}" do
86
+ plain context.form_text
87
+ end
88
+ end
89
+
90
+ end
@@ -0,0 +1,118 @@
1
+ class Matestack::Ui::Bootstrap::Form::Input < Matestack::Ui::VueJs::Components::Form::Input
2
+
3
+ include Matestack::Ui::Bootstrap::Registry
4
+
5
+ vue_name "matestack-ui-core-form-input"
6
+
7
+ optional :form_text
8
+ optional :disabled
9
+ optional :browse_button_text
10
+ optional :placeholder
11
+ optional :variant
12
+ optional :min
13
+ optional :max
14
+ optional :step
15
+ optional :show_value
16
+
17
+ def response
18
+ div class: "matestack-ui-bootstrap-input" do
19
+ label input_label, ":for": id, class: "form-label" if input_label
20
+ case context.type
21
+ when :range
22
+ input options.merge(input_attributes).merge(bootstrap_range_attributes)
23
+ if context.show_value
24
+ div class: "form-text form-text-for-#{attribute_key}" do
25
+ plain "{{ data['#{attribute_key}'] }}"
26
+ end
27
+ end
28
+ when :file
29
+ file_input
30
+ else
31
+ input options.merge(input_attributes).merge(bootstrap_input_attributes)
32
+ render_errors
33
+ end
34
+ render_form_text if context.form_text
35
+ end
36
+ end
37
+
38
+ def bootstrap_input_attributes
39
+ {
40
+ class: (options[:class] || "") << (" form-control"),
41
+ disabled: context.disabled,
42
+ min: context.min,
43
+ max: context.max,
44
+ step: context.step
45
+ }
46
+ end
47
+
48
+ def bootstrap_range_attributes
49
+ {
50
+ class: (options[:class] || "") << (" form-range"),
51
+ disabled: context.disabled,
52
+ min: context.min,
53
+ max: context.max,
54
+ step: context.step
55
+ }
56
+ end
57
+
58
+ def bootstrap_file_input_attributes
59
+ {
60
+ class: (options[:class] || "") << (" form-file-input"),
61
+ disabled: context.disabled
62
+ }
63
+ end
64
+
65
+ def form_file_wrapper_class
66
+ case context.variant
67
+ when :lg
68
+ (options[:class] || "") << (" form-file form-file-lg")
69
+ when :sm
70
+ (options[:class] || "") << (" form-file form-file-sm")
71
+ else
72
+ (options[:class] || "") << (" form-file")
73
+ end
74
+ end
75
+
76
+ def file_input
77
+ div class: form_file_wrapper_class do
78
+ input options.merge(input_attributes).merge(bootstrap_file_input_attributes)
79
+ label class: "form-file-label", for: attribute_key do
80
+ span class: "form-file-text", "v-if": "data['#{attribute_key}']" do
81
+ if context.multiple
82
+ span "v-for": "file in data['#{attribute_key}']" do
83
+ plain "{{ file['name'] }}"
84
+ end
85
+ else
86
+ plain "{{ data['#{attribute_key}']['name'] }}"
87
+ end
88
+ end
89
+ span class: "form-file-text", "v-if": "!data['#{attribute_key}']" do
90
+ plain context.placeholder || "Choose file"
91
+ end
92
+ span class: "form-file-button" do
93
+ plain context.browse_button_text || "Browse"
94
+ end
95
+ end
96
+ render_errors
97
+ end
98
+ end
99
+
100
+ def render_errors
101
+ if display_errors?
102
+ div class: 'invalid-feedback', 'v-for': "error in #{error_key}" do
103
+ plain '{{ error }}'
104
+ end
105
+ end
106
+ end
107
+
108
+ def input_error_class
109
+ 'is-invalid'
110
+ end
111
+
112
+ def render_form_text
113
+ div class: "form-text form-text-for-#{attribute_key}" do
114
+ plain context.form_text
115
+ end
116
+ end
117
+
118
+ end
@@ -0,0 +1,57 @@
1
+ class Matestack::Ui::Bootstrap::Form::Radio < Matestack::Ui::VueJs::Components::Form::Radio
2
+
3
+ include Matestack::Ui::Bootstrap::Registry
4
+
5
+ vue_name "matestack-ui-core-form-radio"
6
+
7
+ optional :form_text
8
+ optional :disabled
9
+ optional :variant
10
+
11
+ def response
12
+ div class: "matestack-ui-bootstrap-radio" do
13
+ label input_label, class: "form-label", ":for": id if input_label
14
+
15
+ radio_options.to_a.each_with_index do |item, index|
16
+ div class: "form-check #{'form-check-inline' if context.variant == :inline}" do
17
+ input options.merge(radio_attributes(item)).merge(bootstrap_radio_attributes)
18
+ label item_label(item), class: "form-check-label", ":for": item_id(item_value(item))
19
+ if index == radio_options.to_a.size - 1
20
+ render_errors
21
+ end
22
+ end
23
+ end
24
+ render_form_text if context.form_text
25
+ end
26
+
27
+ end
28
+
29
+ private
30
+
31
+ def bootstrap_radio_attributes
32
+ classes = 'form-check-input'
33
+ {
34
+ class: (options[:class] || "") << classes,
35
+ disabled: context.disabled
36
+ }
37
+ end
38
+
39
+ def render_form_text
40
+ div class: "form-text form-text-for-#{attribute_key}" do
41
+ plain context.form_text
42
+ end
43
+ end
44
+
45
+ def render_errors
46
+ if display_errors?
47
+ div class: 'invalid-feedback', 'v-for': "error in #{error_key}", style: "display: block;" do
48
+ plain '{{ error }}'
49
+ end
50
+ end
51
+ end
52
+
53
+ def input_error_class
54
+ 'is-invalid'
55
+ end
56
+
57
+ end
@@ -0,0 +1,63 @@
1
+ class Matestack::Ui::Bootstrap::Form::Select < Matestack::Ui::VueJs::Components::Form::Select
2
+
3
+ include Matestack::Ui::Bootstrap::Registry
4
+
5
+ vue_name "matestack-ui-core-form-select"
6
+
7
+ optional :variant
8
+ optional :size
9
+ optional :form_text
10
+
11
+ def response
12
+ div class: "matestack-ui-bootstrap-form-select" do
13
+ label input_label, ":for": id, class: "form-label" if input_label
14
+ select select_attributes.merge(bootstrap_select_attributes) do
15
+ render_options
16
+ end
17
+ render_errors
18
+ render_form_text
19
+ end
20
+ end
21
+
22
+ def bootstrap_select_attributes
23
+ {
24
+ class: form_select_class,
25
+ size: size_class,
26
+ disabled: context.disabled
27
+ }
28
+ end
29
+
30
+ def form_select_class
31
+ case context.variant
32
+ when :lg
33
+ (options[:class] || "") << (" form-select form-select-lg")
34
+ when :sm
35
+ (options[:class] || "") << (" form-select form-select-sm")
36
+ else
37
+ (options[:class] || "") << (" form-select")
38
+ end
39
+ end
40
+
41
+ def size_class
42
+ context.size
43
+ end
44
+
45
+ def render_errors
46
+ if display_errors?
47
+ div class: 'invalid-feedback', 'v-for': "error in #{error_key}" do
48
+ plain '{{ error }}'
49
+ end
50
+ end
51
+ end
52
+
53
+ def input_error_class
54
+ 'is-invalid'
55
+ end
56
+
57
+ def render_form_text
58
+ div class: "form-text form-text-for-#{attribute_key}" do
59
+ plain context.form_text
60
+ end
61
+ end
62
+
63
+ end
@@ -0,0 +1,20 @@
1
+ class Matestack::Ui::Bootstrap::Form::Submit < Matestack::Ui::Bootstrap::BaseComponent
2
+
3
+ optional :button_variant
4
+ optional :spinner_variant
5
+ optional :loading_text
6
+ optional :loading_class
7
+ optional :size
8
+ optional class: { as: :bs_class }
9
+
10
+ def response
11
+ bs_btn type: "submit", size:context.size, class: "#{context.bs_class}", variant: context.button_variant || :primary, "v-if": "!loading" do
12
+ plain context.text || "Submit"
13
+ end
14
+ bs_btn type: "submit", size: context.size, class: "#{context.bs_class} #{context.loading_class}", variant: context.button_variant || :primary, disabled: true, "v-if": "loading" do
15
+ bs_spinner variant: context.spinner_variant || :light, size: :sm
16
+ plain context.loading_text || "Loading..."
17
+ end
18
+ end
19
+
20
+ end