ish_models 0.0.33.130 → 0.0.33.131
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gameui/map.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6af77beacdc645fcf83ca862c625d2f689279acfe94cc40cc83527f4836578ed
|
4
|
+
data.tar.gz: 5860e90c3029f55d92ab8ff703e21fb5fe2d9bc1d355c68fe1e06be3cc8788c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e88f2506f075b91fd496ce353358123486f9c968abb9e8837e89ef864846b2f054615732222ed4156578c012ab612df31b42d80219c14957f8167c48ad40d386
|
7
|
+
data.tar.gz: f0482b89daa1a5c15569a780ab80f74f07a7504b08cdd13b8844ef4a9a03b0a3927b7e4b5c300e6f19468b6c2f1006e961f041b8eb174a798850faf59593eedf
|
data/lib/gameui/map.rb
CHANGED
@@ -8,10 +8,12 @@ class ::Gameui::Map
|
|
8
8
|
|
9
9
|
field :slug
|
10
10
|
validates :slug, uniqueness: true, presence: true
|
11
|
+
|
11
12
|
field :parent_slug
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
belongs_to :parent, class_name: '::Gameui::Map', inverse_of: :childs, optional: true
|
14
|
+
has_many :childs, class_name: '::Gameui::Map', inverse_of: :parent
|
15
|
+
|
16
|
+
field :name
|
15
17
|
|
16
18
|
field :w, type: Integer
|
17
19
|
validates :w, presence: true
|
@@ -35,4 +37,14 @@ class ::Gameui::Map
|
|
35
37
|
[['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
|
36
38
|
end
|
37
39
|
|
40
|
+
def breadcrumbs
|
41
|
+
out = [{ name: self.name, slug: self.slug, link: false }]
|
42
|
+
p = self.parent
|
43
|
+
while p
|
44
|
+
out.push({ name: p.name, slug: p.slug })
|
45
|
+
p = p.parent
|
46
|
+
end
|
47
|
+
out.reverse
|
48
|
+
end
|
49
|
+
|
38
50
|
end
|