Skip to content

Commit 34a6cad

Browse files
committed
fixing form components
1 parent d3fe40c commit 34a6cad

File tree

12 files changed

+27
-107
lines changed

12 files changed

+27
-107
lines changed

app/concepts/matestack/ui/bootstrap/form/select.rb

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@ class Matestack::Ui::Bootstrap::Form::Select < Matestack::Ui::Core::Form::Select
66
optional :size
77
optional :form_text
88

9-
# %select{ html_attributes.merge(vue_attributes) }
10-
# - if placeholder
11-
# %option{value: placeholder_value, disabled: true, selected: init_value.nil?}= placeholder
12-
# - select_options.to_a.each do |item|
13-
# %option{value: item_value(item), disabled: item_disabled(item)}= item_label(item)
14-
# = render_errors
15-
# - if form_text
16-
# = render_form_text
17-
189
def response
1910
div class: "matestack-ui-bootstrap-form-select" do
2011
label for: attr_key, class: "form-label", text: input_label if input_label
21-
# id is missing!
22-
select select_attributes.merge({ class: form_select_class, size: size_class }) do
12+
select select_attributes.merge({ id: (options[:id] || attr_key), class: form_select_class, size: size_class }) do
2313
render_options
2414
end
2515
render_errors
@@ -42,26 +32,6 @@ def size_class
4232
size
4333
end
4434

45-
# def determine_init_value
46-
# if init_value
47-
# init_value
48-
# else
49-
# if multiple
50-
# []
51-
# else
52-
# nil
53-
# end
54-
# end
55-
# end
56-
#
57-
# def placeholder_value
58-
# if multiple
59-
# '[]'
60-
# else
61-
# 'null'
62-
# end
63-
# end
64-
6535
def render_errors
6636
unless @included_config[:errors] == false && (errors == false || errors.nil?) || errors == false
6737
div class: 'invalid-feedback', attributes: { 'v-for': "error in #{error_key}" } do

app/concepts/matestack/ui/bootstrap/form/submit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def response
1111
bs_btn type: "submit", size: options[:size], class: "#{options[:class]}", variant: button_variant || :primary, attributes: { "v-if": "!loading()" } do
1212
plain text || "Submit"
1313
end
14-
bs_btn type: "submit", size: options[:size], class: "#{loading_class}", variant: button_variant || :primary, attributes: { disabled: true, "v-if": "loading()" } do
14+
bs_btn type: "submit", size: options[:size], class: "#{options[:class]} #{loading_class}", variant: button_variant || :primary, attributes: { disabled: true, "v-if": "loading()" } do
1515
bs_spinner variant: spinner_variant || :light, size: :sm
1616
plain loading_text || "Loading..."
1717
end

docs/api/form/README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.

docs/api/form/components.md

Lines changed: 0 additions & 51 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Renders a Bootstrap button that acts as a form submit trigger.
2020

2121
* `size` - Expects a symbol that defines the Bootstrap button size
2222

23+
* `class` - Additional custom CSS class applied to button
24+
25+
* `loading_class` - Additional custom CSS class applied to button during submission
26+
2327
## Examples
2428

2529
### Example 1: Basic usage without any configuration
@@ -45,8 +49,8 @@ bs_form_submit button_variant: :light, spinner_variant: :dark
4549
bs_form_submit size: :lg
4650
```
4751

48-
### Example 5: Non-default text, loading_text, button_variant, spinner_variant, size plus additional, custom class & class_loading
52+
### Example 5: Non-default text, loading_text, button_variant, spinner_variant, size plus additional, custom class & loading_class
4953

5054
```ruby
51-
bs_form_submit button_variant: :light, spinner_variant: :dark, class: "custom-submit", class_loading: "custom-submit-loading", size: :lg, text: "Submit!!", loading_text: "Getting submitted"
55+
bs_form_submit button_variant: :light, spinner_variant: :dark, class: "custom-submit", loading_class: "custom-submit-loading", size: :lg, text: "Submit!!", loading_text: "Getting submitted"
5256
```
File renamed without changes.

0 commit comments

Comments
 (0)