attache_rails 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.md +10 -12
- data/app/assets/javascripts/attache/bootstrap3.js +1 -1
- data/app/assets/javascripts/attache/bootstrap3.js.jsx +1 -1
- data/lib/attache_rails/version.rb +1 -1
- data/lib/attache_rails.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23145e14f7f10f15b0ee5817d168619e2b6d0e5c
|
4
|
+
data.tar.gz: cbe0855bc37ec5ab2137c3af923a53077cb4150e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e380a7dbb6fed113a7ad7e71f5af307dbcffaa39480e95054083053358d4bd76b04a4066e51d564387c5ebb949b05449173b1d2dd8f33a758916a92aaec599
|
7
|
+
data.tar.gz: 2ac7cd485271384c199c2376b4ee163b62387a16e7cb5a9db584d0cf8a894c9450a926746e63c7daddd30917d5d614d55de07e7ff993384b22342b3b6edcf660
|
data/README.md
CHANGED
@@ -28,15 +28,6 @@ Add the attache javascript to your `application.js`
|
|
28
28
|
//= require attache
|
29
29
|
```
|
30
30
|
|
31
|
-
Or you can include the various scripts yourself
|
32
|
-
|
33
|
-
``` javascript
|
34
|
-
//= require attache/cors_upload
|
35
|
-
//= require attache/file_input
|
36
|
-
//= require attache/bootstrap3
|
37
|
-
//= require attache/ujs
|
38
|
-
```
|
39
|
-
|
40
31
|
If you want to customize the file upload look and feel, define your own react `<AttacheFilePreview/>` renderer *before* including the attache js. For example,
|
41
32
|
|
42
33
|
``` javascript
|
@@ -128,10 +119,17 @@ Use the `attache_urls` helper to obtain full urls for the values you've captured
|
|
128
119
|
= image_tag(url)
|
129
120
|
```
|
130
121
|
|
131
|
-
|
122
|
+
You can also include `AttacheRails::Helper` directly in your model
|
132
123
|
|
133
|
-
```
|
134
|
-
|
124
|
+
``` ruby
|
125
|
+
class User < ActiveRecord::Base
|
126
|
+
include AttacheRails::Helper
|
127
|
+
serialize :photo_path, JSON
|
128
|
+
|
129
|
+
def photo_url
|
130
|
+
attache_urls(photo_path, '128x128#').sample
|
131
|
+
end
|
132
|
+
end
|
135
133
|
```
|
136
134
|
|
137
135
|
### Environment configs
|
@@ -37,7 +37,7 @@ if (typeof AttacheFilePreview === 'undefined') {
|
|
37
37
|
progress,
|
38
38
|
img,
|
39
39
|
React.createElement("div", {className: "clearfix"},
|
40
|
-
React.createElement("div", {className: "pull-left"
|
40
|
+
React.createElement("div", {className: "pull-left"}, this.props.filename),
|
41
41
|
React.createElement("a", {href: "#remove", className: "pull-right", onClick: this.props.onRemove, title: "Click to remove"}, "×")
|
42
42
|
)
|
43
43
|
)
|
@@ -37,7 +37,7 @@ if (typeof AttacheFilePreview === 'undefined') {
|
|
37
37
|
{progress}
|
38
38
|
{img}
|
39
39
|
<div className="clearfix">
|
40
|
-
<div className="pull-left"
|
40
|
+
<div className="pull-left">{this.props.filename}</div>
|
41
41
|
<a href="#remove" className="pull-right" onClick={this.props.onRemove} title="Click to remove">×</a>
|
42
42
|
</div>
|
43
43
|
</div>
|
data/lib/attache_rails.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "attache_rails/engine"
|
2
2
|
|
3
3
|
module AttacheRails
|
4
|
-
module
|
4
|
+
module Helper
|
5
5
|
ATTACHE_UPLOAD_URL = ENV.fetch('ATTACHE_UPLOAD_URL') { 'http://localhost:9292/upload' }
|
6
6
|
ATTACHE_DOWNLOAD_URL = ENV.fetch('ATTACHE_DOWNLOAD_URL') { 'http://localhost:9292/view' }
|
7
7
|
ATTACHE_UPLOAD_DURATION = ENV.fetch('ATTACHE_UPLOAD_DURATION') { '600' }.to_i # 10 minutes
|
@@ -40,4 +40,4 @@ module AttacheRails
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
ActionView::Base.send(:include, AttacheRails::
|
43
|
+
ActionView::Base.send(:include, AttacheRails::Helper)
|