sunrise-core 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.rdoc +2 -2
  2. data/app/controllers/manage/assets_controller.rb +2 -2
  3. data/app/views/layouts/manage.html.erb +4 -5
  4. data/app/views/manage/{assets/_picture.html.erb → fileupload/_asset.html.erb} +4 -3
  5. data/app/views/manage/fileupload/_container.html.erb +25 -0
  6. data/app/views/manage/fileupload/_tmpl.html.erb +14 -0
  7. data/app/views/manage/users/_form.html.erb +5 -1
  8. data/app/views/manage/users/_model_filter.html.erb +5 -3
  9. data/config/locales/manage/en.yml +5 -0
  10. data/config/locales/manage/ru.yml +5 -0
  11. data/config/locales/manage/uk.yml +5 -0
  12. data/lib/generators/sunrise/install_generator.rb +26 -6
  13. data/lib/generators/sunrise/templates/helpers/manage/assets_helper.rb +0 -14
  14. data/lib/generators/sunrise/templates/javascripts/manage-fileuploader.js +182 -0
  15. data/lib/generators/sunrise/templates/javascripts/manage.js +17 -13
  16. data/lib/generators/sunrise/templates/models/defaults/user.rb +1 -5
  17. data/lib/generators/sunrise/templates/stylesheets/manage/buttons.css +42 -0
  18. data/lib/generators/sunrise/templates/stylesheets/manage/main.css +11 -0
  19. data/lib/generators/sunrise/templates/stylesheets/smoothness/{jquery-ui-1.8.6.custom.css → jquery-ui-1.8.13.custom.css} +37 -31
  20. data/lib/sunrise/engine.rb +5 -0
  21. data/lib/sunrise/models/asset.rb +1 -1
  22. data/lib/sunrise/version.rb +1 -1
  23. data/lib/sunrise/views/form_builder.rb +53 -6
  24. metadata +56 -43
  25. data/app/views/manage/assets/_collection.html.erb +0 -32
  26. data/app/views/manage/assets/_swfscript.html.erb +0 -51
  27. data/lib/generators/sunrise/templates/javascripts/swfupload/fileprogress.js +0 -114
  28. data/lib/generators/sunrise/templates/javascripts/swfupload/handlers.js +0 -164
  29. data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.js +0 -1134
  30. data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.queue.js +0 -98
  31. data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.swf +0 -0
@@ -1,98 +0,0 @@
1
- /*
2
- Queue Plug-in
3
-
4
- Features:
5
- *Adds a cancelQueue() method for cancelling the entire queue.
6
- *All queued files are uploaded when startUpload() is called.
7
- *If false is returned from uploadComplete then the queue upload is stopped.
8
- If false is not returned (strict comparison) then the queue upload is continued.
9
- *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
10
- Set the event handler with the queue_complete_handler setting.
11
-
12
- */
13
-
14
- var SWFUpload;
15
- if (typeof(SWFUpload) === "function") {
16
- SWFUpload.queue = {};
17
-
18
- SWFUpload.prototype.initSettings = (function (oldInitSettings) {
19
- return function (userSettings) {
20
- if (typeof(oldInitSettings) === "function") {
21
- oldInitSettings.call(this, userSettings);
22
- }
23
-
24
- this.queueSettings = {};
25
-
26
- this.queueSettings.queue_cancelled_flag = false;
27
- this.queueSettings.queue_upload_count = 0;
28
-
29
- this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
30
- this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
31
- this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
32
- this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
33
-
34
- this.settings.queue_complete_handler = userSettings.queue_complete_handler || null;
35
- };
36
- })(SWFUpload.prototype.initSettings);
37
-
38
- SWFUpload.prototype.startUpload = function (fileID) {
39
- this.queueSettings.queue_cancelled_flag = false;
40
- this.callFlash("StartUpload", [fileID]);
41
- };
42
-
43
- SWFUpload.prototype.cancelQueue = function () {
44
- this.queueSettings.queue_cancelled_flag = true;
45
- this.stopUpload();
46
-
47
- var stats = this.getStats();
48
- while (stats.files_queued > 0) {
49
- this.cancelUpload();
50
- stats = this.getStats();
51
- }
52
- };
53
-
54
- SWFUpload.queue.uploadStartHandler = function (file) {
55
- var returnValue;
56
- if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
57
- returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
58
- }
59
-
60
- // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
61
- returnValue = (returnValue === false) ? false : true;
62
-
63
- this.queueSettings.queue_cancelled_flag = !returnValue;
64
-
65
- return returnValue;
66
- };
67
-
68
- SWFUpload.queue.uploadCompleteHandler = function (file) {
69
- var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
70
- var continueUpload;
71
-
72
- if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
73
- this.queueSettings.queue_upload_count++;
74
- }
75
-
76
- if (typeof(user_upload_complete_handler) === "function") {
77
- continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
78
- } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
79
- // If the file was stopped and re-queued don't restart the upload
80
- continueUpload = false;
81
- } else {
82
- continueUpload = true;
83
- }
84
-
85
- if (continueUpload) {
86
- var stats = this.getStats();
87
- if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
88
- this.startUpload();
89
- } else if (this.queueSettings.queue_cancelled_flag === false) {
90
- this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
91
- this.queueSettings.queue_upload_count = 0;
92
- } else {
93
- this.queueSettings.queue_cancelled_flag = false;
94
- this.queueSettings.queue_upload_count = 0;
95
- }
96
- }
97
- };
98
- }