@@ -91,6 +91,14 @@ if Meteor.isClient
91
91
# ####################
92
92
# UI template helpers
93
93
94
+ shorten = (name , w = 16 ) ->
95
+ w++ if w % 2
96
+ w = (w- 2 )/ 2
97
+ if name .length > w
98
+ name[0 .. w] + ' ...' + name[- w- 1 .. - 1 ]
99
+ else
100
+ name
101
+
94
102
Template .top .helpers
95
103
loginToken : () ->
96
104
Meteor .userId ()
@@ -109,12 +117,7 @@ if Meteor.isClient
109
117
" #{ this ._id } "
110
118
111
119
shortFilename : (w = 16 ) ->
112
- w++ if w % 2
113
- w = (w- 2 )/ 2
114
- if this .filename .length > w
115
- this .filename [0 .. w] + ' ...' + this .filename [- w- 1 .. - 1 ]
116
- else
117
- this .filename
120
+ shorten this .filename , w
118
121
119
122
uploadStatus : () ->
120
123
percent = Session .get " #{ this ._id } "
@@ -132,6 +135,12 @@ if Meteor.isClient
132
135
isImage : () ->
133
136
imageTypes[this .contentType ]?
134
137
138
+ altMessage : () ->
139
+ if this .length isnt 0
140
+ " Processing thumbnail of #{ shorten this .filename , 20 } ..."
141
+ else
142
+ " Uploading #{ shorten this .filename , 20 } ..."
143
+
135
144
fileTableEvents =
136
145
# Wire up the event to remove a file by clicking the `X`
137
146
' click .del-file ' : (e , t ) ->
@@ -141,7 +150,7 @@ if Meteor.isClient
141
150
142
151
Template .gallery .dataEntries = () ->
143
152
# Reactively populate the table
144
- this .find ({ ' metadata.thumb ' : { $exists : true }})
153
+ this .find ({' metadata.thumbOf ' : {$exists : false }}, { sort : { filename : 1 }})
145
154
146
155
Template .gallery .thumb = () ->
147
156
" #{ this .metadata .thumb } "
@@ -159,7 +168,7 @@ if Meteor.isClient
159
168
Template .fileTable .helpers fileTableHelpers
160
169
Template .fileTable .dataEntries = () ->
161
170
# Reactively populate the table
162
- this .find ({})
171
+ this .find ({}, { sort : { filename : 1 }} )
163
172
164
173
Template .fileTable .events fileTableEvents
165
174
@@ -193,7 +202,6 @@ if Meteor.isClient
193
202
194
203
jobTableHelpers =
195
204
jobEntries : () ->
196
- console .log " jobEntries" , this
197
205
# Reactively populate the table
198
206
this .find ({})
199
207
@@ -218,13 +226,13 @@ if Meteor.isClient
218
226
}[this .status ]
219
227
220
228
numRepeats : () ->
221
- if this .repeats > Math . pow 2 , 31
229
+ if this .repeats is parent . Forever
222
230
" ∞"
223
231
else
224
232
this .repeats
225
233
226
234
numRetries : () ->
227
- if this .retries > Math . pow 2 , 31
235
+ if this .retries is parent . Forever
228
236
" ∞"
229
237
else
230
238
this .retries
@@ -485,7 +493,7 @@ if Meteor.isServer
485
493
job .progress 20 , 100
486
494
487
495
gm (inStream)
488
- .resize (250 , 250 )
496
+ .resize (150 , 150 )
489
497
.stream (' png' )
490
498
.pipe (outStream, (err ) ->
491
499
console .warn ' Error running graphicsmagick:' , err
0 commit comments