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,14 +2,14 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var Growler = {};
|
8
8
|
$.extend(Alchemy, Growler);
|
9
9
|
|
10
10
|
Alchemy.Growler = {
|
11
11
|
|
12
|
-
build:function
|
12
|
+
build: function(message, flash_type) {
|
13
13
|
var $flash_container = $('<div class="flash ' + flash_type + '" />');
|
14
14
|
var icon_class = flash_type === 'notice' ? 'tick' : flash_type;
|
15
15
|
$flash_container.append('<span class="icon ' + icon_class + '" />');
|
@@ -19,26 +19,30 @@ if (typeof(Alchemy) === 'undefined') {
|
|
19
19
|
Alchemy.Growler.fade();
|
20
20
|
},
|
21
21
|
|
22
|
-
fade:function
|
23
|
-
$('#flash_notices div[class="flash notice"]').delay(5000).hide('drop', {
|
22
|
+
fade: function() {
|
23
|
+
$('#flash_notices div[class="flash notice"]').delay(5000).hide('drop', {
|
24
|
+
direction: "up"
|
25
|
+
}, 400, function() {
|
24
26
|
$(this).remove();
|
25
27
|
});
|
26
|
-
$('#flash_notices div[class!="flash notice"]')
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
$('#flash_notices div[class!="flash notice"]').css({
|
29
|
+
cursor: 'pointer'
|
30
|
+
}).click(function() {
|
31
|
+
$(this).hide('drop', {
|
32
|
+
direction: "up"
|
33
|
+
}, 400, function() {
|
34
|
+
$(this).remove();
|
32
35
|
});
|
36
|
+
});
|
33
37
|
}
|
34
38
|
|
35
39
|
},
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
41
|
-
Alchemy.Growler.build(message, style);
|
41
|
+
Alchemy.growl = function(message, style) {
|
42
|
+
if (typeof(style) === 'undefined') {
|
43
|
+
style = 'notice';
|
42
44
|
}
|
45
|
+
Alchemy.Growler.build(message, style);
|
46
|
+
}
|
43
47
|
|
44
48
|
})(jQuery);
|
@@ -1,12 +1,11 @@
|
|
1
1
|
// Testing for HTML5 features
|
2
|
-
|
3
2
|
if (typeof(Alchemy) === 'undefined') {
|
4
3
|
var Alchemy = {};
|
5
4
|
}
|
6
5
|
|
7
6
|
Alchemy.HTML5 = {};
|
8
7
|
|
9
|
-
Alchemy.HTML5.hasUploadSupport = function
|
8
|
+
Alchemy.HTML5.hasUploadSupport = function() {
|
10
9
|
return typeof(window.FileReader) !== 'undefined' && supportFileAPI() && supportAjaxUploadProgressEvents();
|
11
10
|
|
12
11
|
function supportFileAPI() {
|
@@ -2,7 +2,7 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var ImageCropper = {};
|
8
8
|
ImageCropper.initialized = false;
|
@@ -10,17 +10,17 @@ if (typeof(Alchemy) === 'undefined') {
|
|
10
10
|
|
11
11
|
Alchemy.ImageCropper = {
|
12
12
|
|
13
|
-
init:function
|
13
|
+
init: function(box, size_x, size_y, default_box, ratio) {
|
14
14
|
var crop_from_field = $('#essence_picture_crop_from');
|
15
15
|
var crop_size_field = $('#essence_picture_crop_size');
|
16
16
|
var options = {
|
17
|
-
onSelect:function
|
17
|
+
onSelect: function(coords) {
|
18
18
|
crop_from_field.val(coords.x + "x" + coords.y);
|
19
19
|
crop_size_field.val(coords.w + "x" + coords.h);
|
20
20
|
},
|
21
|
-
setSelect:box,
|
22
|
-
aspectRatio:ratio ? ratio : undefined,
|
23
|
-
minSize:[size_x, size_y]
|
21
|
+
setSelect: box,
|
22
|
+
aspectRatio: ratio ? ratio : undefined,
|
23
|
+
minSize: [size_x, size_y]
|
24
24
|
};
|
25
25
|
Alchemy.ImageCropper.box = box;
|
26
26
|
Alchemy.ImageCropper.default_box = default_box;
|
@@ -34,21 +34,20 @@ if (typeof(Alchemy) === 'undefined') {
|
|
34
34
|
$('.ui-dialog-titlebar-close').click(Alchemy.ImageCropper.destroy);
|
35
35
|
},
|
36
36
|
|
37
|
-
undo:function
|
37
|
+
undo: function() {
|
38
38
|
Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.box);
|
39
39
|
},
|
40
40
|
|
41
|
-
reset:function
|
41
|
+
reset: function() {
|
42
42
|
Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.default_box);
|
43
43
|
Alchemy.ImageCropper.crop_from_field.val('');
|
44
44
|
Alchemy.ImageCropper.crop_size_field.val('');
|
45
45
|
},
|
46
46
|
|
47
|
-
destroy:function
|
47
|
+
destroy: function() {
|
48
48
|
try {
|
49
49
|
Alchemy.ImageCropper.api.destroy();
|
50
|
-
} catch (e) {
|
51
|
-
} finally {
|
50
|
+
} catch (e) {} finally {
|
52
51
|
Alchemy.ImageCropper.initialized = false;
|
53
52
|
}
|
54
53
|
}
|
@@ -4,7 +4,7 @@ if (typeof(Alchemy) === 'undefined') {
|
|
4
4
|
|
5
5
|
// Load jQuery on demand. Use this if jQuery is not present.
|
6
6
|
// Found on http://css-tricks.com/snippets/jquery/load-jquery-only-if-not-present/
|
7
|
-
Alchemy.loadjQuery = function
|
7
|
+
Alchemy.loadjQuery = function(callback) {
|
8
8
|
|
9
9
|
var thisPageUsingOtherJSLibrary = false;
|
10
10
|
|
@@ -14,25 +14,25 @@ Alchemy.loadjQuery = function (callback) {
|
|
14
14
|
|
15
15
|
function getScript(url, success) {
|
16
16
|
var script = document.createElement('script');
|
17
|
-
var head = document.getElementsByTagName('head')[0],
|
17
|
+
var head = document.getElementsByTagName('head')[0],
|
18
|
+
done = false;
|
18
19
|
script.src = url;
|
19
20
|
// Attach handlers for all browsers
|
20
|
-
script.onload = script.onreadystatechange = function
|
21
|
+
script.onload = script.onreadystatechange = function() {
|
21
22
|
if (!done && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
|
22
23
|
done = true;
|
23
24
|
// callback function provided as param
|
24
25
|
success();
|
25
26
|
script.onload = script.onreadystatechange = null;
|
26
27
|
head.removeChild(script);
|
27
|
-
}
|
28
|
-
;
|
28
|
+
};
|
29
29
|
};
|
30
30
|
head.appendChild(script);
|
31
31
|
}
|
32
32
|
|
33
33
|
;
|
34
34
|
|
35
|
-
getScript('/assets/jquery.min.js', function
|
35
|
+
getScript('/assets/jquery.min.js', function() {
|
36
36
|
if (typeof(jQuery) !== 'undefined') {
|
37
37
|
if (thisPageUsingOtherJSLibrary) {
|
38
38
|
jQuery.noConflict();
|
@@ -1,17 +1,15 @@
|
|
1
|
-
String.prototype.beginsWith = function
|
1
|
+
String.prototype.beginsWith = function(t, i) {
|
2
2
|
if (i == false) {
|
3
3
|
return (t == this.substring(0, t.length));
|
4
|
-
}
|
5
|
-
else {
|
4
|
+
} else {
|
6
5
|
return (t.toLowerCase() == this.substring(0, t.length).toLowerCase());
|
7
6
|
}
|
8
7
|
};
|
9
8
|
|
10
|
-
String.prototype.endsWith = function
|
9
|
+
String.prototype.endsWith = function(t, i) {
|
11
10
|
if (i == false) {
|
12
11
|
return (t == this.substring(this.length - t.length));
|
13
|
-
}
|
14
|
-
else {
|
12
|
+
} else {
|
15
13
|
return (t.toLowerCase() == this.substring(this.length - t.length).toLowerCase());
|
16
14
|
}
|
17
15
|
};
|
@@ -2,40 +2,36 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
Alchemy.loadAlchemyMenuBar = function
|
5
|
+
Alchemy.loadAlchemyMenuBar = function(options) {
|
6
6
|
|
7
7
|
Alchemy.Menubar = {
|
8
8
|
|
9
|
-
show:function
|
9
|
+
show: function() {
|
10
10
|
$('body').prepend(Alchemy.Menubar.build());
|
11
11
|
},
|
12
12
|
|
13
|
-
build:function
|
14
|
-
var bar = $('<div id="alchemy_menubar"/>')
|
15
|
-
|
16
|
-
bar.find('ul')
|
17
|
-
.append('<li><a href="' + options.route + '/admin">' + Alchemy.Menubar.t("to_alchemy") + '</a></li>')
|
18
|
-
.append('<li><a href="' + options.route + '/admin/pages/' + options.page_id + '/edit">' + Alchemy.Menubar.t("edit_page") + '</a></li>')
|
19
|
-
.append('<li><a href="' + options.route + '/admin/logout">' + Alchemy.Menubar.t("logout") + '</a></li>');
|
13
|
+
build: function() {
|
14
|
+
var bar = $('<div id="alchemy_menubar"/>').append('<ul/>');
|
15
|
+
bar.find('ul').append('<li><a href="' + options.route + '/admin">' + Alchemy.Menubar.t("to_alchemy") + '</a></li>').append('<li><a href="' + options.route + '/admin/pages/' + options.page_id + '/edit">' + Alchemy.Menubar.t("edit_page") + '</a></li>').append('<li><a href="' + options.route + '/admin/logout">' + Alchemy.Menubar.t("logout") + '</a></li>');
|
20
16
|
return bar;
|
21
17
|
},
|
22
18
|
|
23
|
-
translations:{
|
24
|
-
'to_alchemy':{
|
25
|
-
'de':'zu Alchemy',
|
26
|
-
'en':'To Alchemy'
|
19
|
+
translations: {
|
20
|
+
'to_alchemy': {
|
21
|
+
'de': 'zu Alchemy',
|
22
|
+
'en': 'To Alchemy'
|
27
23
|
},
|
28
|
-
'edit_page':{
|
29
|
-
'de':'Seite bearbeiten',
|
30
|
-
'en':'Edit Page'
|
24
|
+
'edit_page': {
|
25
|
+
'de': 'Seite bearbeiten',
|
26
|
+
'en': 'Edit Page'
|
31
27
|
},
|
32
|
-
'logout':{
|
33
|
-
'de':'abmelden',
|
34
|
-
'en':'Log out'
|
28
|
+
'logout': {
|
29
|
+
'de': 'abmelden',
|
30
|
+
'en': 'Log out'
|
35
31
|
}
|
36
32
|
},
|
37
33
|
|
38
|
-
t:function
|
34
|
+
t: function(id) {
|
39
35
|
var translation = Alchemy.Menubar.translations[id];
|
40
36
|
if (translation) {
|
41
37
|
return translation[options.locale];
|
@@ -2,32 +2,32 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var PageSorter = {};
|
8
8
|
$.extend(Alchemy, PageSorter);
|
9
9
|
|
10
10
|
Alchemy.PageSorter = {
|
11
11
|
|
12
|
-
init:function
|
12
|
+
init: function() {
|
13
13
|
var $sortables = $('ul#sitemap').find('ul.level_1_children');
|
14
14
|
$sortables.nestedSortable({
|
15
|
-
disableNesting:'no-nest',
|
16
|
-
forcePlaceholderSize:true,
|
17
|
-
handle:'span.handle',
|
18
|
-
items:'li',
|
19
|
-
listType:'ul',
|
20
|
-
opacity:0.5,
|
21
|
-
placeholder:'placeholder',
|
22
|
-
tabSize:16,
|
23
|
-
tolerance:'pointer',
|
24
|
-
toleranceElement:'> div'
|
15
|
+
disableNesting: 'no-nest',
|
16
|
+
forcePlaceholderSize: true,
|
17
|
+
handle: 'span.handle',
|
18
|
+
items: 'li',
|
19
|
+
listType: 'ul',
|
20
|
+
opacity: 0.5,
|
21
|
+
placeholder: 'placeholder',
|
22
|
+
tabSize: 16,
|
23
|
+
tolerance: 'pointer',
|
24
|
+
toleranceElement: '> div'
|
25
25
|
});
|
26
|
-
$('#save_page_order').click(function
|
26
|
+
$('#save_page_order').click(function(e) {
|
27
27
|
Alchemy.pleaseWaitOverlay();
|
28
28
|
e.preventDefault();
|
29
29
|
var params = {
|
30
|
-
set:JSON.stringify($sortables.nestedSortable('toHierarchy'))
|
30
|
+
set: JSON.stringify($sortables.nestedSortable('toHierarchy'))
|
31
31
|
};
|
32
32
|
$.post(Alchemy.routes.order_admin_pages_path, params);
|
33
33
|
return false;
|
@@ -37,11 +37,13 @@ if (typeof(Alchemy) === 'undefined') {
|
|
37
37
|
Alchemy.resizeFrame();
|
38
38
|
},
|
39
39
|
|
40
|
-
disableButton:function
|
40
|
+
disableButton: function() {
|
41
41
|
var $buttonLink = $('#page_sorting_button a');
|
42
42
|
$buttonLink.removeAttr('onclick');
|
43
43
|
$('#page_sorting_button').addClass('active');
|
44
|
-
$buttonLink.css({
|
44
|
+
$buttonLink.css({
|
45
|
+
cursor: 'default'
|
46
|
+
});
|
45
47
|
}
|
46
48
|
|
47
49
|
}
|
@@ -2,7 +2,7 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
Alchemy.initAlchemyPreviewMode = function
|
5
|
+
Alchemy.initAlchemyPreviewMode = function() {
|
6
6
|
|
7
7
|
// Setting jQueryUIs global animation duration
|
8
8
|
$.fx.speeds._default = 400;
|
@@ -10,51 +10,51 @@ Alchemy.initAlchemyPreviewMode = function () {
|
|
10
10
|
// The Alchemy JavaScript Object contains all Functions
|
11
11
|
$.extend(Alchemy, {
|
12
12
|
|
13
|
-
ElementSelector:{
|
13
|
+
ElementSelector: {
|
14
14
|
|
15
15
|
// defaults
|
16
|
-
styles:{
|
17
|
-
reset:{
|
18
|
-
|
19
|
-
'outline-width':'2px',
|
20
|
-
'outline-style':'solid',
|
21
|
-
'outline-color':'#98BAD5',
|
22
|
-
'outline-offset':'4px',
|
23
|
-
'-moz-outline-radius':'4px',
|
24
|
-
'outline-radius':'4px'
|
16
|
+
styles: {
|
17
|
+
reset: {
|
18
|
+
outline: '0 none'
|
25
19
|
},
|
26
|
-
|
27
|
-
'outline-width':'2px',
|
28
|
-
'outline-style':'solid',
|
29
|
-
'outline-color':'#
|
30
|
-
'outline-offset':'4px',
|
31
|
-
'-moz-outline-radius':'4px',
|
32
|
-
'outline-radius':'4px'
|
20
|
+
hover: {
|
21
|
+
'outline-width': '2px',
|
22
|
+
'outline-style': 'solid',
|
23
|
+
'outline-color': '#98BAD5',
|
24
|
+
'outline-offset': '4px',
|
25
|
+
'-moz-outline-radius': '4px',
|
26
|
+
'outline-radius': '4px'
|
27
|
+
},
|
28
|
+
selected: {
|
29
|
+
'outline-width': '2px',
|
30
|
+
'outline-style': 'solid',
|
31
|
+
'outline-color': '#DB694C',
|
32
|
+
'outline-offset': '4px',
|
33
|
+
'-moz-outline-radius': '4px',
|
34
|
+
'outline-radius': '4px'
|
33
35
|
}
|
34
36
|
},
|
35
37
|
|
36
|
-
scrollOffset:20,
|
38
|
+
scrollOffset: 20,
|
37
39
|
|
38
|
-
init:function
|
40
|
+
init: function() {
|
39
41
|
var self = Alchemy.ElementSelector;
|
40
42
|
var $elements = $('[data-alchemy-element]');
|
41
43
|
var styles = self.styles;
|
42
|
-
$elements.bind('mouseover', function
|
44
|
+
$elements.bind('mouseover', function(e) {
|
43
45
|
$(this).attr('title', 'Klicken zum bearbeiten');
|
44
|
-
if (!$(this).hasClass('selected'))
|
45
|
-
$(this).css(styles.hover);
|
46
|
+
if (!$(this).hasClass('selected')) $(this).css(styles.hover);
|
46
47
|
});
|
47
|
-
$elements.bind('mouseout', function
|
48
|
+
$elements.bind('mouseout', function() {
|
48
49
|
$(this).removeAttr('title');
|
49
|
-
if (!$(this).hasClass('selected'))
|
50
|
-
$(this).css(styles.reset);
|
50
|
+
if (!$(this).hasClass('selected')) $(this).css(styles.reset);
|
51
51
|
});
|
52
52
|
$elements.bind('Alchemy.SelectElement', self.selectElement);
|
53
53
|
$elements.bind('click', self.clickElement);
|
54
54
|
self.$previewElements = $elements;
|
55
55
|
},
|
56
56
|
|
57
|
-
selectElement:function
|
57
|
+
selectElement: function(e) {
|
58
58
|
var $this = $(this);
|
59
59
|
var self = Alchemy.ElementSelector;
|
60
60
|
var $elements = self.$previewElements;
|
@@ -64,12 +64,12 @@ Alchemy.initAlchemyPreviewMode = function () {
|
|
64
64
|
$elements.removeClass('selected').css(styles.reset);
|
65
65
|
$this.addClass('selected').css(styles.selected);
|
66
66
|
$('html, body').animate({
|
67
|
-
scrollTop
|
68
|
-
scrollLeft
|
67
|
+
scrollTop: $this.offset().top - offset,
|
68
|
+
scrollLeft: $this.offset().left - offset
|
69
69
|
}, 400);
|
70
70
|
},
|
71
71
|
|
72
|
-
clickElement:function
|
72
|
+
clickElement: function(e) {
|
73
73
|
var $this = $(this);
|
74
74
|
var parent$ = window.parent.jQuery;
|
75
75
|
var target_id = $this.attr('data-alchemy-element');
|
@@ -2,96 +2,104 @@ if (typeof(Alchemy) === 'undefined') {
|
|
2
2
|
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
|
-
(function
|
5
|
+
(function($) {
|
6
6
|
|
7
7
|
var PreviewWindow = {};
|
8
8
|
$.extend(Alchemy, PreviewWindow);
|
9
9
|
|
10
10
|
Alchemy.PreviewWindow = {
|
11
11
|
|
12
|
-
init:function
|
12
|
+
init: function(url, title) {
|
13
13
|
var $iframe = $('#alchemyPreviewWindow');
|
14
14
|
if ($iframe.length === 0) {
|
15
15
|
$iframe = $('<iframe src="' + url + '" id="alchemyPreviewWindow" frameborder="0"></iframe>');
|
16
|
-
$iframe.load(function
|
16
|
+
$iframe.load(function() {
|
17
17
|
$('#preview_load_info').hide();
|
18
18
|
});
|
19
|
-
$iframe.css({
|
19
|
+
$iframe.css({
|
20
|
+
'background-color': '#ffffff'
|
21
|
+
});
|
20
22
|
Alchemy.PreviewWindow.currentWindow = $iframe.dialog({
|
21
|
-
modal:false,
|
22
|
-
title:title,
|
23
|
-
width
|
24
|
-
height
|
25
|
-
minWidth:600,
|
26
|
-
minHeight:300,
|
27
|
-
show:"fade",
|
28
|
-
hide:"fade",
|
29
|
-
position:[70, 84],
|
30
|
-
autoResize:true,
|
31
|
-
closeOnEscape:false,
|
32
|
-
create:function
|
23
|
+
modal: false,
|
24
|
+
title: title,
|
25
|
+
width: $(window).width() - 504,
|
26
|
+
height: $(window).height() - 78,
|
27
|
+
minWidth: 600,
|
28
|
+
minHeight: 300,
|
29
|
+
show: "fade",
|
30
|
+
hide: "fade",
|
31
|
+
position: [70, 84],
|
32
|
+
autoResize: true,
|
33
|
+
closeOnEscape: false,
|
34
|
+
create: function() {
|
33
35
|
var $spinner = $('<img src="/assets/alchemy/ajax_loader.gif" alt="" id="preview_load_info" />');
|
34
|
-
$('#ui-dialog-title-alchemyPreviewWindow').after($spinner);
|
35
36
|
var $reload = $('<a href="#" class="ui-dialog-titlebar-refresh ui-corner-all" role="button"></a>');
|
37
|
+
$('#ui-dialog-title-alchemyPreviewWindow').after($spinner);
|
36
38
|
$reload.append('<span class="ui-icon ui-icon-refresh">reload</span>');
|
37
39
|
$('#ui-dialog-title-alchemyPreviewWindow').after($reload);
|
38
40
|
$reload.click(Alchemy.reloadPreview);
|
39
41
|
},
|
40
|
-
close:function
|
42
|
+
close: function(event, ui) {
|
41
43
|
Alchemy.PreviewWindow.button.enable();
|
42
44
|
},
|
43
|
-
open:function
|
44
|
-
$(this).css({
|
45
|
+
open: function(event, ui) {
|
46
|
+
$(this).css({
|
47
|
+
width: '100%'
|
48
|
+
});
|
45
49
|
Alchemy.PreviewWindow.button.disable();
|
46
50
|
Alchemy.previewWindowFrameWidth = $('#alchemyPreviewWindow').width();
|
47
51
|
}
|
48
52
|
}).dialogExtend({
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
53
|
+
"maximize": true,
|
54
|
+
"dblclick": "maximize",
|
55
|
+
"events": {
|
56
|
+
beforeMaximize: function(evt, dlg) {
|
57
|
+
Alchemy.previewWindowPosition = $('#alchemyPreviewWindow').dialog('widget').offset();
|
58
|
+
Alchemy.previewWindowFrameWidth = $('#alchemyPreviewWindow').width();
|
59
|
+
},
|
60
|
+
maximize: function(evt, dlg) {
|
61
|
+
$('#alchemyPreviewWindow').css({
|
62
|
+
width: "100%"
|
63
|
+
});
|
64
|
+
},
|
65
|
+
restore: function(evt, dlg) {
|
66
|
+
$('#alchemyPreviewWindow').dialog('widget').css(Alchemy.previewWindowPosition);
|
67
|
+
$('#alchemyPreviewWindow').css({
|
68
|
+
width: Alchemy.previewWindowFrameWidth
|
69
|
+
});
|
63
70
|
}
|
64
|
-
}
|
71
|
+
}
|
72
|
+
});
|
65
73
|
} else {
|
66
74
|
$('#alchemyPreviewWindow').dialog('open');
|
67
75
|
}
|
68
76
|
},
|
69
77
|
|
70
|
-
refresh:function
|
78
|
+
refresh: function() {
|
71
79
|
var $iframe = $('#alchemyPreviewWindow');
|
72
80
|
$('#preview_load_info').show();
|
73
|
-
$iframe.load(function
|
81
|
+
$iframe.load(function() {
|
74
82
|
$('#preview_load_info').hide();
|
75
83
|
});
|
76
84
|
$iframe.attr('src', $iframe.attr('src'));
|
77
85
|
return true;
|
78
86
|
},
|
79
87
|
|
80
|
-
button:{
|
81
|
-
enable:function
|
88
|
+
button: {
|
89
|
+
enable: function() {
|
82
90
|
$('div#show_preview_window').removeClass('disabled');
|
83
91
|
},
|
84
|
-
disable:function
|
92
|
+
disable: function() {
|
85
93
|
$('div#show_preview_window').addClass('disabled');
|
86
94
|
},
|
87
|
-
toggle:function
|
95
|
+
toggle: function() {
|
88
96
|
$('div#show_preview_window').toggleClass('disabled');
|
89
97
|
}
|
90
98
|
}
|
91
99
|
|
92
100
|
};
|
93
101
|
|
94
|
-
Alchemy.reloadPreview = function
|
102
|
+
Alchemy.reloadPreview = function() {
|
95
103
|
Alchemy.PreviewWindow.refresh();
|
96
104
|
};
|
97
105
|
|