file_upload 0.0.1 → 0.0.2

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: 411251a54632d2f6b1e5947507780ec4e303e438
4
- data.tar.gz: 6cba04bb20df8f7125541cb1727ca43970c4a8df
3
+ metadata.gz: e56842a2d4b0772171a482a056a51a38262be865
4
+ data.tar.gz: 806c5bbb78d458ca6f278fd72185de3c22d58045
5
5
  SHA512:
6
- metadata.gz: fa9a5651d4becd0b90d1c583fd883c9bb8e3d79221f0915157499c02a83be1266d21176c1d1b87e6676c98fe6922b171e13ed456fdf3365c19aea643ad6c2491
7
- data.tar.gz: 1634bafd7a0c24478d7481ebfc873304a05283c91e79baad50fe0dddf77e02073fc6a9f07063d6ec07147a32f7c92397d0a2c60a123bbb810fa8cc60be142a74
6
+ metadata.gz: 1c351757c72710f7ebbca938b5220ec0fabef8f17f6308bdea434b6961bebb313707295d1aadecbb662eb1ad1cc6d57dc413da890f45635c6422989f44f5add9
7
+ data.tar.gz: c6a81e17a703c54b7ab5982a9659198bad4a692d6751ed2a6dbd73ded9c205fac6b512c5427dcb7bc10889029b7fd6fa5b2228655b9b706de19452483c4956a8
@@ -58,11 +58,11 @@ $(function() {
58
58
  item.find(".progress").replaceWith(
59
59
  $('<input type="checkbox" checked="checked"/>')
60
60
  .attr('name', inputName.replace("REPLACE_ID", Math.floor(Math.random() * 1000000)))
61
- .val(file.id)
61
+ .val(file['id'])
62
62
  );
63
63
  } else {
64
64
  // add key hidden field
65
- container.find(".inputs .progress").replaceWith('<input type="hidden" name="' + inputName + '" value="' + file.id + '"/><input type="checkbox" checked="checked" name="' + inputPrefix + "[_destroy]" + '" value="0"/>');
65
+ container.find(".inputs .progress").replaceWith('<input type="hidden" name="' + inputName + '" value="' + file['id'] + '"/><input type="checkbox" checked="checked" name="' + inputPrefix + "[_destroy]" + '" value="0"/>');
66
66
  }
67
67
  });
68
68
 
@@ -18,6 +18,12 @@ class FileUpload::RedisFilesController < ApplicationController
18
18
 
19
19
  def show
20
20
  @redis_file = FileUpload::RedisFile.find(params[:id])
21
+ respond_to do |format|
22
+ format.json {
23
+ render json: @redis_file.to_json
24
+ }
25
+ format.html
26
+ end
21
27
  end
22
28
 
23
29
  def preview
@@ -28,6 +34,14 @@ class FileUpload::RedisFilesController < ApplicationController
28
34
  def destroy
29
35
  @redis_file = FileUpload::RedisFile.find(params[:id])
30
36
  @redis_file.destroy
37
+ respond_to do |format|
38
+ format.json {
39
+ render json: {
40
+ status: "OK"
41
+ }
42
+ }
43
+ format.html
44
+ end
31
45
  end
32
46
 
33
47
  def bulk
@@ -46,7 +60,7 @@ class FileUpload::RedisFilesController < ApplicationController
46
60
  respond_to do |format|
47
61
  format.js {
48
62
  render json: {
49
- files: files.map{|file| file.to_json}
63
+ files: files.map(&:to_json)
50
64
  }
51
65
  }
52
66
  end
@@ -124,7 +124,7 @@ module FileUpload
124
124
  redis.del(data_key, name_key, type_key, size_key)
125
125
  end
126
126
 
127
- def to_json
127
+ def to_json(options = {})
128
128
  {
129
129
  size: size,
130
130
  name: name,
@@ -1,3 +1,3 @@
1
1
  module FileUpload
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-25 00:00:00.000000000 Z
11
+ date: 2013-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-filemagic
@@ -116,7 +116,7 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - app/assets/javascripts/file_upload/application.js
119
- - app/assets/javascripts/file_upload.js.erb
119
+ - app/assets/javascripts/file_upload.js
120
120
  - app/assets/stylesheets/file_upload/application.css
121
121
  - app/assets/stylesheets/file_upload.css
122
122
  - app/controllers/file_upload/application_controller.rb