papermill 1.0.2 → 1.0.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.rdoc +3 -6
- data/VERSION +1 -1
- data/app/views/papermill/_asset.html.erb +2 -2
- data/lib/papermill/form_builder.rb +18 -6
- data/lib/papermill/papermill_helper.rb +8 -4
- data/public/papermill/papermill.css +17 -22
- data/public/papermill/papermill.js +7 -7
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
= Papermill
|
2
2
|
|
3
|
-
Asset management made easy.
|
3
|
+
Asset management made easy.
|
4
4
|
|
5
5
|
== News..
|
6
6
|
|
7
|
-
1.0.0 Release, finally!
|
8
|
-
Things should be more stable now.
|
9
|
-
|
10
7
|
I can't make it work with IE6, there seems to be a jQuery problem. SWFUpload and jQuery should both work fine with it, but anyway, it dies with strange errors that I don't understand. Any help appreciated...
|
11
8
|
|
12
9
|
== Install the gems
|
@@ -57,12 +54,12 @@ Loads of them
|
|
57
54
|
|
58
55
|
=== Generic catch-all declaration
|
59
56
|
|
60
|
-
papermill
|
57
|
+
papermill options_hash # in your papermilled assetable model
|
61
58
|
@article.assets(:any_key, options_hash) # data access
|
62
59
|
|
63
60
|
=== Association specific declaration
|
64
61
|
|
65
|
-
papermill :my_association, options_hash
|
62
|
+
papermill :my_association, options_hash # in your papermilled assetable model
|
66
63
|
@article.my_association # data access
|
67
64
|
|
68
65
|
== Usage:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%- dom_id = "papermill_asset_#{asset.id}" -%>
|
2
2
|
<%- delete_link = %{<a onclick="if(confirm('#{escape_javascript t("papermill.delete-confirmation", :resource => asset.name)}')){ jQuery.ajax({async:true, beforeSend:function(request){jQuery('##{dom_id}').hide();}, dataType:'script', error:function(request){jQuery('##{dom_id}').show();}, type:'delete', url:'#{papermill_url(asset)}'})}; return false;" href="#" class="delete"><img title="#{escape_javascript t("papermill.delete", :ressource => asset.name)}" src="/papermill/images/delete.png" alt="delete"/></a>} %>
|
3
3
|
|
4
|
-
<
|
4
|
+
<div id="<%= dom_id %>" class="asset" title="<%= t("papermill.#{thumbnail_style ? "thumbnail-" : ""}edit-title", :ressource => asset.name) %>" onDblClick="popup(jQuery(this).attr('rel')); return false;" rel="<%= edit_papermill_url(asset) %>">
|
5
5
|
<%= delete_link %>
|
6
6
|
<%- if thumbnail_style -%>
|
7
7
|
<%= render :partial => "papermill/thumbnail_asset", :object => asset, :locals => {:thumbnail_style => thumbnail_style} %>
|
8
8
|
<%- else -%>
|
9
9
|
<%= render :partial => "papermill/raw_asset", :object => asset %>
|
10
10
|
<%- end -%>
|
11
|
-
</
|
11
|
+
</div>
|
@@ -74,9 +74,9 @@ module ActionView::Helpers::FormTagHelper
|
|
74
74
|
gallery_width = (options[:gallery][:width] || w) && "width:#{options[:gallery][:width] || options[:gallery][:columns]*(w+(hp+hm+b)*2)}px;" || ""
|
75
75
|
gallery_height = (options[:gallery][:height] || h) && "min-height:#{options[:gallery][:height] || options[:gallery][:lines]*(h+(vp+vm+b)*2)}px;" || ""
|
76
76
|
inline_css << %{##{id} { #{gallery_width} #{gallery_height} }}
|
77
|
-
inline_css << %{##{id}
|
77
|
+
inline_css << %{##{id} .asset { margin:#{vm}px #{hm}px; border-width:#{b}px; padding:#{vp}px #{hp}px; #{size}; }}
|
78
78
|
else
|
79
|
-
inline_css << %{##{id}, ##{id}
|
79
|
+
inline_css << %{##{id}, ##{id} .asset { #{size} }}
|
80
80
|
end
|
81
81
|
inline_css << %{##{id} .name { width:#{w || "100"}px; }}
|
82
82
|
inline_css.join("\n")
|
@@ -115,7 +115,7 @@ module ActionView::Helpers::FormTagHelper
|
|
115
115
|
collection = PapermillAsset.all(:conditions => conditions, :order => "position")
|
116
116
|
|
117
117
|
html[:upload_button] = %{<div id="#{id}-button-wrapper" class="papermill-button-wrapper" style="height: #{options[:swfupload][:button_height]}px;"><span id="browse_for_#{id}" class="swf_button"></span></div>}
|
118
|
-
html[:container] = @template.content_tag(:
|
118
|
+
html[:container] = @template.content_tag(:div, :id => id, :class => "#{(options[:thumbnail] ? "papermill-thumb-container" : "papermill-asset-container")} #{(options[:gallery] ? "papermill-multiple-items" : "papermill-unique-item")}") {
|
119
119
|
@template.render :partial => "papermill/asset", :collection => collection, :locals => { :thumbnail_style => (options[:thumbnail] && options[:thumbnail][:style]) }
|
120
120
|
}
|
121
121
|
|
@@ -128,9 +128,21 @@ module ActionView::Helpers::FormTagHelper
|
|
128
128
|
html[:dashboard] = @template.content_tag(:ul, options[:dashboard].map{|action| @template.content_tag(:li, html[:dashboard][action], :class => action.to_s) }.join("\n"), :class => "dashboard")
|
129
129
|
end
|
130
130
|
|
131
|
-
@template.content_for :papermill_inline_js do
|
132
|
-
|
133
|
-
|
131
|
+
@template.content_for :papermill_inline_js do %{
|
132
|
+
jQuery("##{id}").sortable({
|
133
|
+
update:function(){
|
134
|
+
jQuery.ajax({
|
135
|
+
async: true,
|
136
|
+
data: jQuery(this).sortable('serialize'),
|
137
|
+
dataType: 'script',
|
138
|
+
type: 'post',
|
139
|
+
url: '#{@template.controller.send("sort_papermill_path")}'
|
140
|
+
})
|
141
|
+
}
|
142
|
+
})
|
143
|
+
} end if options[:gallery]
|
144
|
+
|
145
|
+
@template.content_for :papermill_inline_js do %{
|
134
146
|
new SWFUpload({
|
135
147
|
upload_id: "#{id}",
|
136
148
|
upload_url: "#{@template.escape_javascript create_url}",
|
@@ -8,8 +8,8 @@ module PapermillHelper
|
|
8
8
|
def papermill_javascript_tag(options = {})
|
9
9
|
html = []
|
10
10
|
if options[:with_jquery] || options[:with_jqueryui]
|
11
|
-
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
|
12
|
-
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"
|
11
|
+
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>} if options[:with_jquery]
|
12
|
+
html << %{<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>} if options[:with_jquery] || options[:with_jqueryui_only]
|
13
13
|
html << %{<script type="text/javascript">jQuery.noConflict();</script>} if options[:with_jquery] == "no_conflict"
|
14
14
|
end
|
15
15
|
html << %{<script type="text/javascript">}
|
@@ -19,9 +19,13 @@ module PapermillHelper
|
|
19
19
|
html << %{</script>}
|
20
20
|
html << javascript_include_tag("/papermill/papermill", "/papermill/swfupload")
|
21
21
|
unless @content_for_papermill_inline_js.blank?
|
22
|
-
html << '<script type="text/javascript">
|
22
|
+
html << '<script type="text/javascript">'
|
23
|
+
html << '//<![CDATA['
|
24
|
+
html << 'jQuery(document).ready(function() {'
|
23
25
|
html << @content_for_papermill_inline_js
|
24
|
-
html << '})
|
26
|
+
html << '});'
|
27
|
+
html << '//]]>'
|
28
|
+
html << '</script>'
|
25
29
|
end
|
26
30
|
html.join("\n")
|
27
31
|
end
|
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
.papermill { overflow:hidden; }
|
16
16
|
.papermill a img { border:0px; }
|
17
|
-
.papermill
|
18
|
-
.papermill
|
17
|
+
.papermill .asset:hover { border-color:blue; }
|
18
|
+
.papermill .asset a { display:block; }
|
19
19
|
.papermill .progress { display:block; border:1px solid #C2E3EF; text-align:left; height:6px; }
|
20
20
|
.papermill .progress span { background:#7BB963; height:6px; width:0; display:block; }
|
21
21
|
|
@@ -24,34 +24,29 @@
|
|
24
24
|
.papermill .dashboard li.mass_delete a { background:transparent url(images/mass-delete.png) no-repeat top left; }
|
25
25
|
|
26
26
|
.papermill-thumb-container { position:relative; border:5px solid #EEE; padding:4px; overflow:hidden; }
|
27
|
-
.papermill-thumb-container
|
28
|
-
.papermill-thumb-container
|
29
|
-
.papermill-thumb-container
|
30
|
-
.papermill-thumb-container
|
31
|
-
.papermill-thumb-container
|
32
|
-
.papermill-thumb-container
|
27
|
+
.papermill-thumb-container .asset { border:0px solid transparent; min-height:25px; min-width:25px; display:block; float:left; position:relative; }
|
28
|
+
.papermill-thumb-container .asset span { display:block; }
|
29
|
+
.papermill-thumb-container .asset .delete { position:absolute; bottom:5px; right:5px; }
|
30
|
+
.papermill-thumb-container .asset .name { font-size:10px; overflow:hidden; font-weight:bold; }
|
31
|
+
.papermill-thumb-container .asset .infos { font-size:8px; overflow:hidden; }
|
32
|
+
.papermill-thumb-container .asset .status { margin-bottom:10px; }
|
33
33
|
|
34
34
|
.papermill-asset-container { border:1px solid #EEE; padding:3px; }
|
35
|
-
.papermill-asset-container
|
36
|
-
.papermill-asset-container
|
37
|
-
.papermill-asset-container
|
38
|
-
.papermill-asset-container
|
39
|
-
.papermill-asset-container
|
40
|
-
.papermill-asset-container
|
35
|
+
.papermill-asset-container .asset { display:block; height:22px; }
|
36
|
+
.papermill-asset-container .asset .swfupload .name { margin-left:21px; }
|
37
|
+
.papermill-asset-container .asset .name { float:left; }
|
38
|
+
.papermill-asset-container .asset .status { margin-left:5px; float:left; }
|
39
|
+
.papermill-asset-container .asset .progress { float:left; margin-top:6px; margin-left:5px; width:100px; }
|
40
|
+
.papermill-asset-container .asset .delete { float:left; margin-top:2px; margin-right:5px; }
|
41
41
|
|
42
|
-
.papermill-thumb-container.papermill-multiple-items
|
42
|
+
.papermill-thumb-container.papermill-multiple-items .asset { cursor:move; }
|
43
43
|
|
44
44
|
.papermill-asset-container.papermill-multiple-items { padding-left:10px; border-left:5px solid #EEE; min-height:44px; }
|
45
|
-
.papermill-asset-container.papermill-multiple-items
|
45
|
+
.papermill-asset-container.papermill-multiple-items .asset { cursor:row-resize; }
|
46
46
|
|
47
47
|
.papermill-asset-container.papermill-unique-item { padding-left:5px; min-height:22px; }
|
48
48
|
|
49
|
-
/* Using formtastic? Move this to your formtastic_changes.css to make it cleaner : */
|
50
|
-
form.formtastic .papermill ul li {
|
51
|
-
margin-bottom:0;
|
52
|
-
}
|
53
|
-
|
54
49
|
/* Need some backgrounds?
|
55
|
-
.papermill
|
50
|
+
.papermill .asset { background:transparent url(images/background.png) repeat top left; }
|
56
51
|
.papermill-thumb-container { background:transparent url(images/container-background.jpg) repeat top left; }
|
57
52
|
*/
|
@@ -81,17 +81,17 @@ var Upload = {
|
|
81
81
|
this.sorted_queue = file_queue.sort(function(a,b){
|
82
82
|
if(b.name < a.name){return (1)}
|
83
83
|
})
|
84
|
-
self = this;
|
84
|
+
var self = this;
|
85
85
|
jQuery(this.sorted_queue).each( function(index, file) {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
div = jQuery('<div></div>').attr({ 'id': file.id, 'class': 'swfupload asset' });
|
87
|
+
div.append(jQuery('<span></span>').attr('class', 'name').html(file.name.substring(0, 10) + '...'));
|
88
|
+
div.append(jQuery('<span></span>').attr('class', 'status').html(SWFUPLOAD_PENDING));
|
89
|
+
div.append(jQuery('<span></span>').attr('class', 'progress').append('<span></span>'));
|
90
90
|
|
91
91
|
if(self.settings.file_queue_limit == 1) {
|
92
|
-
jQuery("#" + self.settings.upload_id).html(
|
92
|
+
jQuery("#" + self.settings.upload_id).html(div);
|
93
93
|
} else {
|
94
|
-
jQuery("#" + self.settings.upload_id).append(
|
94
|
+
jQuery("#" + self.settings.upload_id).append(div);
|
95
95
|
}
|
96
96
|
})
|
97
97
|
this.startUpload(this.sorted_queue[this.index++].id);
|