graph_starter 0.6.4 → 0.7.0

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
  SHA1:
3
- metadata.gz: 607af2e39ee8bab6805a2ddbe049eae9e2ef60ae
4
- data.tar.gz: bd9ab7766e43b64d055f9c782e03c289c6db9f7b
3
+ metadata.gz: 95f03dfb7ac0e8f3252c7bf329d58658f174429a
4
+ data.tar.gz: 9aeb034501d432cb989fbd0209f0eeb0c8bce5d3
5
5
  SHA512:
6
- metadata.gz: 09a163db74319019480d65cbd712146aa745ab4094d3b56cbb22a42209e029216fa36f001a48e6621de44b15a85bca872aef667ad87f1744acc0bdb5b47b60bd
7
- data.tar.gz: 85acb28502748349cd67f66f0e3294d543b2cb53b119047f2a973374ab08da6ba52cf5ef3a4f991c5755eb21aad2ea165566facb5e1cfa8dc359894593e2f54d
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
- scope.query_as(var).with(var).proxy_as(model_class, var).with_associations(*associations)
47
- else
48
- scope
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
@@ -16,10 +16,6 @@ module GraphStarter
16
16
  render partial: partial_path, locals: {asset: asset}
17
17
  end
18
18
 
19
- def config
20
- GraphStarter::CONFIG
21
- end
22
-
23
19
  def present_asset(object)
24
20
  yield(AssetPresenter.new(object, self)) if block_given?
25
21
  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
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.6.4"
2
+ VERSION = "0.7.0"
3
3
  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.6.4
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-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails