graph_starter 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/graph_starter/assets_controller.rb +15 -4
- data/app/helpers/graph_starter/application_helper.rb +0 -4
- data/app/views/layouts/graph_starter/_menu.html.slim +1 -0
- data/lib/graph_starter/configuration.rb +6 -1
- data/lib/graph_starter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95f03dfb7ac0e8f3252c7bf329d58658f174429a
|
4
|
+
data.tar.gz: 9aeb034501d432cb989fbd0209f0eeb0c8bce5d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c35c391e347b0a67f2548f6fda1f7d8c9180946432992609cbb165b0b7d08c076ad863511f67a18b55bc04b78a21f9c882e467fd5d2b0937992709686c8e45f
|
7
|
+
data.tar.gz: cc5900cd8157044cf5b53132af168ce4b49f422ad12cca34fae7211fa4ce477d69f4ead11a557533fbed3cdd4fab7ddb1633df8a193aa4a36e39a0d6339b0866
|
@@ -42,10 +42,14 @@ module GraphStarter
|
|
42
42
|
|
43
43
|
scope = scope.limit(50)
|
44
44
|
|
45
|
-
if associations.present?
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
scope = if associations.present?
|
46
|
+
scope.query_as(var).with(var).proxy_as(model_class, var).with_associations(*associations)
|
47
|
+
else
|
48
|
+
scope
|
49
|
+
end
|
50
|
+
|
51
|
+
if asset_scope_filter
|
52
|
+
asset_scope_filter.call(scope)
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
@@ -96,5 +100,12 @@ module GraphStarter
|
|
96
100
|
|
97
101
|
@model_class_scope ||= model_class.all(var)
|
98
102
|
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def asset_scope_filter
|
107
|
+
GraphStarter.configuration.scope_filters[model_class.name.to_sym]
|
108
|
+
end
|
109
|
+
|
99
110
|
end
|
100
111
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#menu.ui.secondary.pointing.menu
|
2
2
|
= link_to 'Home', '/', class: "item #{'active' if request.path == '/'}"
|
3
|
+
- config = GraphStarter::CONFIG
|
3
4
|
- menu_models = config.menu_models && config.menu_models.map(&:to_s)
|
4
5
|
- GraphStarter::Asset.descendants.each do |model_class|
|
5
6
|
- next if menu_models && !model_class.name.in?(menu_models)
|
@@ -2,10 +2,11 @@ module GraphStarter
|
|
2
2
|
class Configuration
|
3
3
|
attr_writer :user_class
|
4
4
|
|
5
|
-
attr_accessor :menu_models, :icon_classes
|
5
|
+
attr_accessor :menu_models, :icon_classes, :scope_filters
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@icon_classes = {}
|
9
|
+
@scope_filters = {}
|
9
10
|
end
|
10
11
|
|
11
12
|
def user_class
|
@@ -21,6 +22,10 @@ module GraphStarter
|
|
21
22
|
if !@icon_classes.is_a?(Hash)
|
22
23
|
errors[:icon_classes] = 'should be a Hash'
|
23
24
|
end
|
25
|
+
|
26
|
+
if !@scope_filters.is_a?(Hash)
|
27
|
+
errors[:scope_filters] = 'should be a Hash'
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph_starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|