attache_rails 0.0.5 → 0.0.6

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: edd291b58ed01055cda499254592cfd028ed2cde
4
- data.tar.gz: e8c95574587c899c798cb3fe550523a86222ffa7
3
+ metadata.gz: 23145e14f7f10f15b0ee5817d168619e2b6d0e5c
4
+ data.tar.gz: cbe0855bc37ec5ab2137c3af923a53077cb4150e
5
5
  SHA512:
6
- metadata.gz: c6b5fa2be93e5a90b22bd39e58330eeaf663733af892a0c98ddd7c76fa2500ba8d3b6805b10a33dd1ffaddaf1f7c4b81654991845991b5e151f14e6f5b31a937
7
- data.tar.gz: 9889e52f28712d7c5a10a50933ec7d637cb45a111b51fbcd92620989dfe883e88a71d1a464910b67a4068be658dcbe63b765ab8feabb6393035993ad02e6f942
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
- Alternatively, you can get the list of urls and manipulate it however you want
122
+ You can also include `AttacheRails::Helper` directly in your model
132
123
 
133
- ``` slim
134
- = image_tag attache_urls(@user.photo_path, '128x128#').sample
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", style: "textOverflow: 'ellipsis;'"}, this.props.filename),
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" style="textOverflow: 'ellipsis;'">{this.props.filename}</div>
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">&times;</a>
42
42
  </div>
43
43
  </div>
@@ -1,3 +1,3 @@
1
1
  module AttacheRails
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/attache_rails.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "attache_rails/engine"
2
2
 
3
3
  module AttacheRails
4
- module ViewHelper
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::ViewHelper)
43
+ ActionView::Base.send(:include, AttacheRails::Helper)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attache_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - choonkeat