papermill 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +5 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +94 -0
  4. data/Rakefile +69 -0
  5. data/VERSION +1 -0
  6. data/app/controllers/papermill_controller.rb +78 -0
  7. data/app/views/papermill/_asset.html.erb +11 -0
  8. data/app/views/papermill/_raw_asset.html.erb +1 -0
  9. data/app/views/papermill/_thumbnail_asset.html.erb +6 -0
  10. data/app/views/papermill/edit.html.erb +5 -0
  11. data/config/locales/papermill.yml +28 -0
  12. data/config/routes.rb +4 -0
  13. data/generators/papermill/USAGE +3 -0
  14. data/generators/papermill/papermill_generator.rb +22 -0
  15. data/generators/papermill/templates/migrate/papermill_migration.rb.erb +22 -0
  16. data/init.rb +1 -0
  17. data/install.rb +0 -0
  18. data/installation-template.txt +124 -0
  19. data/lib/core_extensions.rb +25 -0
  20. data/lib/papermill.rb +0 -0
  21. data/lib/papermill/form_builder.rb +101 -0
  22. data/lib/papermill/papermill_asset.rb +54 -0
  23. data/lib/papermill/papermill_helper.rb +48 -0
  24. data/lib/papermill/papermill_module.rb +177 -0
  25. data/papermill.gemspec +93 -0
  26. data/public/flashs/swfupload.swf +0 -0
  27. data/public/images/papermill/background.png +0 -0
  28. data/public/images/papermill/container-background.jpg +0 -0
  29. data/public/images/papermill/delete.png +0 -0
  30. data/public/images/papermill/upload-blank.png +0 -0
  31. data/public/images/papermill/upload.png +0 -0
  32. data/public/javascripts/papermill.js +83 -0
  33. data/public/stylesheets/papermill.css +33 -0
  34. data/rails/init.rb +13 -0
  35. data/tasks/papermill_tasks.rake +1 -0
  36. data/test/papermill_test.rb +9 -0
  37. data/test/test_helper.rb +3 -0
  38. data/uninstall.rb +1 -0
  39. metadata +135 -0
