glebtv-rails-uploader 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d583687777e18cb84615643e8d052d340b42fc2
4
- data.tar.gz: 736689da394ccc26adb783a08ba1914f1a196a29
3
+ metadata.gz: 1e79bc5b85eca7ab9c8fed7585c566aeddec72d4
4
+ data.tar.gz: 3cfd33ff72b4095731336ad99ed1b7c32b27d010
5
5
  SHA512:
6
- metadata.gz: 93268c2f5c15e9c184e389174e309dae458ddb0c776063e6cbc8f54d3b74e6ea78811e1bbc42719e3ad7063908a341a6ecf2c0eb0c7c0b1381c6e888c76cc96d
7
- data.tar.gz: 19d7de68f7c36612dfcd58b3a195eab73787e3d6ef609b8ed084294fec1331b2da9ae441dac35aadfeb291f8eae8d25ecb308d253c2bdfea059332342b9c6ed7
6
+ metadata.gz: 4ce5c29e0e93c3374102d220436c4fb6a291b2f46d9b99dd59092bea35b8b46bc876d6e057c8e374d652dfde84cd791be5bc6ff31cea9e3db0feafe5d027bccd
7
+ data.tar.gz: d9b1ca0dea6ef34755a979fd533c9fc0e4d16f978559e814e8383b6adc69d4b0cdd0ca4902e7574f82a8be5a34f2e9fb1c63b920dd20941982f142fb14a22115
data/README.md CHANGED
@@ -38,13 +38,14 @@ mount Uploader::Engine => '/uploader'
38
38
  field :guid, type: String
39
39
  belongs_to :assetable, polymorphic: true
40
40
 
41
- # this workaround is sometimes needed so IDs are ObjectIDs not strings before_save do
42
- if !assetable_id.blank? && !assetable_id.class.name == "Moped::BSON::ObjectId" && Moped::BSON::ObjectId.legal?(assetable_id)
43
- self.assetable_id = Moped::BSON::ObjectId.from_string(assetable_id)
41
+ # this workaround is sometimes needed so IDs are ObjectIDs not strings
42
+ before_save do
43
+ if !assetable_id.blank? && assetable_id.class.name != "Moped::BSON::ObjectId" && Moped::BSON::ObjectId.legal?(assetable_id)
44
+ self.assetable_id = Moped::BSON::ObjectId.from_string(assetable_id)
45
+ end
46
+ true
44
47
  end
45
- true
46
48
  end
47
- end
48
49
  ```
49
50
 
50
51
  ### Your asset model
@@ -67,12 +68,12 @@ mount Uploader::Engine => '/uploader'
67
68
  }
68
69
 
69
70
  def to_jq_upload
70
- [{
71
+ {
71
72
  'id' => id.to_s,
72
73
  "filename" => File.basename(data.path),
73
74
  "url" => data.url,
74
75
  'thumb_url' => data.thumb.url,
75
- }]
76
+ }
76
77
  end
77
78
  end
78
79
  ```
@@ -204,6 +205,7 @@ Find asset by foreign key or guid:
204
205
  Javascripts:
205
206
 
206
207
  ``` ruby
208
+ //= require jquery.ui.widget
207
209
  //= require uploader/application
208
210
  ```
209
211
 
@@ -1,9 +1,9 @@
1
- //= require uploader/locales/en
2
1
  //= require uploader/tmpl
2
+ //= require uploader/canvas-to-blob
3
3
  //= require uploader/load-image
4
- //= require uploader/jquery.ui.widget
5
- //= require uploader/jquery.iframe-transport
6
4
  //= require uploader/jquery.fileupload
5
+ //= require uploader/jquery.fileupload-process
6
+ //= require uploader/jquery.fileupload-resize
7
+ //= require uploader/jquery.fileupload-validate
7
8
  //= require uploader/jquery.fileupload-ui
8
9
 
9
-
@@ -56,7 +56,7 @@
56
56
 
57
57
  <% if field.exists? -%>
58
58
  <% fv = field.values.map { |v| v.respond_to?(:to_jq_upload) ? v.to_jq_upload : v } %>
59
- $(this).data("fileupload")
59
+ $(this).data().blueimpFileupload
60
60
  ._renderDownload(<%=raw fv.to_json(:root => false) %>)
61
61
  .appendTo(container);
62
62
  <% end -%>
@@ -40,6 +40,7 @@ module Uploader
40
40
  def fileupload_update(record_id, guid, method)
41
41
  query = fileupload_klass(method).where(:guid => guid, :assetable_type => base_class.name.to_s)
42
42
  record_id = Moped::BSON::ObjectId.from_string(record_id) unless record_id.class.name == "Moped::BSON::ObjectId"
43
+ p record_id
43
44
  query.update_all(:assetable_id => record_id, :guid => nil)
44
45
  end
45
46
 
@@ -1,3 +1,3 @@
1
1
  module Uploader
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebtv-rails-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GlebTv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -143,96 +143,96 @@ extensions: []
143
143
  extra_rdoc_files:
144
144
  - README.md
145
145
  files:
146
- - app/views/rails_admin/main/_form_rails_uploader.haml
147
- - app/views/uploader/default/_container.html.erb
148
- - app/views/uploader/default/_upload.html.erb
149
- - app/views/uploader/default/_download.html.erb
150
146
  - app/controllers/uploader/attachments_controller.rb
147
+ - app/assets/images/uploader/progressBarFillBg.png
148
+ - app/assets/images/uploader/ico_attach.png
149
+ - app/assets/images/uploader/but_del_tag2.png
150
+ - app/assets/images/uploader/preloader.gif
151
+ - app/assets/javascripts/uploader/jquery.fileupload-ui.js
152
+ - app/assets/javascripts/uploader/jquery.fileupload-validate.js
153
+ - app/assets/javascripts/uploader/jquery.ui.widget.js
154
+ - app/assets/javascripts/uploader/application.js
151
155
  - app/assets/javascripts/uploader/load-image.js
152
- - app/assets/javascripts/uploader/jquery.iframe-transport.js
153
156
  - app/assets/javascripts/uploader/jquery.fileupload.js
154
- - app/assets/javascripts/uploader/rails_admin.js
155
- - app/assets/javascripts/uploader/jquery.ui.widget.js
157
+ - app/assets/javascripts/uploader/locales/ru.js
158
+ - app/assets/javascripts/uploader/locales/uk.js
159
+ - app/assets/javascripts/uploader/locales/en.js
160
+ - app/assets/javascripts/uploader/canvas-to-blob.js
156
161
  - app/assets/javascripts/uploader/tmpl.js
157
- - app/assets/javascripts/uploader/jquery.fileupload-ui.js
158
- - app/assets/javascripts/uploader/jquery.fileupload-validate.js
162
+ - app/assets/javascripts/uploader/rails_admin.js
159
163
  - app/assets/javascripts/uploader/jquery.fileupload-angular.js
160
164
  - app/assets/javascripts/uploader/jquery.fileupload-process.js
161
- - app/assets/javascripts/uploader/locales/ru.js
162
- - app/assets/javascripts/uploader/locales/en.js
163
- - app/assets/javascripts/uploader/locales/uk.js
164
165
  - app/assets/javascripts/uploader/jquery.fileupload-resize.js
165
- - app/assets/javascripts/uploader/canvas-to-blob.js
166
- - app/assets/javascripts/uploader/application.js
167
- - app/assets/images/uploader/ico_attach.png
168
- - app/assets/images/uploader/preloader.gif
169
- - app/assets/images/uploader/progressBarFillBg.png
170
- - app/assets/images/uploader/but_del_tag2.png
171
- - app/assets/stylesheets/uploader/jquery.fileupload-ui.css
166
+ - app/assets/javascripts/uploader/jquery.iframe-transport.js
172
167
  - app/assets/stylesheets/uploader/application.css
173
168
  - app/assets/stylesheets/uploader/default.css
174
- - lib/glebtv-rails-uploader.rb
169
+ - app/assets/stylesheets/uploader/jquery.fileupload-ui.css
170
+ - app/views/rails_admin/main/_form_rails_uploader.haml
171
+ - app/views/uploader/default/_container.html.erb
172
+ - app/views/uploader/default/_download.html.erb
173
+ - app/views/uploader/default/_upload.html.erb
175
174
  - lib/file_size_validator.rb
175
+ - lib/glebtv-rails-uploader.rb
176
176
  - lib/uploader.rb
177
- - lib/uploader/version.rb
178
- - lib/uploader/helpers/form_tag_helper.rb
179
177
  - lib/uploader/helpers/form_builder.rb
178
+ - lib/uploader/helpers/form_tag_helper.rb
180
179
  - lib/uploader/helpers/field_tag.rb
181
- - lib/uploader/hooks/simple_form.rb
182
- - lib/uploader/hooks/formtastic.rb
183
- - lib/uploader/hooks/active_record.rb
184
- - lib/uploader/asset.rb
185
- - lib/uploader/rails_admin/field.rb
186
180
  - lib/uploader/fileuploads.rb
181
+ - lib/uploader/version.rb
187
182
  - lib/uploader/engine.rb
