|
1 | 1 | class CheckboxesComponentPreview < FormComponentPreview |
2 | 2 | # @!group Default |
3 | 3 | def default |
4 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, unique_id: "default")) |
| 4 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, instance_key: "default")) |
5 | 5 | end |
6 | 6 |
|
7 | 7 | def prefilled |
8 | 8 | custom_model = TestModel.new(favorite_fruits: ["apple", "orange"]) |
9 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, unique_id: "prefilled")) |
| 9 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, instance_key: "prefilled")) |
10 | 10 | end |
11 | 11 |
|
12 | 12 | def with_error |
13 | 13 | custom_model = TestModel.new |
14 | 14 | custom_model.valid? |
15 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, unique_id: "with_error")) |
| 15 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, instance_key: "with_error")) |
16 | 16 | end |
17 | 17 |
|
18 | 18 | def with_warning |
19 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, warning_message: "Message goes here.", unique_id: "with_warning")) |
| 19 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, warning_message: "Message goes here.", instance_key: "with_warning")) |
20 | 20 | end |
21 | 21 |
|
22 | 22 | def indeterminate |
23 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :indeterminate}, unique_id: "indeterminate")) |
| 23 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :indeterminate}, instance_key: "indeterminate")) |
24 | 24 | end |
25 | 25 |
|
26 | 26 | def disabled_item |
27 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :disabled}, unique_id: "disabled_item")) |
| 27 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :disabled}, instance_key: "disabled_item")) |
28 | 28 | end |
29 | 29 |
|
30 | 30 | def mixed_states |
31 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :indeterminate, "apple" => :disabled}, unique_id: "mixed_states")) |
| 31 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, item_states: {"orange" => :indeterminate, "apple" => :disabled}, instance_key: "mixed_states")) |
32 | 32 | end |
33 | 33 |
|
34 | 34 | def mixed_states_with_error_and_warning |
35 | 35 | custom_model = TestModel.new |
36 | 36 | custom_model.valid? |
37 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, warning_message: "Message goes here.", item_states: {"orange" => :indeterminate, "apple" => :disabled}, unique_id: "mixed_states_with_error_and_warning")) |
| 37 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, warning_message: "Message goes here.", item_states: {"orange" => :indeterminate, "apple" => :disabled}, instance_key: "mixed_states_with_error_and_warning")) |
38 | 38 | end |
39 | 39 | # @!endgroup |
40 | 40 |
|
41 | 41 | # @!group Small |
42 | 42 | def small_default |
43 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, unique_id: "small_default")) |
| 43 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, instance_key: "small_default")) |
44 | 44 | end |
45 | 45 |
|
46 | 46 | def small_prefilled |
47 | 47 | custom_model = TestModel.new(favorite_fruits: ["apple", "orange"]) |
48 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, unique_id: "small_prefilled")) |
| 48 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, instance_key: "small_prefilled")) |
49 | 49 | end |
50 | 50 |
|
51 | 51 | def small_with_error |
52 | 52 | custom_model = TestModel.new |
53 | 53 | custom_model.valid? |
54 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, unique_id: "small_with_error")) |
| 54 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, instance_key: "small_with_error")) |
55 | 55 | end |
56 | 56 |
|
57 | 57 | def small_with_warning |
58 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, warning_message: "Message goes here.", unique_id: "small_with_warning")) |
| 58 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, warning_message: "Message goes here.", instance_key: "small_with_warning")) |
59 | 59 | end |
60 | 60 |
|
61 | 61 | def small_indeterminate |
62 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :indeterminate}, unique_id: "small_indeterminate")) |
| 62 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :indeterminate}, instance_key: "small_indeterminate")) |
63 | 63 | end |
64 | 64 |
|
65 | 65 | def small_disabled_item |
66 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :disabled}, unique_id: "small_disabled_item")) |
| 66 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :disabled}, instance_key: "small_disabled_item")) |
67 | 67 | end |
68 | 68 |
|
69 | 69 | def small_mixed_states |
70 | | - render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :indeterminate, "apple" => :disabled}, unique_id: "small_mixed_states")) |
| 70 | + render(CheckboxesComponent.new(form:, method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, item_states: {"orange" => :indeterminate, "apple" => :disabled}, instance_key: "small_mixed_states")) |
71 | 71 | end |
72 | 72 |
|
73 | 73 | def small_mixed_states_with_error_and_warning |
74 | 74 | custom_model = TestModel.new |
75 | 75 | custom_model.valid? |
76 | | - render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, warning_message: "Message goes here.", item_states: {"orange" => :indeterminate, "apple" => :disabled}, unique_id: "small_mixed_states_with_error_and_warning")) |
| 76 | + render(CheckboxesComponent.new(form: form(model: custom_model), method: :favorite_fruits, collection: self.class.fruit_options, item_value_method: :value, item_label_method: :label, small: true, warning_message: "Message goes here.", item_states: {"orange" => :indeterminate, "apple" => :disabled}, instance_key: "small_mixed_states_with_error_and_warning")) |
77 | 77 | end |
78 | 78 | # @!endgroup |
79 | 79 | end |
0 commit comments