imagegallery2017 0.1.1 → 0.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/imagegallery2017.rb +40 -37
- data.tar.gz.sig +3 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29107fdce25855a5f8ce1db51c16cbe85a3e2ebc
|
4
|
+
data.tar.gz: 585b92d6c8352b86a906d54c70e7309236910384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd20eca9e762dc3d524a980834bcec486ea365d3e84d6361f2531ece1de5e06101409c19e83842d3dbbff1de1d212edde1d72113287808ea754b6f4eccd79b3a
|
7
|
+
data.tar.gz: a235bbbf12e296b916e52f4832d4a5e9cfb733ab93508d43b7c65bf71687f2d5446aa23505a1c026ca9fb311eabdadd2e22f9c797ff1032ac2d534f0af52e84b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/imagegallery2017.rb
CHANGED
@@ -18,47 +18,37 @@ class ImageGallery2017
|
|
18
18
|
|
19
19
|
attr_reader :folder
|
20
20
|
|
21
|
-
def initialize(rsc, filepath: '.', xslfile: 'index.xslt',
|
22
|
-
schema:
|
21
|
+
def initialize(rsc, filepath: '.', xslfile: '../xsl/index.xslt',
|
22
|
+
schema: 'images[title, folder]/image(original, desktop, preview, ' +
|
23
|
+
'folder, imgcount, title)', folder: nil)
|
23
24
|
|
24
|
-
@rsc = rsc
|
25
|
-
@wwwpath = File.join(filepath, 'www')
|
26
|
-
@xslfile = xslfile
|
27
|
-
|
28
|
-
@folder = ''
|
25
|
+
@rsc, @wwwpath, @xslfile = [rsc, File.join(filepath, 'www'), xslfile]
|
29
26
|
|
30
27
|
a = [@wwwpath, 'images']
|
31
|
-
|
32
|
-
if title then
|
33
|
-
|
34
|
-
@folder = title.downcase.gsub(/\W/,'-').gsub(/-{2,}/,'-')\
|
35
|
-
.gsub(/^-|-$/,'')
|
36
|
-
|
37
|
-
a << @folder
|
38
|
-
|
39
|
-
end
|
28
|
+
a << folder if folder
|
40
29
|
|
41
30
|
@imagespath = File.join(*a)
|
42
31
|
|
43
32
|
FileUtils.mkdir_p @imagespath
|
44
33
|
|
45
34
|
dxfilepath = File.join(@imagespath, 'dynarex.xml')
|
46
|
-
|
47
|
-
if
|
35
|
+
|
36
|
+
if File.exists? dxfilepath then
|
37
|
+
super(dxfilepath)
|
38
|
+
else
|
48
39
|
|
49
40
|
super(schema)
|
50
41
|
self.order = :descending
|
51
|
-
self.title =
|
52
|
-
self.
|
42
|
+
self.title = 'Image gallery'
|
43
|
+
self.xslt = xslfile
|
44
|
+
|
53
45
|
self.save dxfilepath
|
54
46
|
|
55
|
-
else
|
56
|
-
super(dxfilepath)
|
57
47
|
end
|
58
48
|
|
59
49
|
end
|
60
50
|
|
61
|
-
def
|
51
|
+
def add_image(uploaded=nil)
|
62
52
|
|
63
53
|
filename = uploaded[:filename]
|
64
54
|
file = File.join(@imagespath, filename)
|
@@ -72,12 +62,13 @@ class ImageGallery2017
|
|
72
62
|
|
73
63
|
self.create(h)
|
74
64
|
self.save
|
65
|
+
|
75
66
|
end
|
76
67
|
|
77
68
|
def render()
|
78
69
|
|
79
70
|
doc = Nokogiri::XML(self.to_xml)
|
80
|
-
xslt = Nokogiri::XSLT(File.read(File.join(@wwwpath, @
|
71
|
+
xslt = Nokogiri::XSLT(File.read(File.join(@wwwpath, @xslt)))
|
81
72
|
xslt.transform(doc).to_s
|
82
73
|
|
83
74
|
end
|
@@ -90,15 +81,10 @@ class ImageGallery2017
|
|
90
81
|
|
91
82
|
FileUtils.mkdir_p File.join(filepath, 'www','images')
|
92
83
|
FileUtils.mkdir_p File.join(filepath, 'www','xsl')
|
93
|
-
super(rsc, filepath: filepath
|
94
|
-
'(original, desktop, preview, path, imgcount, title)')
|
84
|
+
super(rsc, filepath: filepath)
|
95
85
|
|
96
86
|
end
|
97
87
|
|
98
|
-
def modify_entry(id)
|
99
|
-
#self.find_by_id()
|
100
|
-
end
|
101
|
-
|
102
88
|
def render()
|
103
89
|
|
104
90
|
File.write File.join(@wwwpath, 'index.html'), super()
|
@@ -114,21 +100,38 @@ class ImageGallery2017
|
|
114
100
|
@basepath, @rsc = basepath, rsc
|
115
101
|
@index = IndexGallery.new rsc, filepath: @basepath
|
116
102
|
@gallery = {}
|
103
|
+
|
104
|
+
# load all the folders
|
105
|
+
|
106
|
+
@index.all.each do |x|
|
107
|
+
|
108
|
+
if x.folder.length > 0 then
|
109
|
+
@gallery[x.folder] = Gallery.new @rsc,
|
110
|
+
filepath: basepath, folder: x.folder
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
117
114
|
|
118
115
|
end
|
119
116
|
|
120
|
-
def
|
121
|
-
|
117
|
+
def add_image(upload_obj, folder=nil)
|
118
|
+
|
119
|
+
(folder ? @gallery[folder] : @index).add_image upload_obj
|
120
|
+
|
122
121
|
end
|
123
122
|
|
124
123
|
def create_folder(title)
|
125
124
|
|
126
|
-
|
127
|
-
'desktop, preview, title)', filepath: @basepath, title: title,
|
128
|
-
xslfile: 'images.xsl'
|
125
|
+
folder = title.downcase.gsub(/\W/,'-').gsub(/-{2,}/,'-').gsub(/^-|-$/,'')
|
129
126
|
|
130
|
-
|
131
|
-
|
127
|
+
fg = Gallery.new @rsc, filepath: @basepath, xslfile: '../xsl/images.xsl',
|
128
|
+
folder: folder
|
129
|
+
fg.title = title
|
130
|
+
fg.summary[:folder] = folder
|
131
|
+
fg.save
|
132
|
+
|
133
|
+
@gallery[folder] = fg
|
134
|
+
@index.create preview: '../svg/folder.svg', folder: folder, title: title
|
132
135
|
@index.save
|
133
136
|
|
134
137
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
��
|
2
|
-
|
1
|
+
cl���h:���30�2��g�F���$��+��2��7���M���j�/���ƪ�'D,qjvO�&�L�Mo���{�p::O�$"R[�$�b�S�!�Ū�9��~غ����4
|
2
|
+
�{�^�Sڇ�g'���6$��vÞ��_G�踰�
|
3
|
+
l��U���h�N�� =�v�W��V�Iĺ;l����Y6b$wP;?���,� ����v�2�r����_-)�X�[q
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagegallery2017
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
VTkGIYZRz9NszbK5QM45fZIG1TtUO/QILU1lyb56RusdsPUAQy5qdHcWSkqbU1i4
|
32
32
|
pVP5LTt/M0l+og==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-11-
|
34
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex
|
metadata.gz.sig
CHANGED
Binary file
|