188
- - config/routes.rb
189
- - config/locales/ru.yml
190
- - config/locales/en.yml
183
+ - lib/uploader/asset.rb
184
+ - lib/uploader/rails_admin/field.rb
185
+ - lib/uploader/hooks/active_record.rb
186
+ - lib/uploader/hooks/simple_form.rb
187
+ - lib/uploader/hooks/formtastic.rb
191
188
  - config/locales/uk.yml
189
+ - config/locales/en.yml
190
+ - config/locales/ru.yml
191
+ - config/routes.rb
192
192
  - MIT-LICENSE
193
193
  - Rakefile
194
194
  - README.md
195
- - spec/requests/attachments_controller_spec.rb
196
- - spec/spec_helper.rb
197
- - spec/fileuploads_spec.rb
198
- - spec/factories/assets.rb
199
- - spec/factories/articles.rb
200
- - spec/factories/files/rails.png
201
- - spec/uploader_spec.rb
202
- - spec/dummy/script/rails
203
- - spec/dummy/public/404.html
195
+ - spec/dummy/Rakefile
196
+ - spec/dummy/db/migrate/20120508093830_create_articles.rb
197
+ - spec/dummy/db/migrate/20120508093416_create_assets.rb
204
198
  - spec/dummy/public/422.html
205
- - spec/dummy/public/500.html
199
+ - spec/dummy/public/404.html
206
200
  - spec/dummy/public/favicon.ico
207
- - spec/dummy/app/uploaders/picture_uploader.rb
201
+ - spec/dummy/public/500.html
202
+ - spec/dummy/README.rdoc
203
+ - spec/dummy/config/database.yml
204
+ - spec/dummy/config/boot.rb
205
+ - spec/dummy/config/environment.rb
206
+ - spec/dummy/config/locales/en.yml
207
+ - spec/dummy/config/application.rb
208
+ - spec/dummy/config/initializers/wrap_parameters.rb
209
+ - spec/dummy/config/initializers/session_store.rb
210
+ - spec/dummy/config/initializers/inflections.rb
211
+ - spec/dummy/config/initializers/secret_token.rb
212
+ - spec/dummy/config/initializers/backtrace_silencers.rb
213
+ - spec/dummy/config/initializers/mime_types.rb
214
+ - spec/dummy/config/environments/development.rb
215
+ - spec/dummy/config/environments/production.rb
216
+ - spec/dummy/config/environments/test.rb
217
+ - spec/dummy/config/routes.rb
218
+ - spec/dummy/script/rails
208
219
  - spec/dummy/app/helpers/application_helper.rb
209
- - spec/dummy/app/views/layouts/application.html.erb
210
220
  - spec/dummy/app/controllers/application_controller.rb
211
- - spec/dummy/app/models/picture.rb
212
- - spec/dummy/app/models/asset.rb
213
- - spec/dummy/app/models/article.rb
214
221
  - spec/dummy/app/assets/javascripts/application.js
215
222
  - spec/dummy/app/assets/stylesheets/application.css
216
- - spec/dummy/db/migrate/20120508093830_create_articles.rb
217
- - spec/dummy/db/migrate/20120508093416_create_assets.rb
223
+ - spec/dummy/app/models/article.rb
224
+ - spec/dummy/app/models/asset.rb
225
+ - spec/dummy/app/models/picture.rb
226
+ - spec/dummy/app/uploaders/picture_uploader.rb
227
+ - spec/dummy/app/views/layouts/application.html.erb
218
228
  - spec/dummy/config.ru
219
- - spec/dummy/config/routes.rb
220
- - spec/dummy/config/application.rb
221
- - spec/dummy/config/initializers/mime_types.rb
222
- - spec/dummy/config/initializers/inflections.rb
223
- - spec/dummy/config/initializers/backtrace_silencers.rb
224
- - spec/dummy/config/initializers/session_store.rb
225
- - spec/dummy/config/initializers/secret_token.rb
226
- - spec/dummy/config/initializers/wrap_parameters.rb
227
- - spec/dummy/config/locales/en.yml
228
- - spec/dummy/config/database.yml
229
- - spec/dummy/config/environments/test.rb
230
- - spec/dummy/config/environments/production.rb
231
- - spec/dummy/config/environments/development.rb
232
- - spec/dummy/config/boot.rb
233
- - spec/dummy/config/environment.rb
234
- - spec/dummy/README.rdoc
235
- - spec/dummy/Rakefile
229
+ - spec/requests/attachments_controller_spec.rb
230
+ - spec/uploader_spec.rb
231
+ - spec/fileuploads_spec.rb
232
+ - spec/spec_helper.rb
233
+ - spec/factories/assets.rb
234
+ - spec/factories/files/rails.png
235
+ - spec/factories/articles.rb
236
236
  homepage: https://github.com/glebtv/rails-uploader
