tramway-admin 4.0.0.1 → 4.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: 5c198a3b0d6fad90c8de0c064e53843dc4c7471087f8ef379aeb28e37e1ee446
4
- data.tar.gz: f0aa47073c3a211e5396179b06499cdf2f5782f255c017c83723e7e50dfeadc4
3
+ metadata.gz: 4f49bf5b4e9e0ac337b90230037a618c730eb92fc0d11c2139a8452e4a44fc66
4
+ data.tar.gz: 1560fc7b9a504b76a78a3272f9feae6c672add55ce468255aee7593c4453f1dd
5
5
  SHA512:
6
- metadata.gz: 380e8552c48f0afc1f70700bd792af2718d9c4bdd486e0fb8a774a07dac46cc9b0a0ae679bffce7b8be8924ea745ebcda4b6b7d3ded34bdc7ecbf1994dcb59db
7
- data.tar.gz: 9dc264f0b6310b6945932894171e780a6cc88da295fe9f0c01b16adb7f69571b10005d1ea7534150c74fae86a1d59fdd5341fe026b7700327ef1ae1920dd735c
6
+ metadata.gz: 27ce4b592fed1ea8a20b2c164187947313a35f044bea80cffa324647fad7191518e97b37e2b1eb6e0d2e23eae3d2afec95bddcdfbb03789ca5d93fbe1a3092f8
7
+ data.tar.gz: 3d44b49c30c6fea3c44db3e934613e8341cc0198e0c18280c6990965eedd91befa1bd8589a7c34f10816f4afe281830484839ecf54d5dbf144c281b519c45cd9
@@ -21,6 +21,16 @@ module Tramway::Admin::ActionsHelper
21
21
  )
22
22
  end
23
23
 
24
+ def create_is_available?(association_class)
25
+ ::Tramway::Admin.action_is_available?(
26
+ nil,
27
+ project: (@application_engine || @application.name),
28
+ model_name: association_class,
29
+ role: current_admin.role,
30
+ action: :create
31
+ )
32
+ end
33
+
24
34
  # delete_button is in smart-buttons gem
25
35
 
26
36
  def edit_button(url:, button_options:)
@@ -4,7 +4,7 @@
4
4
  %meta{ content: "width=device-width, initial-scale=1, maximum-scale=0.8", name: "viewport" }
5
5
  %title
6
6
  = yield :title
7
- = stylesheet_link_tag 'tramway/admin/application', media: "all"
7
+ = stylesheet_link_tag 'tramway/admin/application', media: :all
8
8
  = javascript_include_tag 'tramway/admin/application'
9
9
  - if File.exists?("#{Rails.root}/app/assets/javascripts/admin/application.js") || File.exists?("#{Rails.root}/app/assets/javascripts/admin/application.js.coffee")
10
10
  = javascript_include_tag 'admin/application'
@@ -7,7 +7,7 @@
7
7
  %td
8
8
  = model_class.human_attribute_name association.name
9
9
  %hr
10
- - if association_type != :has_one || !object.send(association.name).present?
10
+ - if create_is_available?(association.name) && (association_type != :has_one || !object.send(association.name).present?)
11
11
  = link_to "#{I18n.t('helpers.actions.add')} #{model_class.human_attribute_name(association.name).singularize.downcase}", new_associated_record_path(association: association, object: object, as: object.send("#{association.name}_as")), class: 'btn btn-primary'
12
12
  %td{ colspan: 2 }
13
13
  - if association_type.in? [ :has_one, :belongs_to ]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Admin
5
- VERSION = '4.0.0.1'
5
+ VERSION = '4.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tramway-core