tramway-admin 2.1 → 2.1.0.1
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 +23 -0
- data/app/helpers/tramway/admin/additional_buttons_builder.rb +1 -1
- data/lib/tramway/admin/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: e1f1df8f432adde2da452b7fd80c31455b60c0f9780bf2fbef6e5d2df32bbf93
|
4
|
+
data.tar.gz: f89edad193cc1af91d7ed050d0e00e12b5a8b64b0539cdb5236ece6fe9e11cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f6f4afc8b26b1eca9bb2d514c123e4402db45ce485703ab16c78c7414bea00e5dccc4ca2db06a04503f920a3c522bddd65e024a5e903aac0fadf23ddb646c2
|
7
|
+
data.tar.gz: 1a7d2edf8c8c43336915d02fd95efc21fcbc6618e8a6cde73ca62513d66149bda94614b5fac4e43819a9af908a74ea65943d3af63799fe2db3e8136b4256b64c
|
data/README.md
CHANGED
@@ -526,6 +526,29 @@ en:
|
|
526
526
|
my_dropdown: Very important dropdown
|
527
527
|
```
|
528
528
|
|
529
|
+
## Additional buttons to the show view
|
530
|
+
|
531
|
+
You can additional buttons to the header of show view of your model. Just add its configuration to the decorator
|
532
|
+
|
533
|
+
*app/decorators/your_model_decorator.rb*
|
534
|
+
```ruby
|
535
|
+
class YourModelDecorator < Tramway::Core::ApplicationDecorator
|
536
|
+
def additional_buttons
|
537
|
+
{
|
538
|
+
show: [ # means that this buttons will be shown on show view only
|
539
|
+
{
|
540
|
+
url: ::Tramway::Export::Engine.routes.url_helpers.export_path(object.id, model: object.class, collection: :tasks),
|
541
|
+
inner: lambda do # inner HTML you want to see in the button
|
542
|
+
fa_icon 'file-excel'
|
543
|
+
end,
|
544
|
+
color: :success # bootstrap button color
|
545
|
+
}
|
546
|
+
]
|
547
|
+
}
|
548
|
+
end
|
549
|
+
end
|
550
|
+
```
|
551
|
+
|
529
552
|
## Errors
|
530
553
|
|
531
554
|
* **Model or Form is not available** - `params[:model]` or `params[:form]` is empty **OR** current user does not have access to model or form in `params[:model]` or `params[:form]`
|
@@ -4,7 +4,7 @@ module Tramway::Admin::AdditionalButtonsBuilder
|
|
4
4
|
def build_button(button)
|
5
5
|
options = button[:options] || {}
|
6
6
|
concat(link_to(button[:url], method: button[:method], class: "btn btn-#{button[:color]} btn-xs", **options) do
|
7
|
-
button[:inner]
|
7
|
+
button[:inner]&.call
|
8
8
|
end)
|
9
9
|
end
|
10
10
|
end
|