tramway-core 1.18.1.1 → 1.18.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eca2bd589fed76d9385bbed1319fbd061e418521966d81561bf8ffeaa3648c9
|
4
|
+
data.tar.gz: 67488c6b5304f9941220b9bcb97d6ca5271e414e323d7c64806805e5aea5deb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f8da95bb6038a4e3bb956fcf0a7851cb2e81a82392a92fd00a1d1337eaad0a13f5a852a2a8701bcead04eb1250ac17335d5bf44deb18c4dbcf3df980026e275
|
7
|
+
data.tar.gz: be00745caa58c4703b5dca9eb53ef6dc8d16917d39c510f0d95efac655c165fa5eec00e6813424eba5edd0f78377c60bbdb77688a3f7895b4ab8d9910f051617
|
@@ -15,4 +15,8 @@ class Tramway::Core::ApplicationController < ActionController::Base
|
|
15
15
|
def model_class
|
16
16
|
params[:model].constantize
|
17
17
|
end
|
18
|
+
|
19
|
+
def authenticated_user
|
20
|
+
(defined?(current_user) && current_user.try(:model)) || (defined?(current_admin) && current_admin.model)
|
21
|
+
end
|
18
22
|
end
|
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
module Tramway::Core::Inputs::AssociationsHelper
|
4
4
|
def build_collection_for_association(form_object, property)
|
5
|
+
user = defined?(current_user) ? current_user : current_admin
|
5
6
|
full_class_name_association = form_object.class.full_class_name_association(property)
|
6
7
|
check_valid_association full_class_name_association
|
7
|
-
full_class_name_association.active.send("#{
|
8
|
+
full_class_name_association.active.send("#{user.role}_scope", user.id).map do |obj|
|
8
9
|
decorator_class(full_class_name_association).decorate obj
|
9
10
|
end.sort_by(&:name)
|
10
11
|
end
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
module Tramway::Core::Inputs::PolymorphicAssociationsHelper
|
4
4
|
def build_collection_for_polymorphic_association(form_object, property)
|
5
|
+
user = defined?(current_user) ? current_user : current_admin
|
5
6
|
object_names = full_class_names(form_object, property).map do |class_name|
|
6
|
-
class_name.active.send("#{
|
7
|
+
class_name.active.send("#{user.role}_scope", user.id).map do |obj|
|
7
8
|
decorator_class(class_name).decorate obj
|
8
9
|
end
|
9
10
|
end.flatten
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.1.
|
4
|
+
version: 1.18.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|