graph_starter 0.9.1 → 0.9.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
  SHA1:
3
- metadata.gz: c2d8931782640148547bdcff51e7b45db7cefd99
4
- data.tar.gz: d61edf2f01857f3288679b85be49116b00381e57
3
+ metadata.gz: 53c9a32b3cbb8e38d7fe5f4c22d8527467e0b7f4
4
+ data.tar.gz: 6f14b707978baa388f539620d7fc6777c38d9948
5
5
  SHA512:
6
- metadata.gz: 5c89014834ba89fc372b9fbfb6ebab6d47d13a7427a6eb6d92bb9f4a8533fe7ba3d37848a8f302010f57cc1ca15578142c6b69c8c50b2808ffce345177c7122d
7
- data.tar.gz: a8f709580f59a75d6f3145e673d50a0e4eb855cf869dfe8a5001f825277277ca9f9865f93b3adcf914fb084d1075db4edb75a375612c062ba497ddb42733d56e
6
+ metadata.gz: 2ad7fed5e72ffe6f2f494534cc818c73d9cc3dfe50ec78c04dcb34d27344282ed186bd5f813662ecce92dde31fdfad36ca5329b1cac4ea4b9803ab79091af7ac
7
+ data.tar.gz: 55fe1204a0e1a7dad5d32b1a07bc936eb93981da47b1771e531e9974bc1f32adbd47f673a8de6bd4398590046b854a2d4057ec9203d3ed160a5f44833778824e
@@ -35,7 +35,7 @@ module GraphStarter
35
35
  def asset_set(var = :asset, limit = 50)
36
36
  associations = []
37
37
  associations << model_class.image_association
38
- associations << model_class.category_association
38
+ associations += model_class.category_associations
39
39
  associations.compact!
40
40
 
41
41
  scope = model_class_scope(var)
@@ -68,20 +68,24 @@ module GraphStarter
68
68
  first_image && first_image.source_url
69
69
  end
70
70
 
71
- def self.category_association(association_name = nil)
72
- if association_name.nil?
73
- @category_association
71
+ def self.category_associations(*association_names)
72
+ if association_names.empty?
73
+ @category_associations || []
74
74
  else
75
- fail "Cannot declare category_association twice" if @category_association.present?
76
- name = association_name.to_sym
77
- fail ArgumentError, "Association #{name} is not defined" if associations[name].nil?
78
- @category_association = name
75
+ fail "Cannot declare category_associations twice" if @category_associations.present?
76
+ names = association_names.map(&:to_sym)
77
+ bad_names = names.select {|name| associations[name].nil? }
78
+ fail ArgumentError, "Associations #{bad_names.join(', ')} is not defined" if !bad_names.empty?
79
+
80
+ @category_associations = names
79
81
  end
80
82
  end
81
83
 
82
84
  def categories
83
- if self.class.category_association
84
- send(self.class.category_association)
85
+ if self.class.category_associations
86
+ self.class.category_associations.flat_map do |category_association|
87
+ send(category_association)
88
+ end.compact
85
89
  else
86
90
  []
87
91
  end
@@ -23,15 +23,17 @@
23
23
  - categories = Array(asset.categories).sort_by(&:name)
24
24
  - if categories.present?
25
25
  .content
26
- - categories[0,2].each do |category|
27
- .extra.content
28
- - if (category.class.has_images? || category.class.has_image?) && category.first_image_source_url.present?
29
- = image_tag category.first_image_source_url, class: 'ui avatar image'
30
- - else
31
- i class="#{category.class.icon_class || 'folder'} icon"
32
- = link_to category.name, asset_path(category)
33
- - if categories.size > 2
34
- .extra.content
35
- i.ellipsis.horizontal.icon
36
- | more categories
26
+ .ui.relaxed.divided.list
27
+ - categories[0,2].each do |category|
28
+ .item
29
+ - if (category.class.has_images? || category.class.has_image?) && category.first_image_source_url.present?
30
+ = image_tag category.first_image_source_url, class: 'ui avatar image'
31
+ - else
32
+ i class="#{category.class.icon_class || 'folder'} large icon"
33
+ .content
34
+ = link_to category.name, asset_path(category)
35
+ - if categories.size > 2
36
+ .item
37
+ i.ellipsis.horizontal.large.icon
38
+ .content more categories
37
39
 
@@ -1,3 +1,3 @@
1
1
  module GraphStarter
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
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.9.1
4
+ version: 0.9.2
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-05 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails