tramway-admin 1.29.1 → 1.29.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed575a82aacf123ee4caeaab6eddf14ed35594decc07fd44789d4c0ee03d0a8b
|
4
|
+
data.tar.gz: 6098b5fe7138b6e9b102ac3e6ac87855d80e63540207a87398e4942ed476ca66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918f43cc0f9a3e7c3fad73769f22a6c03a9ff344e6c28c42439f54248cd890fe6f62894b12d2ee40c8bede75d79951ea6e2ac6fb525e5f5b798dd48c99d1a5f9
|
7
|
+
data.tar.gz: 81248e831e6ffa7698d4606bcde6310cc196ce5261c9c1dd729a0ace116f2a20ef8fea0d4ff5983609111240b5d84aae74e85d3eb9b99b2f149dac70f7017849
|
@@ -18,7 +18,7 @@
|
|
18
18
|
= model_menu_item model: model, route: ::Tramway::Admin::Engine.routes.url_helpers.singleton_path(model: model)
|
19
19
|
- when :record
|
20
20
|
= model_menu_item model: model, route: ::Tramway::Admin::Engine.routes.url_helpers.records_path(model: model, scope: decorator_class(model).collections.first), pluralize: plural(model.model_name).capitalize
|
21
|
-
- when Symbol
|
21
|
+
- when Symbol, String
|
22
22
|
= dropdown t("admin.navbar.links.#{item.keys.first}") do
|
23
23
|
- item.values.first.each do |sub_item|
|
24
24
|
- if sub_item == :divider
|
data/lib/tramway/admin.rb
CHANGED
@@ -39,11 +39,11 @@ module Tramway
|
|
39
39
|
error = Tramway::Error.new(
|
40
40
|
plugin: :admin,
|
41
41
|
method: :get_models_by_key,
|
42
|
-
message: "Looks like you have not create at least one instance of #{Tramway::Core.application.model_class} model"
|
42
|
+
message: "Looks like you have not create at least one instance of #{Tramway::Core.application.model_class} model OR Tramway Application Model is nil"
|
43
43
|
)
|
44
44
|
raise error.message
|
45
45
|
end
|
46
|
-
checked_models && checked_models
|
46
|
+
checked_models && checked_models[project]&.dig(role)&.keys || []
|
47
47
|
end
|
48
48
|
|
49
49
|
def models_array(models_type:, role:)
|
data/lib/tramway/admin/navbar.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Tramway::Admin::Navbar
|
4
|
-
def navbar_structure(*links)
|
5
|
-
@navbar_structure ||=
|
4
|
+
def navbar_structure(*links, project:)
|
5
|
+
@navbar_structure ||= {}
|
6
|
+
@navbar_structure.merge! project => links
|
6
7
|
end
|
7
8
|
|
8
9
|
def navbar_items_for(project, role:)
|
9
|
-
|
10
|
-
@
|
11
|
-
navbar_structure.map do |item|
|
10
|
+
project = project.underscore.to_sym
|
11
|
+
@navbar_structure[project]&.map do |item|
|
12
12
|
if item.is_a? Class
|
13
|
-
should_be_in_navbar_as item
|
13
|
+
should_be_in_navbar_as item, project, role
|
14
14
|
elsif item.is_a? Hash
|
15
15
|
sub_items = item.values.first.map do |sub_item|
|
16
|
-
should_be_in_navbar_as sub_item
|
16
|
+
should_be_in_navbar_as sub_item, project, role
|
17
17
|
end.compact
|
18
18
|
{ item.keys.first => sub_items } if sub_items.any?
|
19
19
|
end
|
20
|
-
end
|
20
|
+
end&.compact || []
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def should_be_in_navbar_as(item)
|
26
|
-
if
|
25
|
+
def should_be_in_navbar_as(item, project, role)
|
26
|
+
if singleton_models_for(project, role: role).include?(item)
|
27
27
|
{ item => :singleton }
|
28
|
-
elsif
|
28
|
+
elsif available_models_for(project, role: role).include?(item)
|
29
29
|
{ item => :record }
|
30
30
|
elsif item.is_a? Symbol
|
31
31
|
:divider
|
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: 1.29.1
|
4
|
+
version: 1.29.1.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: 2020-04-
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-kaminari-views
|