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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf44b11818abdaef1bd6f416f95ad023990a56a11ab06d89e49a85f0402b2a01
4
- data.tar.gz: 9699cc4c0adb5f5c3430f4fe39545b889924a60d0cd6ffa353598fb9da50458d
3
+ metadata.gz: e1f1df8f432adde2da452b7fd80c31455b60c0f9780bf2fbef6e5d2df32bbf93
4
+ data.tar.gz: f89edad193cc1af91d7ed050d0e00e12b5a8b64b0539cdb5236ece6fe9e11cae
5
5
  SHA512:
6
- metadata.gz: 3a817f9f4833e315496dfaa1fc52e59618aa75d4b44c27a3ae97114b7374501ec5bcf6d8f6e49954b46233f029cd14e169f7adb68cbd0689dc295c785da7b63d
7
- data.tar.gz: 2c103a0d7de7e31964dc124a0eee8f0620f566ac7e0b0075b309114381cd219c9c0ce8dfaf6a5169956c36ec07d980a56b3d1a9ecddaafefa5349ecf8b5bebc9
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].call
7
+ button[:inner]&.call
8
8
  end)
9
9
  end
10
10
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '2.1'
5
+ VERSION = '2.1.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: 2.1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov