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.
Files changed (106) hide show
  1. data/Rakefile +3 -0
  2. data/alchemy_cms.gemspec +1 -0
  3. data/app/assets/javascripts/alchemy/alchemy.base.js +95 -94
  4. data/app/assets/javascripts/alchemy/alchemy.buttons.js +15 -11
  5. data/app/assets/javascripts/alchemy/alchemy.datepicker.js +18 -18
  6. data/app/assets/javascripts/alchemy/alchemy.dirty.js +20 -20
  7. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js +50 -44
  8. data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +15 -12
  9. data/app/assets/javascripts/alchemy/alchemy.elements_window.js +47 -43
  10. data/app/assets/javascripts/alchemy/alchemy.file_progress.js +27 -17
  11. data/app/assets/javascripts/alchemy/alchemy.growler.js +19 -15
  12. data/app/assets/javascripts/alchemy/alchemy.html5.js +1 -2
  13. data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +10 -11
  14. data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +6 -6
  15. data/app/assets/javascripts/alchemy/alchemy.js_extensions.js +4 -6
  16. data/app/assets/javascripts/alchemy/alchemy.menubar.js +16 -20
  17. data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +18 -16
  18. data/app/assets/javascripts/alchemy/alchemy.preview.js +30 -30
  19. data/app/assets/javascripts/alchemy/alchemy.preview_window.js +50 -42
  20. data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +11 -11
  21. data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +83 -86
  22. data/app/assets/javascripts/alchemy/alchemy.uploader.js +106 -112
  23. data/app/assets/javascripts/alchemy/alchemy.windows.js +158 -130
  24. data/app/assets/stylesheets/alchemy/base.css.scss +7 -1
  25. data/app/assets/stylesheets/alchemy/buttons.css.scss +31 -25
  26. data/app/assets/stylesheets/alchemy/elements.css.scss +4 -0
  27. data/app/controllers/alchemy/admin/base_controller.rb +5 -1
  28. data/app/helpers/alchemy/admin/base_helper.rb +21 -13
  29. data/app/helpers/alchemy/admin/contents_helper.rb +52 -11
  30. data/app/helpers/alchemy/admin/elements_helper.rb +0 -1
  31. data/app/helpers/alchemy/admin/essences_helper.rb +5 -5
  32. data/app/helpers/alchemy/essences_helper.rb +1 -0
  33. data/app/models/alchemy/content.rb +102 -91
  34. data/app/models/alchemy/essence_boolean.rb +8 -0
  35. data/app/models/alchemy/essence_select.rb +7 -0
  36. data/app/sweepers/alchemy/content_sweeper.rb +2 -4
  37. data/app/views/alchemy/admin/clipboard/clear.js.erb +3 -2
  38. data/app/views/alchemy/admin/clipboard/index.html.erb +2 -2
  39. data/app/views/alchemy/admin/contents/create.js.erb +2 -0
  40. data/app/views/alchemy/admin/contents/destroy.js.coffee +4 -0
  41. data/app/views/alchemy/admin/contents/new.html.erb +1 -1
  42. data/app/views/alchemy/admin/elements/_element_foot.html.erb +3 -2
  43. data/app/views/alchemy/admin/elements/create.js.coffee +31 -0
  44. data/app/views/alchemy/admin/elements/fold.js.coffee +37 -0
  45. data/app/views/alchemy/admin/essence_pictures/assign.js.coffee +15 -0
  46. data/app/views/alchemy/admin/essence_pictures/destroy.js.coffee +19 -0
  47. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +12 -2
  48. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
  49. data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
  50. data/app/views/alchemy/admin/pages/destroy.js.coffee +19 -0
  51. data/app/views/alchemy/admin/pages/edit.html.erb +5 -5
  52. data/app/views/alchemy/admin/pages/update.js.coffee +36 -0
  53. data/app/views/alchemy/admin/resources/_form.html.erb +12 -1
  54. data/app/views/alchemy/admin/resources/_resource.html.erb +6 -3
  55. data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
  56. data/app/views/alchemy/admin/trash/clear.js.coffee +4 -0
  57. data/app/views/alchemy/admin/trash/index.html.erb +4 -4
  58. data/app/views/alchemy/elements/_article_editor.html.erb +4 -2
  59. data/app/views/alchemy/elements/_article_view.html.erb +7 -7
  60. data/app/views/alchemy/elements/_download_editor.html.erb +4 -1
  61. data/app/views/alchemy/elements/_download_view.html.erb +7 -3
  62. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +1 -0
  63. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +11 -9
  64. data/app/views/alchemy/essences/_essence_boolean_editor.html.erb +14 -0
  65. data/app/views/alchemy/essences/_essence_boolean_view.html.erb +1 -0
  66. data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
  67. data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
  68. data/app/views/alchemy/essences/_essence_html_editor.html.erb +1 -1
  69. data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +1 -1
  70. data/app/views/alchemy/essences/_essence_select_editor.html.erb +35 -0
  71. data/app/views/alchemy/essences/_essence_select_view.html.erb +1 -0
  72. data/app/views/alchemy/essences/_essence_text_editor.html.erb +29 -77
  73. data/app/views/alchemy/essences/_essence_text_view.html.erb +2 -2
  74. data/config/alchemy/elements.yml +72 -44
  75. data/config/locales/alchemy.de.yml +46 -45
  76. data/config/locales/alchemy.en.yml +90 -89
  77. data/db/migrate/20120608085509_create_alchemy_essence_selects.rb +11 -0
  78. data/db/migrate/20120611221734_create_alchemy_essence_booleans.rb +11 -0
  79. data/lib/alchemy/authentication_helpers.rb +3 -7
  80. data/lib/alchemy/engine.rb +3 -4
  81. data/lib/alchemy/essence.rb +24 -16
  82. data/lib/alchemy/resource.rb +22 -3
  83. data/lib/alchemy/resources_helper.rb +8 -0
  84. data/lib/alchemy/seeder.rb +26 -1
  85. data/lib/alchemy/upgrader.rb +70 -1
  86. data/lib/alchemy/version.rb +1 -1
  87. data/lib/alchemy_cms.rb +1 -0
  88. data/spec/controllers/admin/clipboard_controller_spec.rb +16 -4
  89. data/spec/controllers/admin/contents_controller_spec.rb +21 -4
  90. data/spec/dummy/app/models/event.rb +1 -1
  91. data/spec/dummy/db/schema.rb +18 -1
  92. data/spec/helpers/admin/contents_helper_spec.rb +3 -2
  93. data/spec/models/clipboard_spec.rb +14 -3
  94. data/spec/models/essence_boolean_spec.rb +15 -0
  95. data/spec/models/essence_select_spec.rb +15 -0
  96. data/spec/models/resource_spec.rb +113 -0
  97. metadata +40 -12
  98. data/app/views/alchemy/admin/contents/destroy.js.erb +0 -7
  99. data/app/views/alchemy/admin/elements/create.js.erb +0 -36
  100. data/app/views/alchemy/admin/elements/fold.js.erb +0 -41
  101. data/app/views/alchemy/admin/essence_pictures/assign.js.erb +0 -16
  102. data/app/views/alchemy/admin/essence_pictures/destroy.js.erb +0 -20
  103. data/app/views/alchemy/admin/pages/destroy.js.erb +0 -12
  104. data/app/views/alchemy/admin/pages/update.js.erb +0 -40
  105. data/app/views/alchemy/admin/trash/clear.js.erb +0 -3
  106. 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 (message, flash_type) {
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', { direction:"up" }, 400, function () {
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
- .css({cursor:'pointer'})
28
- .click(function () {
29
- $(this).hide('drop', { direction:"up" }, 400, function () {
30
- $(this).remove();
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
- Alchemy.growl = function (message, style) {
38
- if (typeof(style) === 'undefined') {
39
- style = 'notice';
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 (box, size_x, size_y, default_box, ratio) {
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 (coords) {
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 (callback) {
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], done = false;
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 (t, i) {
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 (t, i) {
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 (options) {
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
- .append('<ul/>');
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 (id) {
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 (e) {
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({cursor:'default'});
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:{ outline:'0 none' },
18
- hover:{
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
- selected:{
27
- 'outline-width':'2px',
28
- 'outline-style':'solid',
29
- 'outline-color':'#DB694C',
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 (e) {
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 (e) {
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:$this.offset().top - offset,
68
- scrollLeft:$this.offset().left - offset
67
+ scrollTop: $this.offset().top - offset,
68
+ scrollLeft: $this.offset().left - offset
69
69
  }, 400);
70
70
  },
71
71
 
72
- clickElement:function (e) {
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 (url, title) {
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({'background-color':'#ffffff'});
19
+ $iframe.css({
20
+ 'background-color': '#ffffff'
21
+ });
20
22
  Alchemy.PreviewWindow.currentWindow = $iframe.dialog({
21
- modal:false,
22
- title:title,
23
- width:$(window).width() - 504,
24
- height:$(window).height() - 78,
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 (event, ui) {
42
+ close: function(event, ui) {
41
43
  Alchemy.PreviewWindow.button.enable();
42
44
  },
43
- open:function (event, ui) {
44
- $(this).css({width:'100%'});
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
- "maximize":true,
50
- "dblclick":"maximize",
51
- "events":{
52
- beforeMaximize:function (evt, dlg) {
53
- Alchemy.previewWindowPosition = $('#alchemyPreviewWindow').dialog('widget').offset();
54
- Alchemy.previewWindowFrameWidth = $('#alchemyPreviewWindow').width();
55
- },
56
- maximize:function (evt, dlg) {
57
- $('#alchemyPreviewWindow').css({width:"100%"});
58
- },
59
- restore:function (evt, dlg) {
60
- $('#alchemyPreviewWindow').dialog('widget').css(Alchemy.previewWindowPosition);
61
- $('#alchemyPreviewWindow').css({width:Alchemy.previewWindowFrameWidth});
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