tramway 1.0.0.1 → 1.0.0.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/README.md +50 -0
- data/app/components/tailwinds/form/select_component.html.haml +1 -1
- data/lib/tramway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 57b6e5f5f0c3bc724e733758134ad2e3ebbb3137d88d592bf6c74f3560dab659
|
|
4
|
+
data.tar.gz: ccfbeeaa6e7bd77f039616a8483613de0b89f0f3e15e7320bd637d5acd70ef29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c90a66a4211d1ab1ef544308458a7a348e9ba087467f707740e9bfbbe102084a7442522464da119659dd93afd625487a545db6c368eb978cbbbbbb6f8f7f64c
|
|
7
|
+
data.tar.gz: e8e4403ea11d739f34e3956adfdb190c3b4997ecc361221e4d9570c41863f7f0fc4768580ff3aa577565d694fc9c279b3ec4ee0e30c8b310143ccb7866dfc450
|
data/README.md
CHANGED
|
@@ -248,6 +248,56 @@ class UserDecorator < Tramway::BaseDecorator
|
|
|
248
248
|
end
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
+
#### Add header content to index pages
|
|
252
|
+
|
|
253
|
+
You can inject custom content above an entity's index table by defining an
|
|
254
|
+
`index_header_content` lambda on its decorator. The lambda receives the
|
|
255
|
+
collection of decorated records and can render any component you need.
|
|
256
|
+
|
|
257
|
+
*config/initializers/tramway.rb*
|
|
258
|
+
```ruby
|
|
259
|
+
Tramway.configure do |config|
|
|
260
|
+
config.entities = [
|
|
261
|
+
{
|
|
262
|
+
name: :project,
|
|
263
|
+
pages: [
|
|
264
|
+
{ action: :index }
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
end
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
*app/decorators/project_decorator.rb*
|
|
272
|
+
```ruby
|
|
273
|
+
class ProjectDecorator < Tramway::BaseDecorator
|
|
274
|
+
class << self
|
|
275
|
+
def index_header_content
|
|
276
|
+
lambda do |_collection|
|
|
277
|
+
component "projects/index_header"
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
*app/components/projects/index_header_component.html.haml*
|
|
285
|
+
```haml
|
|
286
|
+
.mb-2
|
|
287
|
+
= tramway_button path: Rails.application.routes.url_helpers.new_project_path,
|
|
288
|
+
text: 'Create',
|
|
289
|
+
type: :hope
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
*app/components/projects/index_header_component.rb*
|
|
293
|
+
```ruby
|
|
294
|
+
class Projects::IndexHeaderComponent < Tramway::BaseComponent
|
|
295
|
+
end
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
With this configuration in place, the index page will render the `Create`
|
|
299
|
+
button component above the table of projects.
|
|
300
|
+
|
|
251
301
|
#### Decorate a single object
|
|
252
302
|
|
|
253
303
|
You can use the same method to decorate a single object either
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
- if @label
|
|
3
3
|
= component('tailwinds/form/label', for: @for) do
|
|
4
4
|
= @label
|
|
5
|
-
- base_classes = 'bg-white border border-gray-300 text-gray-700 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 '
|
|
5
|
+
- base_classes = 'w-full bg-white border border-gray-300 text-gray-700 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 '
|
|
6
6
|
- base_classes += 'focus:border-transparent disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed '
|
|
7
7
|
- base_classes += 'dark:bg-gray-800 dark:border-gray-600 dark:text-gray-100 dark:focus:ring-red-400 dark:disabled:bg-gray-800 dark:disabled:text-gray-500'
|
|
8
8
|
- classes = "#{size_class(:select_input)} #{base_classes}"
|
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: 1.0.0.
|
|
4
|
+
version: 1.0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kalashnikovisme
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-11-
|
|
12
|
+
date: 2025-11-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: anyway_config
|