tramway 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/components/tailwind_component.rb +13 -3
- data/app/components/tailwinds/form/builder.rb +4 -0
- data/app/components/tailwinds/form/checkbox_component.html.haml +7 -0
- data/app/components/tailwinds/form/checkbox_component.rb +9 -0
- data/docs/AGENTS.md +18 -0
- data/lib/tramway/utils/field.rb +3 -1
- data/lib/tramway/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 908989b8908005e2022039beec8b7b47c4a7200166c77fe33c2dd27891d2fe58
|
|
4
|
+
data.tar.gz: b57f2f3717522d10885d7ba83464590ff21ce87fa24af5c46deb85b0fac806cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7824108d8dfe9a0c3da312a26d12a84fe1df9424550c6edb29b864634109cc793e883a9f13ff90a7ab40d2e9b833cc6068194055410837cb554dd0e467f802f7
|
|
7
|
+
data.tar.gz: befb3fe2ad460b34f002ffd58b01ab4c1f9996ff5f402e714bb54b6fa013091004b55e7ed8b558b551dd017bba4609c01072370eae034b77c51f978a8703fa4e
|
|
@@ -18,21 +18,24 @@ class TailwindComponent < Tramway::BaseComponent
|
|
|
18
18
|
select_input: 'text-sm px-2 py-1',
|
|
19
19
|
file_button: 'text-sm px-3 py-1',
|
|
20
20
|
submit_button: 'text-sm px-3 py-1',
|
|
21
|
-
multiselect_input: 'text-sm px-2 py-1 h-10'
|
|
21
|
+
multiselect_input: 'text-sm px-2 py-1 h-10',
|
|
22
|
+
checkbox_input: 'h-4 w-4'
|
|
22
23
|
},
|
|
23
24
|
medium: {
|
|
24
25
|
text_input: 'text-base px-3 py-2',
|
|
25
26
|
select_input: 'text-base px-3 py-2',
|
|
26
27
|
file_button: 'text-base px-4 py-2',
|
|
27
28
|
submit_button: 'text-base px-4 py-2',
|
|
28
|
-
multiselect_input: 'text-base px-2 py-1 h-12'
|
|
29
|
+
multiselect_input: 'text-base px-2 py-1 h-12',
|
|
30
|
+
checkbox_input: 'h-5 w-5'
|
|
29
31
|
},
|
|
30
32
|
large: {
|
|
31
33
|
text_input: 'text-xl px-4 py-3',
|
|
32
34
|
select_input: 'text-xl px-4 py-3',
|
|
33
35
|
file_button: 'text-xl px-5 py-3',
|
|
34
36
|
submit_button: 'text-xl px-5 py-3',
|
|
35
|
-
multiselect_input: 'text-xl px-3 py-2 h-15'
|
|
37
|
+
multiselect_input: 'text-xl px-3 py-2 h-15',
|
|
38
|
+
checkbox_input: 'h-6 w-6'
|
|
36
39
|
}
|
|
37
40
|
}.freeze
|
|
38
41
|
|
|
@@ -67,6 +70,13 @@ class TailwindComponent < Tramway::BaseComponent
|
|
|
67
70
|
)
|
|
68
71
|
end
|
|
69
72
|
|
|
73
|
+
def checkbox_base_classes
|
|
74
|
+
theme_classes(
|
|
75
|
+
classic: 'rounded-full border border-gray-700 bg-gray-900 text-gray-100 shadow-inner focus:outline-none ' \
|
|
76
|
+
'focus:ring-2 focus:ring-gray-600'
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
|
|
70
80
|
def form_label_classes
|
|
71
81
|
theme_classes(
|
|
72
82
|
classic: 'block text-sm font-semibold mb-2 text-gray-200'
|
|
@@ -68,6 +68,10 @@ module Tailwinds
|
|
|
68
68
|
render(Tailwinds::Form::FileFieldComponent.new(input:, **default_options(attribute, sanitized_options)), &)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def check_box(attribute, **, &)
|
|
72
|
+
common_field(:checkbox, :check_box, attribute, **, &)
|
|
73
|
+
end
|
|
74
|
+
|
|
71
75
|
def select(attribute, collection, **options, &)
|
|
72
76
|
sanitized_options = sanitize_options(options)
|
|
73
77
|
|
data/docs/AGENTS.md
CHANGED
|
@@ -425,6 +425,24 @@ and in a controller
|
|
|
425
425
|
end
|
|
426
426
|
```
|
|
427
427
|
|
|
428
|
+
### Rule 27
|
|
429
|
+
Don't create scopes for enumerated values, use `scope: :shallow` of the enumerize gem.
|
|
430
|
+
|
|
431
|
+
Do this
|
|
432
|
+
|
|
433
|
+
```
|
|
434
|
+
enumerize :role, in: [:admin, :default], scope: :shallow
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Instead of this
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
scope :for_role, -> (role) { where role: role }
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Rule 28
|
|
444
|
+
In case, you need to make a one link in tramway_table on each row. Use `tramway_row href: your_link` instead of putting the like inside a cell.
|
|
445
|
+
|
|
428
446
|
## Controller Patterns
|
|
429
447
|
|
|
430
448
|
- Keep actions short and explicit with guard clauses.
|
data/lib/tramway/utils/field.rb
CHANGED
|
@@ -23,8 +23,10 @@ module Tramway
|
|
|
23
23
|
|
|
24
24
|
def field_name(field_data)
|
|
25
25
|
case field_data.to_sym
|
|
26
|
-
when :text_area, :select, :multiselect
|
|
26
|
+
when :text_area, :select, :multiselect, :check_box
|
|
27
27
|
field_data
|
|
28
|
+
when :checkbox
|
|
29
|
+
:check_box
|
|
28
30
|
else
|
|
29
31
|
"#{field_data}_field"
|
|
30
32
|
end
|
data/lib/tramway/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tramway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kalashnikovisme
|
|
@@ -156,6 +156,8 @@ files:
|
|
|
156
156
|
- app/components/tailwinds/flash_component.html.haml
|
|
157
157
|
- app/components/tailwinds/flash_component.rb
|
|
158
158
|
- app/components/tailwinds/form/builder.rb
|
|
159
|
+
- app/components/tailwinds/form/checkbox_component.html.haml
|
|
160
|
+
- app/components/tailwinds/form/checkbox_component.rb
|
|
159
161
|
- app/components/tailwinds/form/date_field_component.html.haml
|
|
160
162
|
- app/components/tailwinds/form/date_field_component.rb
|
|
161
163
|
- app/components/tailwinds/form/datetime_field_component.html.haml
|