Binary file
Binary file
Binary file
@@ -0,0 +1,83 @@
1
+ popup = function(title1, title) {
2
+ window.open (title1, title, config='height=700, width=600, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
3
+ }
4
+ // override at will
5
+
6
+ notify = function(message, type) {
7
+ alert(type + ": " + message)
8
+ }
9
+ // You can override notify later, with your own notification system
10
+
11
+ var Upload = {
12
+ files_queued: 0,
13
+ file_dialog_complete: function(num_selected, num_queued)
14
+ {
15
+ // SwfUpload doesn't order uploads by name out of the box...
16
+ this.sorted_queue = [];
17
+ this.index = 0;
18
+ if (num_queued > 0) {
19
+ file_queue = [];
20
+ global_index = 0;
21
+ index = 0;
22
+ do {
23
+ file = this.callFlash("GetFileByIndex", [global_index]);
24
+ if(file != null && file.filestatus == -1) {
25
+ file_queue[index] = file;
26
+ index++;
27
+ }
28
+ global_index++;
29
+ } while (file != null);
30
+ this.sorted_queue = file_queue.sort(function(a,b){
31
+ if(b.name < a.name){return (1)}
32
+ })
33
+ self = this;
34
+ jQuery(this.sorted_queue).each( function(index, file) {
35
+ li = jQuery('<li></li>').attr({ 'id': file.id, 'class': 'swfupload' });
36
+ li.append(jQuery('<span></span>').attr('class', 'name').html(file.name.substring(0, 10) + '...'));
37
+ li.append(jQuery('<span></span>').attr('class', 'status').html(SWFUPLOAD_PENDING));
38
+ li.append(jQuery('<span></span>').attr('class', 'progress').append('<span></span>'));
39
+
40
+ if(self.settings.file_queue_limit == 1) {
41
+ jQuery("#" + self.settings.upload_id).html(li);
42
+ } else {
43
+ jQuery("#" + self.settings.upload_id).append(li);
44
+ }
45
+ })
46
+ this.startUpload(this.sorted_queue[this.index++].id);
47
+ }
48
+ },
49
+
50
+ upload_start: function(file)
51
+ {
52
+ jQuery('#' + file.id + ' .status').html(SWFUPLOAD_LOADING);
53
+ },
54
+ upload_progress: function(file, bytes, total)
55
+ {
56
+ percent = Math.ceil((bytes / total) * 100);
57
+ jQuery('#' + file.id + ' .progress span').width(percent + '%');
58
+ },
59
+ upload_error: function(file, code, message)
60
+ {
61
+ notify(SWFUPLOAD_ERROR + " " + file.name + " (" + message + " [" + code + "])", "error");
62
+ jQuery('#' + file.id).remove();
63
+ },
64
+ upload_success: function(file, data)
65
+ {
66
+ if(jQuery(data).length == 0) {
67
+ notify(data, "warning");
68
+ jQuery('#' + file.id).remove();
69
+ } else {
70
+ jQuery('#' + file.id).replaceWith(jQuery(data));
71
+ }
72
+ },
73
+ upload_complete: function(file)
74
+ {
75
+ Upload.files_queued -= 1;
76
+ if(this.sorted_queue[this.index]) {
77
+ this.startUpload(this.sorted_queue[this.index++].id)
78
+ }
79
+ },
80
+ file_queue_error: function(file, error_code, message) {
81
+ upload_error(file, error_code, message)
82
+ }
83
+ }
@@ -0,0 +1,33 @@
1
+ .papermill a:hover { background:none; color:inherit; }
2
+ .papermill a img { border:0px; }
3
+ .papermill li:hover { border-color:blue; }
4
+ .papermill li a { display:block; }
5
+ .papermill .progress { display:block; border:1px solid #C2E3EF; text-align:left; height:6px; }
6
+ .papermill .progress span { background:#7BB963; height:6px; width:0; display:block; }
7
+
8
+ .papermill-thumb-container li { border:0px solid transparent; min-height:25px; min-width:25px; }
9
+ .papermill-thumb-container { position:relative; border:5px solid #EEE; padding:4px; overflow-x:hidden; }
10
+ .papermill-thumb-container li { display:block; float:left; position:relative; }
11
+ .papermill-thumb-container .delete { position:absolute; bottom:5px; right:5px; }
12
+ .papermill-thumb-container span { display:block; }
13
+ .papermill-thumb-container .name { font-size:10px; overflow:hidden; font-weight:bold; }
14
+ .papermill-thumb-container .infos { font-size:8px; overflow:hidden; }
15
+ .papermill-thumb-container .status { margin-bottom:10px; }
16
+
17
+ .papermill-asset-container { border:1px solid #EEE; padding:3px; }
18
+ .papermill-asset-container li { display:block; height:22px; }
19
+ .papermill-asset-container .swfupload .name { margin-left:21px; }
20
+ .papermill-asset-container .name { float:left; }
21
+ .papermill-asset-container .status { margin-left:5px; float:left; }
22
+ .papermill-asset-container .progress { float:left; margin-top:6px; margin-left:5px; width:100px; }
23
+ .papermill-asset-container .delete { float:left; margin-top:2px; margin-right:5px; }
24
+
25
+ .papermill-asset-container.papermill-multiple-items { padding-left:10px; border-left:5px solid #EEE; min-height:40px; }
26
+ .papermill-asset-container.papermill-multiple-items li { cursor:row-resize; }
27
+ .papermill-thumb-container.papermill-multiple-items li { cursor:move; }
28
+ .papermill-asset-container.papermill-unique-item { padding-left:5px; min-height:22px; }
29
+
30
+ /* Need some backgrounds?
31
+ .papermill li { background:transparent url(/images/papermill/background.png) repeat top left; }
32
+ .papermill-thumb-container { background:transparent url(/images/papermill/container-background.jpg) repeat top left; }
33
+ */
data/rails/init.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'core_extensions'
2
+ Object.send :include, ObjectExtensions
3
+ Hash.send :include, HashExtensions
4
+ String.send :include, StringExtensions
5
+
6
+ I18n.load_path = [File.join(File.dirname(__FILE__), "../config/locales/papermill.yml")] + I18n.load_path
7
+
8
+ require 'papermill/papermill_module'
9
+ require 'papermill/papermill_asset'
10
+ require 'papermill/form_builder'
11
+ require 'papermill/papermill_helper'
12
+ ActionView::Base.send :include, PapermillHelper
13
+ ActiveRecord::Base.send :include, Papermill
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class PapermillTest < ActiveSupport::TestCase
4
+ # Replace this with your real tests.
5
+
6
+ test "the truth" do
7
+ assert true
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'active_support'
3
+ require 'active_support/test_case'
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: papermill
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.7
5
+ platform: ruby
6
+ authors:
7
+ - "Benoit B\xC3\xA9n\xC3\xA9zech"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-08 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: paperclip
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mime-types
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "1.16"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rsl-stringex
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.0
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ryanb-acts-as-list
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.1.2
54
+ version:
55
+ description: Paperclip Swfupload UploadHelper wrapper
56
+ email: benoit.benezech@gmail.com
57
+ executables: []
58
+
59
+ extensions: []
60
+
61
+ extra_rdoc_files:
62
+ - README.rdoc
63
+ files:
64
+ - .gitignore
65
+ - MIT-LICENSE
66
+ - README.rdoc
67
+ - Rakefile
68
+ - VERSION
69
+ - app/controllers/papermill_controller.rb
70
+ - app/views/papermill/_asset.html.erb
71
+ - app/views/papermill/_raw_asset.html.erb
72
+ - app/views/papermill/_thumbnail_asset.html.erb
73
+ - app/views/papermill/edit.html.erb
74
+ - config/locales/papermill.yml
75
+ - config/routes.rb
76
+ - generators/papermill/USAGE
77
+ - generators/papermill/papermill_generator.rb
78
+ - generators/papermill/templates/migrate/papermill_migration.rb.erb
79
+ - init.rb
80
+ - install.rb
81
+ - installation-template.txt
82
+ - lib/core_extensions.rb
83
+ - lib/papermill.rb
84
+ - lib/papermill/form_builder.rb
85
+ - lib/papermill/papermill_asset.rb
86
+ - lib/papermill/papermill_helper.rb
87
+ - lib/papermill/papermill_module.rb
88
+ - papermill.gemspec
89
+ - public/.DS_Store
90
+ - public/flashs/swfupload.swf
91
+ - public/images/.DS_Store
92
+ - public/images/papermill/.DS_Store
93
+ - public/images/papermill/background.png
94
+ - public/images/papermill/container-background.jpg
95
+ - public/images/papermill/delete.png
96
+ - public/images/papermill/upload-blank.png
97
+ - public/images/papermill/upload.png
98
+ - public/javascripts/papermill.js
99
+ - public/stylesheets/papermill.css
100
+ - rails/init.rb
101
+ - tasks/papermill_tasks.rake
102
+ - test/papermill_test.rb
103
+ - test/test_helper.rb
104
+ - uninstall.rb
105
+ has_rdoc: true
106
+ homepage: http://github.com/BBenezech/papermill
107
+ licenses: []
108
+
109
+ post_install_message:
110
+ rdoc_options:
111
+ - --charset=UTF-8
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ version:
126
+ requirements: []
127
+
128
+ rubyforge_project: papermill
129
+ rubygems_version: 1.3.5
130
+ signing_key:
131
+ specification_version: 3
132
+ summary: Paperclip Swfupload UploadHelper wrapper
133
+ test_files:
134
+ - test/papermill_test.rb
135
+ - test/test_helper.rb