graph_starter 0.9.1 → 0.9.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c9a32b3cbb8e38d7fe5f4c22d8527467e0b7f4
|
4
|
+
data.tar.gz: 6f14b707978baa388f539620d7fc6777c38d9948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
72
|
-
if
|
73
|
-
@
|
71
|
+
def self.category_associations(*association_names)
|
72
|
+
if association_names.empty?
|
73
|
+
@category_associations || []
|
74
74
|
else
|
75
|
-
fail "Cannot declare
|
76
|
-
|
77
|
-
|
78
|
-
|
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.
|
84
|
-
|
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
|
-
|
27
|
-
.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
|
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.
|
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-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|