alchemy_cms 2.2.rc13 → 2.2.rc14
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -0
- data/alchemy_cms.gemspec +1 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +95 -94
- data/app/assets/javascripts/alchemy/alchemy.buttons.js +15 -11
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js +18 -18
- data/app/assets/javascripts/alchemy/alchemy.dirty.js +20 -20
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +50 -44
- data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +15 -12
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +47 -43
- data/app/assets/javascripts/alchemy/alchemy.file_progress.js +27 -17
- data/app/assets/javascripts/alchemy/alchemy.growler.js +19 -15
- data/app/assets/javascripts/alchemy/alchemy.html5.js +1 -2
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +10 -11
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +6 -6
- data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +4 -6
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +16 -20
- data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +18 -16
- data/app/assets/javascripts/alchemy/alchemy.preview.js +30 -30
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +50 -42
- data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +11 -11
- data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +83 -86
- data/app/assets/javascripts/alchemy/alchemy.uploader.js +106 -112
- data/app/assets/javascripts/alchemy/alchemy.windows.js +158 -130
- data/app/assets/stylesheets/alchemy/base.css.scss +7 -1
- data/app/assets/stylesheets/alchemy/buttons.css.scss +31 -25
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -0
- data/app/controllers/alchemy/admin/base_controller.rb +5 -1
- data/app/helpers/alchemy/admin/base_helper.rb +21 -13
- data/app/helpers/alchemy/admin/contents_helper.rb +52 -11
- data/app/helpers/alchemy/admin/elements_helper.rb +0 -1
- data/app/helpers/alchemy/admin/essences_helper.rb +5 -5
- data/app/helpers/alchemy/essences_helper.rb +1 -0
- data/app/models/alchemy/content.rb +102 -91
- data/app/models/alchemy/essence_boolean.rb +8 -0
- data/app/models/alchemy/essence_select.rb +7 -0
- data/app/sweepers/alchemy/content_sweeper.rb +2 -4
- data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -2
- data/app/views/alchemy/admin/clipboard/index.html.erb +2 -2
- data/app/views/alchemy/admin/contents/create.js.erb +2 -0
- data/app/views/alchemy/admin/contents/destroy.js.coffee +4 -0
- data/app/views/alchemy/admin/contents/new.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_foot.html.erb +3 -2
- data/app/views/alchemy/admin/elements/create.js.coffee +31 -0
- data/app/views/alchemy/admin/elements/fold.js.coffee +37 -0
- data/app/views/alchemy/admin/essence_pictures/assign.js.coffee +15 -0
- data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +19 -0
- data/app/views/alchemy/admin/essence_pictures/edit.html.erb +12 -2
- data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/destroy.js.coffee +19 -0
- data/app/views/alchemy/admin/pages/edit.html.erb +5 -5
- data/app/views/alchemy/admin/pages/update.js.coffee +36 -0
- data/app/views/alchemy/admin/resources/_form.html.erb +12 -1
- data/app/views/alchemy/admin/resources/_resource.html.erb +6 -3
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/trash/clear.js.coffee +4 -0
- data/app/views/alchemy/admin/trash/index.html.erb +4 -4
- data/app/views/alchemy/elements/_article_editor.html.erb +4 -2
- data/app/views/alchemy/elements/_article_view.html.erb +7 -7
- data/app/views/alchemy/elements/_download_editor.html.erb +4 -1
- data/app/views/alchemy/elements/_download_view.html.erb +7 -3
- data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_image_mosaic_view.html.erb +11 -9
- data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +14 -0
- data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_html_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +35 -0
- data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_text_editor.html.erb +29 -77
- data/app/views/alchemy/essences/_essence_text_view.html.erb +2 -2
- data/config/alchemy/elements.yml +72 -44
- data/config/locales/alchemy.de.yml +46 -45
- data/config/locales/alchemy.en.yml +90 -89
- data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +11 -0
- data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +11 -0
- data/lib/alchemy/authentication_helpers.rb +3 -7
- data/lib/alchemy/engine.rb +3 -4
- data/lib/alchemy/essence.rb +24 -16
- data/lib/alchemy/resource.rb +22 -3
- data/lib/alchemy/resources_helper.rb +8 -0
- data/lib/alchemy/seeder.rb +26 -1
- data/lib/alchemy/upgrader.rb +70 -1
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/spec/controllers/admin/clipboard_controller_spec.rb +16 -4
- data/spec/controllers/admin/contents_controller_spec.rb +21 -4
- data/spec/dummy/app/models/event.rb +1 -1
- data/spec/dummy/db/schema.rb +18 -1
- data/spec/helpers/admin/contents_helper_spec.rb +3 -2
- data/spec/models/clipboard_spec.rb +14 -3
- data/spec/models/essence_boolean_spec.rb +15 -0
- data/spec/models/essence_select_spec.rb +15 -0
- data/spec/models/resource_spec.rb +113 -0
- metadata +40 -12
- data/app/views/alchemy/admin/contents/destroy.js.erb +0 -7
- data/app/views/alchemy/admin/elements/create.js.erb +0 -36
- data/app/views/alchemy/admin/elements/fold.js.erb +0 -41
- data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -16
- data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -20
- data/app/views/alchemy/admin/pages/destroy.js.erb +0 -12
- data/app/views/alchemy/admin/pages/update.js.erb +0 -40
- data/app/views/alchemy/admin/trash/clear.js.erb +0 -3
- data/spec/dummy/app/models/.gitkeep +0 -0
@@ -2,23 +2,23 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
$.extend(Alchemy, {
|
8
8
|
|
9
|
-
SortableElements:function
|
9
|
+
SortableElements: function(page_id, form_token) {
|
10
10
|
$('#element_area .sortable_cell').sortable({
|
11
|
-
items:'div.element_editor',
|
12
|
-
handle:'.element_handle',
|
13
|
-
axis:'y',
|
14
|
-
placeholder:'droppable_element_placeholder',
|
15
|
-
forcePlaceholderSize:true,
|
16
|
-
dropOnEmpty:true,
|
17
|
-
opacity:0.5,
|
18
|
-
cursor:'move',
|
19
|
-
tolerance:'pointer',
|
20
|
-
update:function
|
21
|
-
var ids = $.map($(this).children(), function
|
11
|
+
items: 'div.element_editor',
|
12
|
+
handle: '.element_handle',
|
13
|
+
axis: 'y',
|
14
|
+
placeholder: 'droppable_element_placeholder',
|
15
|
+
forcePlaceholderSize: true,
|
16
|
+
dropOnEmpty: true,
|
17
|
+
opacity: 0.5,
|
18
|
+
cursor: 'move',
|
19
|
+
tolerance: 'pointer',
|
20
|
+
update: function(event, ui) {
|
21
|
+
var ids = $.map($(this).children(), function(child) {
|
22
22
|
return $(child).attr('data-element-id');
|
23
23
|
});
|
24
24
|
var params_string = '';
|
@@ -32,53 +32,57 @@ if (typeof(Alchemy) === 'undefined') {
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
$(event.target).css("cursor", "progress");
|
35
|
-
params_string = "page_id=" + page_id + "&authenticity_token=" + encodeURIComponent(form_token) + "&" + $.param({
|
35
|
+
params_string = "page_id=" + page_id + "&authenticity_token=" + encodeURIComponent(form_token) + "&" + $.param({
|
36
|
+
element_ids: ids
|
37
|
+
});
|
36
38
|
if (cell_id) {
|
37
39
|
params_string += "&cell_id=" + cell_id;
|
38
40
|
}
|
39
41
|
$.ajax({
|
40
|
-
url:Alchemy.routes.order_admin_elements_path,
|
41
|
-
type:'POST',
|
42
|
-
data:params_string,
|
43
|
-
complete:function
|
42
|
+
url: Alchemy.routes.order_admin_elements_path,
|
43
|
+
type: 'POST',
|
44
|
+
data: params_string,
|
45
|
+
complete: function() {
|
44
46
|
$(event.target).css("cursor", "auto");
|
45
47
|
Alchemy.refreshTrashWindow(page_id);
|
46
48
|
}
|
47
49
|
});
|
48
50
|
},
|
49
|
-
start:function
|
51
|
+
start: function(event, ui) {
|
50
52
|
var $textareas = ui.item.find('textarea.default_tinymce, textarea.custom_tinymce');
|
51
|
-
$textareas.each(function
|
53
|
+
$textareas.each(function() {
|
52
54
|
tinymce.get(this.id).remove();
|
53
55
|
});
|
54
56
|
},
|
55
|
-
stop:function
|
57
|
+
stop: function(event, ui) {
|
56
58
|
var $textareas = ui.item.find('textarea.default_tinymce, textarea.custom_tinymce');
|
57
|
-
$textareas.each(function
|
59
|
+
$textareas.each(function() {
|
58
60
|
Alchemy.Tinymce.addEditor(this.id);
|
59
61
|
});
|
60
62
|
}
|
61
63
|
});
|
62
64
|
},
|
63
65
|
|
64
|
-
SortableContents:function
|
66
|
+
SortableContents: function(selector, token) {
|
65
67
|
$(selector).sortable({
|
66
|
-
items:'div.dragable_picture',
|
67
|
-
handle:'div.picture_handle',
|
68
|
-
opacity:0.5,
|
69
|
-
cursor:'move',
|
70
|
-
tolerance:'pointer',
|
71
|
-
containment:'parent',
|
72
|
-
update:function
|
73
|
-
var ids = $.map($(this).children('div.dragable_picture'), function
|
68
|
+
items: 'div.dragable_picture',
|
69
|
+
handle: 'div.picture_handle',
|
70
|
+
opacity: 0.5,
|
71
|
+
cursor: 'move',
|
72
|
+
tolerance: 'pointer',
|
73
|
+
containment: 'parent',
|
74
|
+
update: function(event, ui) {
|
75
|
+
var ids = $.map($(this).children('div.dragable_picture'), function(child) {
|
74
76
|
return child.id.replace(/essence_picture_/, '');
|
75
77
|
});
|
76
78
|
$(event.originalTarget).css("cursor", "progress");
|
77
79
|
$.ajax({
|
78
|
-
url:Alchemy.routes.order_admin_contents_path,
|
79
|
-
type:'POST',
|
80
|
-
data:"authenticity_token=" + encodeURIComponent(token) + "&" + $.param({
|
81
|
-
|
80
|
+
url: Alchemy.routes.order_admin_contents_path,
|
81
|
+
type: 'POST',
|
82
|
+
data: "authenticity_token=" + encodeURIComponent(token) + "&" + $.param({
|
83
|
+
content_ids: ids
|
84
|
+
}),
|
85
|
+
complete: function() {
|
82
86
|
$(event.originalTarget).css("cursor", "move");
|
83
87
|
}
|
84
88
|
});
|
@@ -86,22 +90,24 @@ if (typeof(Alchemy) === 'undefined') {
|
|
86
90
|
});
|
87
91
|
},
|
88
92
|
|
89
|
-
DraggableTrashItems:function
|
90
|
-
$("#trash_items div.draggable").each(function
|
93
|
+
DraggableTrashItems: function(items_n_cells) {
|
94
|
+
$("#trash_items div.draggable").each(function() {
|
91
95
|
var cell_classes = '';
|
92
96
|
var cell_names = items_n_cells[this.id];
|
93
|
-
$.each(cell_names, function
|
97
|
+
$.each(cell_names, function(i) {
|
94
98
|
cell_classes += '.' + this + '_cell' + ', ';
|
95
99
|
});
|
96
100
|
$(this).draggable({
|
97
|
-
helper:'clone',
|
98
|
-
iframeFix:'iframe#alchemyPreviewWindow',
|
99
|
-
connectToSortable:cell_classes,
|
100
|
-
start:function
|
101
|
+
helper: 'clone',
|
102
|
+
iframeFix: 'iframe#alchemyPreviewWindow',
|
103
|
+
connectToSortable: cell_classes,
|
104
|
+
start: function(event, ui) {
|
101
105
|
$(this).hide().addClass('dragged');
|
102
|
-
ui.helper.css({
|
106
|
+
ui.helper.css({
|
107
|
+
width: '300px'
|
108
|
+
});
|
103
109
|
},
|
104
|
-
stop:function
|
110
|
+
stop: function() {
|
105
111
|
$(this).show().removeClass('dragged');
|
106
112
|
}
|
107
113
|
});
|
@@ -2,33 +2,33 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var ElementEditorSelector = {};
|
8
8
|
$.extend(Alchemy, ElementEditorSelector);
|
9
9
|
|
10
10
|
Alchemy.ElementEditorSelector = {
|
11
11
|
|
12
|
-
init:function
|
12
|
+
init: function() {
|
13
13
|
var $elements = $('#element_area .element_editor');
|
14
14
|
var self = Alchemy.ElementEditorSelector;
|
15
15
|
self.reinit($elements);
|
16
16
|
},
|
17
17
|
|
18
|
-
reinit:function
|
18
|
+
reinit: function(elements) {
|
19
19
|
var self = Alchemy.ElementEditorSelector;
|
20
20
|
var $elements = $(elements);
|
21
|
-
$elements.each(function
|
21
|
+
$elements.each(function() {
|
22
22
|
self.bindEvent(this);
|
23
23
|
});
|
24
24
|
$elements.find('.element_head').click(self.onClickElement);
|
25
|
-
$elements.find('.element_head').dblclick(function
|
25
|
+
$elements.find('.element_head').dblclick(function() {
|
26
26
|
var id = $(this).parent().attr('id').replace(/\D/g, '');
|
27
27
|
self.foldElement(id);
|
28
28
|
});
|
29
29
|
},
|
30
30
|
|
31
|
-
onClickElement:function
|
31
|
+
onClickElement: function(e) {
|
32
32
|
var self = Alchemy.ElementEditorSelector;
|
33
33
|
var $element = $(this).parent('.element_editor');
|
34
34
|
var id = $element.attr('id').replace(/\D/g, '');
|
@@ -42,12 +42,12 @@ if (typeof(Alchemy) === 'undefined') {
|
|
42
42
|
$selected_element.trigger('Alchemy.SelectElement');
|
43
43
|
},
|
44
44
|
|
45
|
-
bindEvent:function
|
45
|
+
bindEvent: function(element) {
|
46
46
|
var self = Alchemy.ElementEditorSelector;
|
47
47
|
$(element).bind('Alchemy.SelectElementEditor', self.selectElement);
|
48
48
|
},
|
49
49
|
|
50
|
-
selectElement:function
|
50
|
+
selectElement: function(e) {
|
51
51
|
var self = Alchemy.ElementEditorSelector;
|
52
52
|
var id = this.id.replace(/\D/g, '');
|
53
53
|
var $element = $(this);
|
@@ -68,15 +68,18 @@ if (typeof(Alchemy) === 'undefined') {
|
|
68
68
|
}
|
69
69
|
},
|
70
70
|
|
71
|
-
scrollToElement:function
|
72
|
-
$('#alchemyElementWindow').scrollTo(el, {
|
71
|
+
scrollToElement: function(el) {
|
72
|
+
$('#alchemyElementWindow').scrollTo(el, {
|
73
|
+
duration: 400,
|
74
|
+
offset: -10
|
75
|
+
});
|
73
76
|
},
|
74
77
|
|
75
|
-
foldElement:function
|
78
|
+
foldElement: function(id) {
|
76
79
|
var self = Alchemy.ElementEditorSelector;
|
77
80
|
$('#element_' + id + '_folder').hide();
|
78
81
|
$('#element_' + id + '_folder_spinner').show();
|
79
|
-
$.post(Alchemy.routes.fold_admin_element_path(id), function
|
82
|
+
$.post(Alchemy.routes.fold_admin_element_path(id), function() {
|
80
83
|
$('#element_' + id + '_folder').show();
|
81
84
|
$('#element_' + id + '_folder_spinner').hide();
|
82
85
|
self.scrollToElement('#element_' + id);
|
@@ -2,94 +2,98 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var ElementsWindow = {};
|
8
8
|
$.extend(Alchemy, ElementsWindow);
|
9
9
|
|
10
10
|
Alchemy.ElementsWindow = {
|
11
11
|
|
12
|
-
init:function
|
12
|
+
init: function(path, options, callback) {
|
13
13
|
var $dialog = $('<div style="display: none" id="alchemyElementWindow"></div>');
|
14
|
-
var closeCallback = function
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
$dialog.html(Alchemy.getOverlaySpinner({
|
14
|
+
var closeCallback = function() {
|
15
|
+
$dialog.dialog("destroy");
|
16
|
+
$('#alchemyElementWindow').remove();
|
17
|
+
Alchemy.ElementsWindow.button.enable();
|
18
|
+
};
|
19
|
+
$dialog.html(Alchemy.getOverlaySpinner({
|
20
|
+
x: 420,
|
21
|
+
y: 300
|
22
|
+
}));
|
20
23
|
Alchemy.ElementsWindow.currentWindow = $dialog.dialog({
|
21
|
-
modal:false,
|
22
|
-
minWidth:422,
|
23
|
-
minHeight:300,
|
24
|
-
height
|
25
|
-
title:options.texts.title,
|
26
|
-
show:"fade",
|
27
|
-
hide:"fade",
|
28
|
-
position:[$(window).width() - 428, 84],
|
29
|
-
closeOnEscape:false,
|
30
|
-
create:function
|
24
|
+
modal: false,
|
25
|
+
minWidth: 422,
|
26
|
+
minHeight: 300,
|
27
|
+
height: $(window).height() - 90,
|
28
|
+
title: options.texts.title,
|
29
|
+
show: "fade",
|
30
|
+
hide: "fade",
|
31
|
+
position: [$(window).width() - 428, 84],
|
32
|
+
closeOnEscape: false,
|
33
|
+
create: function() {
|
31
34
|
$dialog.before(Alchemy.ElementsWindow.createToolbar(options.toolbarButtons));
|
32
35
|
},
|
33
|
-
open:function
|
36
|
+
open: function(event, ui) {
|
34
37
|
Alchemy.ElementsWindow.button.disable();
|
35
38
|
$.ajax({
|
36
|
-
url:path,
|
37
|
-
success:function
|
39
|
+
url: path,
|
40
|
+
success: function(data, textStatus, XMLHttpRequest) {
|
38
41
|
$dialog.html(data);
|
39
42
|
Alchemy.ButtonObserver('#alchemyElementWindow .button');
|
43
|
+
Alchemy.overlayObserver('#alchemyElementWindow');
|
40
44
|
Alchemy.Datepicker('#alchemyElementWindow input.date, #alchemyElementWindow input[type="date"]');
|
41
45
|
if (callback) {
|
42
46
|
callback.call();
|
43
47
|
}
|
44
48
|
},
|
45
|
-
error:function
|
49
|
+
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
46
50
|
Alchemy.AjaxErrorHandler($dialog, XMLHttpRequest.status, textStatus, errorThrown);
|
47
51
|
}
|
48
52
|
});
|
49
53
|
},
|
50
|
-
beforeClose:function
|
54
|
+
beforeClose: function() {
|
51
55
|
if (Alchemy.isPageDirty()) {
|
52
56
|
Alchemy.openConfirmWindow({
|
53
|
-
title:options.texts.dirtyTitle,
|
54
|
-
message:options.texts.dirtyMessage,
|
55
|
-
okLabel:options.texts.okLabel,
|
56
|
-
cancelLabel:options.texts.cancelLabel,
|
57
|
-
okCallback:closeCallback
|
57
|
+
title: options.texts.dirtyTitle,
|
58
|
+
message: options.texts.dirtyMessage,
|
59
|
+
okLabel: options.texts.okLabel,
|
60
|
+
cancelLabel: options.texts.cancelLabel,
|
61
|
+
okCallback: closeCallback
|
58
62
|
});
|
59
63
|
return false;
|
60
64
|
} else {
|
61
65
|
return true;
|
62
66
|
}
|
63
67
|
},
|
64
|
-
close:closeCallback
|
68
|
+
close: closeCallback
|
65
69
|
});
|
66
70
|
},
|
67
71
|
|
68
|
-
button:{
|
69
|
-
enable:function
|
72
|
+
button: {
|
73
|
+
enable: function() {
|
70
74
|
$('div#show_element_window').removeClass('disabled');
|
71
75
|
},
|
72
|
-
disable:function
|
76
|
+
disable: function() {
|
73
77
|
$('div#show_element_window').addClass('disabled');
|
74
78
|
},
|
75
|
-
toggle:function
|
79
|
+
toggle: function() {
|
76
80
|
$('div#show_element_window').toggleClass('disabled');
|
77
81
|
}
|
78
82
|
},
|
79
83
|
|
80
|
-
createToolbar:function
|
81
|
-
var $toolbar = $('<div id="overlay_toolbar"></div>'),
|
84
|
+
createToolbar: function(buttons) {
|
85
|
+
var $toolbar = $('<div id="overlay_toolbar"></div>'),
|
86
|
+
btn;
|
82
87
|
for (i = 0; i < buttons.length; i++) {
|
83
88
|
btn = buttons[i];
|
84
89
|
$toolbar.append(
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
);
|
90
|
+
Alchemy.ToolbarButton({
|
91
|
+
buttonTitle: btn.title,
|
92
|
+
buttonLabel: btn.label,
|
93
|
+
iconClass: btn.iconClass,
|
94
|
+
onClick: btn.onClick,
|
95
|
+
buttonId: btn.buttonId
|
96
|
+
}));
|
93
97
|
}
|
94
98
|
return $toolbar;
|
95
99
|
}
|
@@ -2,11 +2,11 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
$.extend(Alchemy, {
|
8
8
|
|
9
|
-
FileProgress:function
|
9
|
+
FileProgress: function(file) {
|
10
10
|
var $progressBarContainer;
|
11
11
|
this.fileID = file.id;
|
12
12
|
this.$fileProgressWrapper = $('#' + this.fileID);
|
@@ -45,47 +45,57 @@ if (typeof(Alchemy) === 'undefined') {
|
|
45
45
|
|
46
46
|
});
|
47
47
|
|
48
|
-
Alchemy.FileProgress.prototype.setTimer = function
|
48
|
+
Alchemy.FileProgress.prototype.setTimer = function(timer) {
|
49
49
|
this.$fileProgressElement["FP_TIMER"] = timer;
|
50
50
|
};
|
51
51
|
|
52
|
-
Alchemy.FileProgress.prototype.getTimer = function
|
52
|
+
Alchemy.FileProgress.prototype.getTimer = function(timer) {
|
53
53
|
return this.$fileProgressElement["FP_TIMER"] || null;
|
54
54
|
};
|
55
55
|
|
56
|
-
Alchemy.FileProgress.prototype.reset = function
|
56
|
+
Alchemy.FileProgress.prototype.reset = function() {
|
57
57
|
this.$fileProgressStatus.html(" ");
|
58
58
|
this.$progressBar.removeClass().addClass("progressBarInProgress");
|
59
|
-
this.$progressBar.css({
|
59
|
+
this.$progressBar.css({
|
60
|
+
width: '0%'
|
61
|
+
});
|
60
62
|
};
|
61
63
|
|
62
|
-
Alchemy.FileProgress.prototype.setProgress = function
|
64
|
+
Alchemy.FileProgress.prototype.setProgress = function(percentage) {
|
63
65
|
this.$progressBar.removeClass().addClass("progressBarInProgress");
|
64
|
-
this.$progressBar.css({
|
66
|
+
this.$progressBar.css({
|
67
|
+
width: percentage + '%'
|
68
|
+
});
|
65
69
|
};
|
66
70
|
|
67
|
-
Alchemy.FileProgress.prototype.setComplete = function
|
71
|
+
Alchemy.FileProgress.prototype.setComplete = function() {
|
68
72
|
this.$progressBar.removeClass().addClass("progressBarComplete");
|
69
|
-
this.$progressBar.css({
|
70
|
-
|
73
|
+
this.$progressBar.css({
|
74
|
+
width: '100%'
|
75
|
+
});
|
76
|
+
this.$fileProgressWrapper.delay(1500).fadeOut(function() {
|
71
77
|
$(this).remove();
|
72
78
|
});
|
73
79
|
};
|
74
80
|
|
75
|
-
Alchemy.FileProgress.prototype.setError = function
|
81
|
+
Alchemy.FileProgress.prototype.setError = function() {
|
76
82
|
this.$progressBar.removeClass().addClass("progressBarError");
|
77
|
-
this.$progressBar.css({
|
83
|
+
this.$progressBar.css({
|
84
|
+
width: '100%'
|
85
|
+
});
|
78
86
|
};
|
79
87
|
|
80
|
-
Alchemy.FileProgress.prototype.setCancelled = function
|
88
|
+
Alchemy.FileProgress.prototype.setCancelled = function() {
|
81
89
|
this.$progressBar.removeClass().addClass("progressBarCanceled");
|
82
|
-
this.$progressBar.css({
|
83
|
-
|
90
|
+
this.$progressBar.css({
|
91
|
+
width: '100%'
|
92
|
+
});
|
93
|
+
this.$fileProgressWrapper.delay(1500).fadeOut(function() {
|
84
94
|
$(this).remove();
|
85
95
|
});
|
86
96
|
};
|
87
97
|
|
88
|
-
Alchemy.FileProgress.prototype.setStatus = function
|
98
|
+
Alchemy.FileProgress.prototype.setStatus = function(status) {
|
89
99
|
this.$fileProgressStatus.text(status);
|
90
100
|
};
|
91
101
|
|