237
237
  licenses: []
238
238
  metadata: {}
@@ -252,49 +252,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  version: '0'
253
253
  requirements: []
254
254
  rubyforge_project: rails-uploader
255
- rubygems_version: 2.0.3
255
+ rubygems_version: 2.0.6
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Rails file upload implementation with jQuery-File-Upload
259
259
  test_files:
260
- - spec/requests/attachments_controller_spec.rb
261
- - spec/spec_helper.rb
262
- - spec/fileuploads_spec.rb
263
- - spec/factories/assets.rb
264
- - spec/factories/articles.rb
265
- - spec/factories/files/rails.png
266
- - spec/uploader_spec.rb
267
- - spec/dummy/script/rails
268
- - spec/dummy/public/404.html
260
+ - spec/dummy/Rakefile
261
+ - spec/dummy/db/migrate/20120508093830_create_articles.rb
262
+ - spec/dummy/db/migrate/20120508093416_create_assets.rb
269
263
  - spec/dummy/public/422.html
270
- - spec/dummy/public/500.html
264
+ - spec/dummy/public/404.html
271
265
  - spec/dummy/public/favicon.ico
272
- - spec/dummy/app/uploaders/picture_uploader.rb
266
+ - spec/dummy/public/500.html
267
+ - spec/dummy/README.rdoc
268
+ - spec/dummy/config/database.yml
269
+ - spec/dummy/config/boot.rb
270
+ - spec/dummy/config/environment.rb
271
+ - spec/dummy/config/locales/en.yml
272
+ - spec/dummy/config/application.rb
273
+ - spec/dummy/config/initializers/wrap_parameters.rb
274
+ - spec/dummy/config/initializers/session_store.rb
275
+ - spec/dummy/config/initializers/inflections.rb
276
+ - spec/dummy/config/initializers/secret_token.rb
277
+ - spec/dummy/config/initializers/backtrace_silencers.rb
278
+ - spec/dummy/config/initializers/mime_types.rb
279
+ - spec/dummy/config/environments/development.rb
280
+ - spec/dummy/config/environments/production.rb
281
+ - spec/dummy/config/environments/test.rb
282
+ - spec/dummy/config/routes.rb
283
+ - spec/dummy/script/rails
273
284
  - spec/dummy/app/helpers/application_helper.rb
274
- - spec/dummy/app/views/layouts/application.html.erb
275
285
  - spec/dummy/app/controllers/application_controller.rb
276
- - spec/dummy/app/models/picture.rb
277
- - spec/dummy/app/models/asset.rb
278
- - spec/dummy/app/models/article.rb
279
286
  - spec/dummy/app/assets/javascripts/application.js
280
287
  - spec/dummy/app/assets/stylesheets/application.css
281
- - spec/dummy/db/migrate/20120508093830_create_articles.rb
282
- - spec/dummy/db/migrate/20120508093416_create_assets.rb
288
+ - spec/dummy/app/models/article.rb
289
+ - spec/dummy/app/models/asset.rb
290
+ - spec/dummy/app/models/picture.rb
291
+ - spec/dummy/app/uploaders/picture_uploader.rb
292
+ - spec/dummy/app/views/layouts/application.html.erb
283
293
  - spec/dummy/config.ru
284
- - spec/dummy/config/routes.rb
285
- - spec/dummy/config/application.rb
286
- - spec/dummy/config/initializers/mime_types.rb
287
- - spec/dummy/config/initializers/inflections.rb
288
- - spec/dummy/config/initializers/backtrace_silencers.rb
289
- - spec/dummy/config/initializers/session_store.rb
290
- - spec/dummy/config/initializers/secret_token.rb
291
- - spec/dummy/config/initializers/wrap_parameters.rb
292
- - spec/dummy/config/locales/en.yml
293
- - spec/dummy/config/database.yml
294
- - spec/dummy/config/environments/test.rb
295
- - spec/dummy/config/environments/production.rb
296
- - spec/dummy/config/environments/development.rb
297
- - spec/dummy/config/boot.rb
298
- - spec/dummy/config/environment.rb
299
- - spec/dummy/README.rdoc
300
- - spec/dummy/Rakefile
294
+ - spec/requests/attachments_controller_spec.rb
295
+ - spec/uploader_spec.rb
296
+ - spec/fileuploads_spec.rb
297
+ - spec/spec_helper.rb
298
+ - spec/factories/assets.rb
299
+ - spec/factories/files/rails.png
300
+ - spec/factories/articles.rb