rails-uploader 0.1.2 → 0.1.3
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.
- data/README.md +15 -0
- data/app/views/uploader/default/_download.html.erb +13 -14
- data/app/views/uploader/default/_upload.html.erb +1 -1
- data/lib/uploader/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -98,6 +98,21 @@ class User
|
|
98
98
|
end
|
99
99
|
```
|
100
100
|
|
101
|
+
### Notice
|
102
|
+
|
103
|
+
User method fileuploads only once pre model. So if you have many attached files, use this:
|
104
|
+
|
105
|
+
``` ruby
|
106
|
+
class User
|
107
|
+
include Uploader::Fileuploads
|
108
|
+
|
109
|
+
has_one :picture, :as => :assetable
|
110
|
+
has_one :avatar, :as => :assetable
|
111
|
+
|
112
|
+
fileuploads :picture, :avatar
|
113
|
+
end
|
114
|
+
|
115
|
+
|
101
116
|
### Include assets
|
102
117
|
|
103
118
|
Javascripts:
|
@@ -1,20 +1,19 @@
|
|
1
1
|
<!-- The template to display files available for download -->
|
2
2
|
<script id="template-download-<%= field.klass %>" type="text/x-tmpl">
|
3
3
|
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
4
|
-
|
5
4
|
<div id="asset_{%=file.id%}" class="attach_item template-download">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
<div class="buttons-panel">
|
6
|
+
<a href="#" class="del_btn delete" data-type="DELETE" data-url="/uploader/attachments/{%=file.id%}?klass=<%= field.klass %>"></a>
|
7
|
+
</div>
|
8
|
+
<div class="thumbnail preview">
|
9
|
+
<a href="{%=file.url%}" download="{%=file.filename%}">
|
10
|
+
<img src="{%=file.thumb_url%}" title="{%=file.filename%}" rel="gallery" />
|
11
|
+
</a>
|
12
|
+
</div>
|
13
|
+
<div class="infoHolder">
|
14
|
+
<div class="fileName">{%=file.filename%}</div>
|
15
|
+
<div class="fileWeight">{%=o.formatFileSize(file.size)%}</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
19
18
|
{% } %}
|
20
19
|
</script>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<script id="template-upload-<%= field.klass %>" type="text/x-tmpl">
|
3
3
|
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
4
4
|
<div class="attach_item loading template-upload">
|
5
|
-
<div class="
|
5
|
+
<div class="buttons-panel"><a href="#" class="del_btn cancel"></a></div>
|
6
6
|
<div class="thumbnail preview"><img class="preloader" src="/assets/uploader/preloader.gif" alt=""></div>
|
7
7
|
<div class="infoHolder">
|
8
8
|
<div class="fileName">{%=file.name%}</div>
|
data/lib/uploader/version.rb
CHANGED