jgm-cloudlib 0.3.2 → 0.3.3
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.
- data/bin/cloudlib-web +16 -6
- data/cloudlib.gemspec +1 -1
- metadata +1 -1
data/bin/cloudlib-web
CHANGED
@@ -44,6 +44,7 @@ post '/' do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
get '/upload' do
|
47
|
+
@error = params[:error]
|
47
48
|
haml :upload
|
48
49
|
end
|
49
50
|
|
@@ -51,11 +52,16 @@ post '/upload' do
|
|
51
52
|
tempfile = params[:fileToUpload][:tempfile]
|
52
53
|
tempfilepath = tempfile.path
|
53
54
|
tempfile.close
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
origname = params[:fileToUpload][:filename] || ""
|
56
|
+
if origname == ""
|
57
|
+
redirect "/upload?error=Please+select+a+file+to+upload."
|
58
|
+
else
|
59
|
+
entry = Cloudlib::Entry.from_file(tempfilepath, params[:fileToUpload][:filename])
|
60
|
+
FileUtils.rm tempfilepath
|
61
|
+
set_attributes_from_form(entry)
|
62
|
+
entry.save
|
63
|
+
redirect "/"
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
get '/*/bibtex' do
|
@@ -148,6 +154,8 @@ __END__
|
|
148
154
|
|
149
155
|
@@ upload
|
150
156
|
%form{:method => 'POST', :action => '/upload', :enctype => 'multipart/form-data'}
|
157
|
+
%p.error
|
158
|
+
= @error
|
151
159
|
%label Select file to upload:
|
152
160
|
%br
|
153
161
|
%input{:type => 'file', :name => 'fileToUpload', :size => 40}
|
@@ -203,4 +211,6 @@ li
|
|
203
211
|
padding-top: 1em
|
204
212
|
font-size: x-small
|
205
213
|
text-align: center
|
206
|
-
|
214
|
+
p.error
|
215
|
+
color: red
|
216
|
+
font-weight: bold
|
data/cloudlib.gemspec
CHANGED