dhole 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dhole/category.rb +10 -4
- data/lib/dhole/page.rb +4 -0
- data/lib/dhole/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fad7982921bbd52b8f4aee1acabaa8dc5025100e
|
4
|
+
data.tar.gz: a906701d7c62cca0e2c216fbf9f17390576ec0d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97461fe302094a913cf53bda2192e39a1560c44b7ee194cf3767ba94f360ac07a0f949e13a4ef2516775530de5090385760ebcd05ff394d0cdad74c18aaac133
|
7
|
+
data.tar.gz: 13ccc3876363e39f24960a35e703ca7ef5c2f8c088f9aa400a914197221878eddaa6c8de143712e5cc61022b3b63a268ac0ab47797ce484fddda5bf4fd594f27
|
data/lib/dhole/category.rb
CHANGED
@@ -8,16 +8,22 @@ module Dhole
|
|
8
8
|
CategoryLink.where(cl_to: cat_title) || []
|
9
9
|
end
|
10
10
|
def member_page_titles
|
11
|
-
members.select{|cl| cl.cl_type == 'page'}.map
|
11
|
+
page_ids = members.select{|cl| cl.cl_type == 'page'}.map(&:cl_from)
|
12
|
+
Page.find(page_ids).map(&:page_title)
|
12
13
|
end
|
13
14
|
def member_file_titles
|
14
|
-
members.select{|cl| cl.cl_type == 'file'}.map
|
15
|
+
file_page_ids = members.select{|cl| cl.cl_type == 'file'}.map(&:cl_from)
|
16
|
+
Page.find(file_page_ids).map(&:page_title) # img_name == page_title
|
15
17
|
end
|
18
|
+
# careful! mass instantiation!
|
16
19
|
def member_pages
|
17
|
-
members.select{|cl| cl.cl_type == 'page'}.map
|
20
|
+
page_ids = members.select{|cl| cl.cl_type == 'page'}.map(&:cl_from)
|
21
|
+
Page.find(page_ids)
|
18
22
|
end
|
23
|
+
# careful! mass instantiation!
|
19
24
|
def member_files
|
20
|
-
|
25
|
+
file_titles = members_file_titles
|
26
|
+
Image.find(file_titles)
|
21
27
|
end
|
22
28
|
# return only members of specified type ('file','page', 'subcat')
|
23
29
|
def members_by_type(mtype)
|
data/lib/dhole/page.rb
CHANGED
@@ -7,5 +7,9 @@ module Dhole
|
|
7
7
|
has_many :imagelinks, class_name: 'ImageLink', foreign_key: 'il_from'
|
8
8
|
#has_many :images, through: :imagelinks, class_name: 'Image'
|
9
9
|
belongs_to :latest_revision, class_name: 'Revision', foreign_key: 'page_latest'
|
10
|
+
|
11
|
+
def is_file?
|
12
|
+
page_namespace == 6
|
13
|
+
end
|
10
14
|
end
|
11
15
|
end
|
data/lib/dhole/version.rb
CHANGED