uploadbox 0.0.4 → 0.0.5

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: bde58e89daaa9aaa9c7dd01ef81d9b07281b1adb
4
- data.tar.gz: da4528b93e337d1d0af19ab7efc1af1113aa2aed
3
+ metadata.gz: a662f240833c250a53327176e51bb6062dec9c96
4
+ data.tar.gz: 54283fa644cf50a8e952dcc31117fdc4a8552819
5
5
  SHA512:
6
- metadata.gz: 1d14891638c745bcdc4ef404b79527ed542426e17b47379a6b3aa541c46deec78572ef3c0f4d43df6f72b11cb8cb733e0d3e5fa67d65c52d7f320d02663e5075
7
- data.tar.gz: 32515e040f6aa705d146bac3242c651b62326e8358c733389e2df2a9e80712ef73b864e4b7d9bd929462875a5c4ff5a760d3f2ab3eaeb014220f9f91cc097755
6
+ metadata.gz: 23144c6bfa4c07e8ede2993fb0fb57697c145e5e1a197c131c6cacb401a11d7b5b9a8a4546f85ab632a38dbce07db32b2bb7721f2bba3090d9787f5dfa0aea6b
7
+ data.tar.gz: 948fbf64ea6c9cfc18b0f191fa00660c329b4090111974a11501b920ece07632c357c6dd0d14b3b294a88d437cf446579d30a463ec98d7c9dcb11be7f4349cfd
data/README.md CHANGED
@@ -3,10 +3,14 @@
3
3
  ## Installation
4
4
 
5
5
  Add to Gemfile
6
- `gem 'uploadbox'`
6
+ ```
7
+ gem 'uploadbox'
8
+ ```
7
9
 
8
10
  Run generators
9
- `rails g uploadbox:image`
11
+ ```
12
+ rails g uploadbox:image
13
+ ```
10
14
 
11
15
  Add jquery and uploadbox to `application.js`
12
16
  ```
@@ -23,20 +27,42 @@ Add uploadbox to `application.css`
23
27
  ```
24
28
 
25
29
  Migrate database
26
- `rake db:migrate`
30
+ ```
31
+ rake db:migrate
32
+ ```
27
33
 
28
34
  Update `routes.rb`
29
- `mount Uploadbox::Engine => '/uploadbox', as: :uploadbox`
35
+ ```
36
+ mount Uploadbox::Engine => '/uploadbox', as: :uploadbox
37
+ ```
30
38
 
31
39
  ## Usage
32
40
  Add `uploads_one` to your model
33
- `uploads_one :picture, thumb: [100, 100], regular: [300, 200]`
41
+ ```
42
+ class Post < ActiveRecord::Base
43
+ uploads_one :picture, thumb: [100, 100], regular: [600, 300]
44
+ end
45
+ ```
34
46
 
35
47
  Add field to form
36
- `<%= f.uploader :picture %>`
48
+ ```
49
+ <%= f.uploader :picture %>
50
+ ```
37
51
 
38
52
  Attach upload on controller
39
- `@post.attach_picture(params[:picture_id])`
53
+ ```
54
+ @post.attach_picture(params[:picture_id])
55
+ ```
40
56
 
41
57
  Show image
42
- `<%= img @post.picture.regular if @post.picture? %>`
58
+ ```
59
+ <%= img @post.picture.regular if @post.picture? %>
60
+ ```
61
+
62
+ ## Recreate versions
63
+ You might come to a situation where you want to retroactively change a version or add a new one. You can use the `update_#{upload_name}_versions!` method to recreate the versions from the base file.
64
+ For a post with a picture:
65
+
66
+ ```
67
+ Post.update_picture_versions!
68
+ ```
@@ -6,10 +6,6 @@ module Uploadbox
6
6
  @image = Image.create_upload(image_params)
7
7
  end
8
8
 
9
- def update
10
- @image = Image.create_upload(image_params)
11
- end
12
-
13
9
  def destroy
14
10
  render json: Image.find(params[:id]).destroy
15
11
  end
@@ -10,7 +10,7 @@
10
10
  = img resource.send(upload_name).send(version)
11
11
  - elsif default
12
12
  = image_tag default, width: width, height: height
13
- div
13
+ .fileupload-actions
14
14
  span.btn.btn-file
15
15
  span.fileupload-new = choose_label
16
16
  span.fileupload-exists = update_label
@@ -26,6 +26,12 @@ module Uploadbox
26
26
  end
27
27
  end
28
28
 
29
+ # @post.remote_picture_url=('http://exemple.com/image.jpg')
30
+ define_method("remote_#{upload_name}_url=") do |url|
31
+ upload = Uploadbox.const_get(upload_class_name).create!(remote_file_url: url)
32
+ self.send("#{upload_name}=", upload)
33
+ end
34
+
29
35
  # @post.attach_picture!
30
36
  define_method("attach_#{upload_name}!") do |upload_id|
31
37
  self.send("#{upload_name}=", upload_class.find(upload_id))
@@ -1,3 +1,3 @@
1
1
  module Uploadbox
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio Protzek
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-29 00:00:00.000000000 Z
12
+ date: 2013-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0
34
+ version: 2.0.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: 2.0.0
41
+ version: 2.0.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sass-rails
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - ~>
89
89
  - !ruby/object:Gem::Version
90
- version: 0.8.0
90
+ version: 0.9.0
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: 0.8.0
97
+ version: 0.9.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: carrierwave-processing
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -129,28 +129,28 @@ dependencies:
129
129
  requirements:
130
130
  - - ~>
131
131
  - !ruby/object:Gem::Version
132
- version: 1.4.2
132
+ version: 1.5.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ~>
138
138
  - !ruby/object:Gem::Version
139
- version: 1.4.2
139
+ version: 1.5.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: jquery-rails
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ~>
145
145
  - !ruby/object:Gem::Version
146
- version: 3.0.1
146
+ version: 3.0.4
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - ~>
152
152
  - !ruby/object:Gem::Version
153
- version: 3.0.1
153
+ version: 3.0.4
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: better_errors
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +235,48 @@ dependencies:
235
235
  - - ~>
236
236
  - !ruby/object:Gem::Version
237
237
  version: 4.2.1
238
+ - !ruby/object:Gem::Dependency
239
+ name: poltergeist
240
+ requirement: !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - ~>
243
+ - !ruby/object:Gem::Version
244
+ version: 1.3.0
245
+ type: :development
246
+ prerelease: false
247
+ version_requirements: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ~>
250
+ - !ruby/object:Gem::Version
251
+ version: 1.3.0
252
+ - !ruby/object:Gem::Dependency
253
+ name: database_cleaner
254
+ requirement: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - '='
257
+ - !ruby/object:Gem::Version
258
+ version: 1.0.1
259
+ type: :development
260
+ prerelease: false
261
+ version_requirements: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - '='
264
+ - !ruby/object:Gem::Version
265
+ version: 1.0.1
266
+ - !ruby/object:Gem::Dependency
267
+ name: sham_rack
268
+ requirement: !ruby/object:Gem::Requirement
269
+ requirements:
270
+ - - '>='
271
+ - !ruby/object:Gem::Version
272
+ version: '0'
273
+ type: :development
274
+ prerelease: false
275
+ version_requirements: !ruby/object:Gem::Requirement
276
+ requirements:
277
+ - - '>='
278
+ - !ruby/object:Gem::Version
279
+ version: '0'
238
280
  description: Uploadbox makes easy to manage files in your Rails application.
239
281
  email:
240
282
  - julio@startae.com.br