tramway 3.0.3.1 → 3.0.3.2
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/docs/AGENTS.md +9 -0
- data/lib/generators/tramway/install/install_generator.rb +10 -1
- data/lib/tramway/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18f56f1bece8fece4b33c56698d52e56a39a30f6215c67de3766dc50b884910d
|
|
4
|
+
data.tar.gz: 2642cf5b5af6a391421684aecf4af9682d5b047956ac0c0be7744b81a6219b2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30a9432d7e353e05d8a71fd4d84a6ff9fa906a57ca9719c6153b6972e6688fc1d8b7fe51d3c2e4cc97d5de943641ddc905e56aef8cc8488400f0e757a5d46380
|
|
7
|
+
data.tar.gz: f08b2459cddf0d95841620803b541edb3afb5bad80c85144848f998fcc9fd41203b43445450337d69f30766cd96d5d9d2a6c4cfdd728b94fa16d29133ab98091
|
data/docs/AGENTS.md
CHANGED
|
@@ -645,6 +645,15 @@ In case you want to use container on the page, use `tramway_container` helper in
|
|
|
645
645
|
### Rule 34
|
|
646
646
|
If for some model already has index and show pages via Tramway Entity, and the request explicitly needs state management. Do not create a new controller for that. Instead, create a new component for buttons and use it via `show_header_content` in Tramway Decorator for show page and new columns (Actions) in `list_attributes` for index page. This column should be rendered via the component and contain buttons for state management.
|
|
647
647
|
|
|
648
|
+
### Rule 35
|
|
649
|
+
If you need select input for an attribute that enumerized via `enumerize` gem, use `collection: Model.attribute.values` in the field definition.
|
|
650
|
+
|
|
651
|
+
Example for `User` model with `role` attribute:
|
|
652
|
+
|
|
653
|
+
```ruby
|
|
654
|
+
= f.select :model_attribute, User.role.values.map { [it.humanize, it] }
|
|
655
|
+
```
|
|
656
|
+
|
|
648
657
|
## Controller Patterns
|
|
649
658
|
|
|
650
659
|
- Keep actions short and explicit with guard clauses.
|
|
@@ -86,8 +86,12 @@ module Tramway
|
|
|
86
86
|
@agents_file_path ||= File.join(destination_root, 'AGENTS.md')
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
def project_tramway_agents_path
|
|
90
|
+
@project_tramway_agents_path ||= File.join(destination_root, 'docs/agents/tramway.md')
|
|
91
|
+
end
|
|
92
|
+
|
|
89
93
|
def agents_template_url
|
|
90
|
-
'https://
|
|
94
|
+
'https://github.com/Purple-Magic/base_project/blob/main/docs/agents/tramway.md'
|
|
91
95
|
end
|
|
92
96
|
|
|
93
97
|
def agents_template_body
|
|
@@ -235,6 +239,11 @@ module Tramway
|
|
|
235
239
|
# rubocop:disable Metrics/MethodLength
|
|
236
240
|
def ensure_agents_file
|
|
237
241
|
with_agents_update_fallback do
|
|
242
|
+
if File.exist?(project_tramway_agents_path)
|
|
243
|
+
say_status(:info, "Skipping AGENTS.md update because #{project_tramway_agents_path} exists.")
|
|
244
|
+
return
|
|
245
|
+
end
|
|
246
|
+
|
|
238
247
|
say_status(
|
|
239
248
|
:info,
|
|
240
249
|
"Tramway will replace the content between \"#{agents_section_start}\" and " \
|
data/lib/tramway/version.rb
CHANGED