scrivito_editors 1.1.1 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/scrivito_editors/binary_editor.js +132 -3
  3. data/app/assets/javascripts/scrivito_editors/enum_editor.js +42 -49
  4. data/app/assets/javascripts/scrivito_editors/linklist_editor.js +3 -2
  5. data/app/assets/javascripts/scrivito_editors/multienum_editor.js +39 -34
  6. data/app/assets/javascripts/scrivito_editors/permalink_editor.js +3 -0
  7. data/app/assets/javascripts/scrivito_editors/referencelist_editor.js +4 -2
  8. data/app/assets/javascripts/scrivito_editors/slider_editor.js +15 -5
  9. data/app/assets/javascripts/scrivito_editors/stringlist_editor.js +3 -0
  10. data/app/assets/javascripts/scrivito_editors.js +14 -2
  11. data/app/assets/stylesheets/scrivito_editors/{editors/image_drop_editor.css → image_drop_editor.css} +0 -0
  12. data/app/assets/stylesheets/{scrivito-editors-imglykit-override.css → scrivito_editors/imglykit_override.css} +0 -0
  13. data/app/assets/stylesheets/scrivito_editors/{editors/link_editor.css → link_editor.css} +0 -0
  14. data/app/assets/stylesheets/scrivito_editors/{editors/linklist_editor.css → linklist_editor.css} +2 -2
  15. data/app/assets/stylesheets/scrivito_editors/{editors/medium_editor.css → medium_editor.css} +0 -0
  16. data/app/assets/stylesheets/scrivito_editors/{editors/redactor_editor.css → redactor_editor.css} +0 -0
  17. data/app/assets/stylesheets/scrivito_editors/{editors/referencelist_editor.css → referencelist_editor.css} +2 -2
  18. data/app/assets/stylesheets/scrivito_editors/ui_container.css +105 -0
  19. data/app/assets/stylesheets/scrivito_editors.css +1 -1
  20. data/lib/scrivito_editors/engine.rb +1 -1
  21. data/{app → vendor}/assets/images/imgly_sdk/ui/night/blur/blur.png +0 -0
  22. data/{app → vendor}/assets/images/imgly_sdk/ui/night/buttons/back.png +0 -0
  23. data/{app → vendor}/assets/images/imgly_sdk/ui/night/buttons/done-highlighted.png +0 -0
  24. data/{app → vendor}/assets/images/imgly_sdk/ui/night/buttons/done.png +0 -0
  25. data/{app → vendor}/assets/images/imgly_sdk/ui/night/cancel.png +0 -0
  26. data/{app → vendor}/assets/images/imgly_sdk/ui/night/close.png +0 -0
  27. data/{app → vendor}/assets/images/imgly_sdk/ui/night/crop/16-9.png +0 -0
  28. data/{app → vendor}/assets/images/imgly_sdk/ui/night/crop/4-3.png +0 -0
  29. data/{app → vendor}/assets/images/imgly_sdk/ui/night/crop/custom.png +0 -0
  30. data/{app → vendor}/assets/images/imgly_sdk/ui/night/crop/square.png +0 -0
  31. data/{app → vendor}/assets/images/imgly_sdk/ui/night/crosshair.png +0 -0
  32. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/a15.png +0 -0
  33. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/breeze.png +0 -0
  34. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/bw.png +0 -0
  35. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/bwhard.png +0 -0
  36. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/celsius.png +0 -0
  37. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/chest.png +0 -0
  38. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/default.png +0 -0
  39. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/fixie.png +0 -0
  40. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/food.png +0 -0
  41. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/fridge.png +0 -0
  42. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/front.png +0 -0
  43. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/glam.png +0 -0
  44. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/gobblin.png +0 -0
  45. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/identity.png +0 -0
  46. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/k1.png +0 -0
  47. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/k2.png +0 -0
  48. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/k6.png +0 -0
  49. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/kdynamic.png +0 -0
  50. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/lenin.png +0 -0
  51. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/lomo.png +0 -0
  52. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/mellow.png +0 -0
  53. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/morning.png +0 -0
  54. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/orchid.png +0 -0
  55. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/pola.png +0 -0
  56. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/pola669.png +0 -0
  57. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/quozi.png +0 -0
  58. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/semired.png +0 -0
  59. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/sunny.png +0 -0
  60. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/texas.png +0 -0
  61. data/{app → vendor}/assets/images/imgly_sdk/ui/night/filters/x400.png +0 -0
  62. data/{app → vendor}/assets/images/imgly_sdk/ui/night/flip/horizontal.png +0 -0
  63. data/{app → vendor}/assets/images/imgly_sdk/ui/night/flip/vertical.png +0 -0
  64. data/{app → vendor}/assets/images/imgly_sdk/ui/night/loading.gif +0 -0
  65. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/brightness.png +0 -0
  66. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/contrast.png +0 -0
  67. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/crop.png +0 -0
  68. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/filters.png +0 -0
  69. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/flip.png +0 -0
  70. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/focus.png +0 -0
  71. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/frames.png +0 -0
  72. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/orientation.png +0 -0
  73. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/radial-blur.png +0 -0
  74. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/rotation.png +0 -0
  75. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/saturation.png +0 -0
  76. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/stickers.png +0 -0
  77. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/text.png +0 -0
  78. data/{app → vendor}/assets/images/imgly_sdk/ui/night/operations/tilt-shift.png +0 -0
  79. data/{app → vendor}/assets/images/imgly_sdk/ui/night/rotation/left.png +0 -0
  80. data/{app → vendor}/assets/images/imgly_sdk/ui/night/rotation/right.png +0 -0
  81. data/{app → vendor}/assets/images/imgly_sdk/ui/night/slider/minus.png +0 -0
  82. data/{app → vendor}/assets/images/imgly_sdk/ui/night/slider/plus.png +0 -0
  83. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/aspect.png +0 -0
  84. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/new.png +0 -0
  85. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/original.png +0 -0
  86. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/undo.png +0 -0
  87. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/zoom-in.png +0 -0
  88. data/{app → vendor}/assets/images/imgly_sdk/ui/night/top/zoom-out.png +0 -0
  89. data/{app → vendor}/assets/images/imgly_sdk/ui/night/transparency.png +0 -0
  90. data/{app → vendor}/assets/images/imgly_sdk/ui/night/upload.png +0 -0
  91. data/{app → vendor}/assets/javascripts/canvas-to-blob.js +0 -0
  92. data/{app → vendor}/assets/javascripts/imglykit.js +0 -0
  93. data/{app → vendor}/assets/javascripts/jquery-ui-timepicker-addon.min.js +0 -0
  94. data/vendor/assets/javascripts/jquery.tag-editor.js +68 -38
  95. data/vendor/assets/javascripts/scrivito_editors_sortable.js +1278 -0
  96. data/{app → vendor}/assets/stylesheets/imglykit-night-ui.css +0 -0
  97. data/{app → vendor}/assets/stylesheets/jquery-ui-timepicker-addon.min.css +0 -0
  98. data/vendor/assets/stylesheets/jquery.tag-editor.css +9 -13
  99. data/{app → vendor}/assets/stylesheets/redactor.css +0 -0
  100. metadata +91 -92
  101. data/app/assets/javascripts/scrivito_editors_addons.js +0 -5
  102. data/app/assets/javascripts/scrivito_editors_core.js +0 -8
  103. data/app/assets/stylesheets/scrivito_editors/editors/button_container.css +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82a5c9f951fb245af9a2a20d50dcec8e368eb783
4
- data.tar.gz: eab4c5b36cda4f9bdc09ec82477468b14c5f2a44
3
+ metadata.gz: 75bc3d7b5e3175e28a316ba80138334d22be9d8b
4
+ data.tar.gz: 06adf7c2711879ba8c4b1e25efc681654acb00c6
5
5
  SHA512:
6
- metadata.gz: caab828061be009959fd68b1e2bd19e07a898e791214a4cae3b78f57c1c765649ae7ca96212d634aca0317f437e36fc1bcb19e745b310efc69641c1060ad8171
7
- data.tar.gz: 800812f22ebd26ea190b459993a94390b21e968943b96989befc77b2484529a5fa4baa73e0772ed0cab028b53e69e080c642efa2c36a2dae3dfc35e0b925c1d2
6
+ metadata.gz: 75631fb4a7697f656a779d7fe898ab1061b815cca24301c4c63b38e68d23fdc4076a23e4bee25b02b32d928f367dc5019e5467463ad40632388c91f79debb1d1
7
+ data.tar.gz: 6f87b6fcc5b848a136598a508bfefc58dfcc160653b7350859f18ad0eb5a3273913f8edcea01c3a1007b5f405814dcc25f10d593d274c28ae8ff404705afb2e5
@@ -1,18 +1,147 @@
1
1
  (function() {
2
- var activate, showDeleteButton;
2
+ var activate, disableRenameButton, enableRenameButton, getEditFileNameTemplate, hideError, hideProggresBar, rename, setupInputValidation, setupKeyBehaviour, showDeleteButton, showEditFileNameButton, showError, showProgressBar;
3
3
 
4
4
  activate = function(element) {
5
5
  var cmsField, container;
6
6
  cmsField = $(element);
7
- container = scrivito.editors._setup_binary_button_container(cmsField, 'scrivito-editor-binary-button-container');
7
+ container = scrivito.editors._setup_binary_button_container(cmsField, 'scrivito-editor-binary-ui-container');
8
8
  scrivito.editors._file_dropzone(container, function(_, file) {
9
9
  return cmsField.scrivito('save', file).then(function() {
10
10
  return cmsField.scrivito('reload');
11
11
  });
12
12
  }, 'image-editor-dragover');
13
13
  if (cmsField.scrivito('content') && cmsField.is('[data-scrivito-editors-allow-delete]')) {
14
- return showDeleteButton(container, cmsField);
14
+ showDeleteButton(container, cmsField);
15
15
  }
16
+ return showEditFileNameButton(container, cmsField);
17
+ };
18
+
19
+ showEditFileNameButton = function(container, cmsField) {
20
+ var binary, editor, fileName, fileNameVisibility, renameBtn;
21
+ binary = cmsField.scrivito("content");
22
+ fileNameVisibility = cmsField.data('scrivito-editors-binary-filename');
23
+ if (typeof fileNameVisibility === "undefined") {
24
+ fileNameVisibility = true;
25
+ }
26
+ if (binary && fileNameVisibility) {
27
+ fileName = binary.filename;
28
+ editor = $(getEditFileNameTemplate(fileName)).appendTo(container);
29
+ setupKeyBehaviour(editor, cmsField);
30
+ setupInputValidation(binary, editor);
31
+ renameBtn = editor.find(".scrivito_file_save");
32
+ return renameBtn.click((function(_this) {
33
+ return function() {
34
+ return rename(cmsField, editor);
35
+ };
36
+ })(this));
37
+ }
38
+ };
39
+
40
+ rename = function(cmsField, editor) {
41
+ var binary, fileName, newBinary;
42
+ if (editor.find(".scrivito_file_save").hasClass("scrivito_disabled")) {
43
+ return false;
44
+ }
45
+ showProgressBar(editor);
46
+ binary = cmsField.scrivito("content");
47
+ fileName = editor.find('#binary_file_name').val();
48
+ newBinary = binary.copy({
49
+ filename: fileName
50
+ });
51
+ return cmsField.scrivito("save", newBinary).then(function() {
52
+ return cmsField.scrivito('reload');
53
+ }).fail(function() {
54
+ return hideProggresBar(editor);
55
+ }) && false;
56
+ };
57
+
58
+ setupInputValidation = function(binary, editor) {
59
+ var input;
60
+ input = editor.find('#binary_file_name');
61
+ disableRenameButton(editor);
62
+ return input.on('input', (function(_this) {
63
+ return function() {
64
+ var filename, message;
65
+ filename = input.val();
66
+ disableRenameButton(editor);
67
+ hideError(editor);
68
+ if (filename.match(/^[\w.-]+$/)) {
69
+ if (filename !== binary.filename) {
70
+ return enableRenameButton(editor);
71
+ }
72
+ } else {
73
+ message = 'The filename may only contain letters from A to Z, periods, hyphens, and underscores.';
74
+ return showError(message, editor);
75
+ }
76
+ };
77
+ })(this));
78
+ };
79
+
80
+ disableRenameButton = function(editor) {
81
+ var saveElement;
82
+ saveElement = editor.find('.scrivito_file_save');
83
+ return saveElement.addClass('scrivito_disabled');
84
+ };
85
+
86
+ enableRenameButton = function(editor) {
87
+ var saveElement;
88
+ saveElement = editor.find('.scrivito_file_save');
89
+ return saveElement.removeClass('scrivito_disabled scrivito_saving');
90
+ };
91
+
92
+ showError = function(message, editor) {
93
+ var errorElement, errorMessage;
94
+ errorElement = editor.find('div.scrivito_error');
95
+ editor.find('#binary_file_name').addClass('scrivito_error');
96
+ errorMessage = editor.find('.scrivito_error_message');
97
+ errorMessage.text(message);
98
+ return errorElement.show();
99
+ };
100
+
101
+ hideError = function(editor) {
102
+ var errorElement;
103
+ errorElement = editor.find('div.scrivito_error');
104
+ editor.find('#binary_file_name').removeClass('scrivito_error');
105
+ return errorElement.hide();
106
+ };
107
+
108
+ showProgressBar = function(editor) {
109
+ var button, input;
110
+ input = editor.find('#binary_file_name');
111
+ input.attr('disabled', 'disabled');
112
+ disableRenameButton(editor);
113
+ button = editor.find('.scrivito_file_save');
114
+ button.addClass('scrivito_saving');
115
+ return button.find('span').text('Renaming...');
116
+ };
117
+
118
+ hideProggresBar = function(editor) {
119
+ var button, input;
120
+ input = editor.find('#binary_file_name');
121
+ button = editor.find('.scrivito_file_save');
122
+ input.removeAttr('disabled');
123
+ enableRenameButton(editor);
124
+ return button.find('span').text('Rename');
125
+ };
126
+
127
+ setupKeyBehaviour = function(editor, cmsField) {
128
+ return editor.on('keyup', function(event) {
129
+ var input;
130
+ switch (event.keyCode) {
131
+ case 13:
132
+ return rename(cmsField, editor);
133
+ case 27:
134
+ input = editor.find('#binary_file_name');
135
+ input.val(cmsField.scrivito('content').filename);
136
+ hideError(editor);
137
+ disableRenameButton(editor);
138
+ return input.blur();
139
+ }
140
+ });
141
+ };
142
+
143
+ getEditFileNameTemplate = function(content) {
144
+ return "<div class=\"scrivito_binary_file_name_editor\">\n <div class=\"scrivito_binary_file_name_editor_wrapper\">\n <input type=\"text\" id=\"binary_file_name\" value=\"" + content + "\" />\n <a href=\"#\" class=\"scrivito_editing_button scrivito_file_save\">\n <span>Rename</span>\n </a>\n <div class=\"scrivito_error\">\n <span class=\"scrivito_error_icon\" />\n <span class=\"scrivito_error_message\" />\n </div>\n </div>\n</div>";
16
145
  };
17
146
 
18
147
  showDeleteButton = function(container, cmsField) {
@@ -1,65 +1,58 @@
1
1
  (function() {
2
- var activate, blur, change, save, template;
2
+ var activate, handleClick, renderTemplate, save;
3
3
 
4
- template = function(values) {
5
- var element;
6
- element = $('<select></select>').addClass('form-control');
7
- $.each(values, function(index, value) {
8
- return $('<option></option>').attr('value', value).text(value).appendTo(element);
9
- });
10
- return element;
11
- };
12
-
13
- save = function(event, options) {
14
- var cmsField, content, element;
15
- element = $(event.currentTarget);
16
- cmsField = element.data('scrivitoEditorsCmsField');
17
- content = element.val();
18
- if (content === '') {
19
- content = null;
4
+ scrivito.editors.enum_editor = {
5
+ can_edit: function(element) {
6
+ return $(element).is('[data-scrivito-field-type=enum]');
7
+ },
8
+ activate: function(element) {
9
+ return activate($(element));
20
10
  }
21
- return cmsField.scrivito('save', content).done(function() {
22
- cmsField.trigger('scrivito_editors:save');
23
- if (options != null ? options.blur : void 0) {
24
- return cmsField.trigger('scrivito_editors:blur');
25
- }
26
- });
27
11
  };
28
12
 
29
- change = function(event) {
30
- return save(event);
31
- };
13
+ scrivito.on('load', function() {
14
+ return scrivito.define_editor('enum', scrivito.editors.enum_editor);
15
+ });
32
16
 
33
- blur = function(event) {
34
- return save(event, {
35
- blur: true
17
+ activate = function(cmsField) {
18
+ cmsField.html(renderTemplate(cmsField.scrivito('content'), cmsField.scrivito('valid_values')));
19
+ return cmsField.find('.scrivito_enum_editor li').on('click', function() {
20
+ return handleClick(cmsField, $(this));
36
21
  });
37
22
  };
38
23
 
39
- activate = function(element) {
40
- var cmsField;
41
- cmsField = $(element);
42
- return cmsField.on('click', function() {
43
- var content, values;
44
- content = cmsField.scrivito('content');
45
- values = cmsField.scrivito('allowed_values');
46
- values.unshift('');
47
- template(values).data('scrivitoEditorsCmsField', cmsField).val(content || '').insertAfter(cmsField).change(change).blur(blur).focus();
48
- return cmsField.hide();
49
- });
24
+ renderTemplate = function(value, validValues) {
25
+ var i, len, li, ul, validValue;
26
+ ul = $('<ul class="scrivito_enum_editor"></ul>');
27
+ for (i = 0, len = validValues.length; i < len; i++) {
28
+ validValue = validValues[i];
29
+ li = $('<li></li>');
30
+ li.text(validValue);
31
+ if (validValue === value) {
32
+ li.addClass('scrivito_enum_active');
33
+ }
34
+ ul.append(li);
35
+ }
36
+ return ul;
50
37
  };
51
38
 
52
- scrivito.editors.enum_editor = {
53
- can_edit: function(element) {
54
- return $(element).is('[data-scrivito-field-type=enum]');
55
- },
56
- activate: function(element) {
57
- return activate(element);
39
+ handleClick = function(cmsField, clickedItem) {
40
+ if (clickedItem.hasClass('scrivito_enum_active')) {
41
+ clickedItem.removeClass('scrivito_enum_active');
42
+ save(cmsField, null);
43
+ } else {
44
+ cmsField.find('li').removeClass('scrivito_enum_active');
45
+ clickedItem.addClass('scrivito_enum_active');
46
+ save(cmsField, clickedItem.text());
58
47
  }
48
+ return false;
59
49
  };
60
50
 
61
- scrivito.on('load', function() {
62
- return scrivito.define_editor('enum', scrivito.editors.enum_editor);
63
- });
51
+ save = function(cmsField, value) {
52
+ return cmsField.scrivito('save', value).done(function() {
53
+ cmsField.trigger('scrivito_editors:save');
54
+ return cmsField.trigger('scrivito_editors:blur');
55
+ });
56
+ };
64
57
 
65
58
  }).call(this);
@@ -68,8 +68,9 @@
68
68
  attachHandlers = function(cmsField) {
69
69
  var j, len, li, ref, results, ul;
70
70
  ul = cmsField.find('ul');
71
- ul.sortable({
72
- update: function() {
71
+ scrivito.editors.Sortable.create(ul.get(0), {
72
+ ghostClass: 'scrivito-sortable-placeholder',
73
+ onUpdate: function() {
73
74
  return save(cmsField);
74
75
  }
75
76
  });
@@ -1,48 +1,53 @@
1
1
  (function() {
2
- var activate, save, template;
3
-
4
- template = function(values) {
5
- var element;
6
- element = $('<select></select>').attr('multiple', 'true');
7
- $.each(values, function(index, value) {
8
- return $('<option></option>').attr('value', value).text(value).appendTo(element);
9
- });
10
- return element;
11
- };
12
-
13
- save = function(event) {
14
- var cmsField, content, element, ref;
15
- element = $(event.currentTarget);
16
- cmsField = element.data('cmsField');
17
- content = (ref = element.val()) != null ? ref : [];
18
- return cmsField.scrivito('save', content).done(function() {
19
- return cmsField.trigger('save.scrivito_editors');
20
- });
21
- };
22
-
23
- activate = function(element) {
24
- var cmsField;
25
- cmsField = $(element);
26
- return cmsField.on('click', function() {
27
- var selected, values;
28
- selected = cmsField.scrivito('content');
29
- values = cmsField.scrivito('allowed_values');
30
- template(values).data('cmsField', cmsField).val(selected).insertAfter(cmsField).change(save).focusout(save).focus();
31
- return cmsField.hide();
32
- });
33
- };
2
+ var activate, handleClick, renderTemplate,
3
+ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
34
4
 
35
5
  scrivito.editors.multienum_editor = {
36
6
  can_edit: function(element) {
37
7
  return $(element).is('[data-scrivito-field-type=multienum]');
38
8
  },
39
9
  activate: function(element) {
40
- return activate(element);
10
+ return activate($(element));
41
11
  }
42
12
  };
43
13
 
44
14
  scrivito.on('load', function() {
45
- return scrivito.define_editor('multienum', scrivito.editors.multienum_editor);
15
+ return scrivito.define_editor('multienum', scrivito.editors.enum_editor);
46
16
  });
47
17
 
18
+ activate = function(cmsField) {
19
+ cmsField.html(renderTemplate(cmsField.scrivito('content'), cmsField.scrivito('valid_values')));
20
+ return cmsField.find('.scrivito_enum_editor li').on('click', function() {
21
+ return handleClick(cmsField, $(this));
22
+ });
23
+ };
24
+
25
+ renderTemplate = function(values, validValues) {
26
+ var i, len, li, ul, validValue;
27
+ ul = $('<ul class="scrivito_enum_editor scrivito_multi"></ul>');
28
+ for (i = 0, len = validValues.length; i < len; i++) {
29
+ validValue = validValues[i];
30
+ li = $('<li></li>');
31
+ li.text(validValue);
32
+ if (indexOf.call(values, validValue) >= 0) {
33
+ li.addClass('scrivito_enum_active');
34
+ }
35
+ ul.append(li);
36
+ }
37
+ return ul;
38
+ };
39
+
40
+ handleClick = function(cmsField, clickedItem) {
41
+ var values;
42
+ clickedItem.toggleClass('scrivito_enum_active');
43
+ values = $.map(cmsField.find('li.scrivito_enum_active'), function(item) {
44
+ return $(item).text();
45
+ });
46
+ cmsField.scrivito('save', values).done(function() {
47
+ cmsField.trigger('scrivito_editors:save');
48
+ return cmsField.trigger('scrivito_editors:blur');
49
+ });
50
+ return false;
51
+ };
52
+
48
53
  }).call(this);
@@ -15,6 +15,9 @@
15
15
  if (permalink === field.scrivito('content')) {
16
16
  hideError();
17
17
  return disableSaveButton();
18
+ } else if (permalink.split('/')[0] === 'scrivito') {
19
+ showError('The permalink cannot be "scrivito" or start with "scrivito/".');
20
+ return disableSaveButton();
18
21
  } else if (permalink.match(/^([\w._-]+[\/\w._-]*)?$/)) {
19
22
  hideError();
20
23
  return enableSaveButton();
@@ -94,8 +94,10 @@
94
94
  var cmsField;
95
95
  cmsField = $(dom_element);
96
96
  render(cmsField);
97
- return cmsField.on('click', 'li a.delete', remove).on('click', 'button.content-browser-open', onContentBrowserOpen).find('ul').sortable({
98
- update: function(event) {
97
+ cmsField.on('click', 'li a.delete', remove).on('click', 'button.content-browser-open', onContentBrowserOpen);
98
+ return scrivito.editors.Sortable.create(cmsField.find('ul').get(0), {
99
+ ghostClass: 'scrivito-sortable-placeholder',
100
+ onUpdate: function(event) {
99
101
  var ids;
100
102
  cmsField = getCmsField($(event.target));
101
103
  ids = collectIds(cmsField);
@@ -1,5 +1,5 @@
1
1
  (function() {
2
- var activate, onSlide, onStop, template;
2
+ var activate, onSlide, onStop, parse, template;
3
3
 
4
4
  template = function() {
5
5
  return $('<div></div>');
@@ -22,6 +22,16 @@
22
22
  return cmsField.text(ui.value);
23
23
  };
24
24
 
25
+ parse = function(string, fallback) {
26
+ var value;
27
+ value = parseInt(string);
28
+ if (isNaN(value)) {
29
+ return fallback;
30
+ } else {
31
+ return value;
32
+ }
33
+ };
34
+
25
35
  activate = function(element) {
26
36
  return $(element).on('click', function() {
27
37
  var cmsField, content, max, min, step;
@@ -35,10 +45,10 @@
35
45
  max = cmsField.data('scrivito-editors-max');
36
46
  step = cmsField.data('scrivito-editors-step');
37
47
  return template().data('cmsField', cmsField).insertAfter(cmsField).slider({
38
- min: parseInt(min) || 1,
39
- max: parseInt(max) || 10,
40
- step: parseInt(step) || 1,
41
- value: parseInt(content) || 0,
48
+ min: parse(min, 1),
49
+ max: parse(max, 10),
50
+ step: parse(step, 1),
51
+ value: parse(content, 0),
42
52
  range: 'min',
43
53
  slide: onSlide,
44
54
  stop: onStop
@@ -19,6 +19,9 @@
19
19
  };
20
20
  })(this)
21
21
  },
22
+ delimiter: "",
23
+ forceLowercase: false,
24
+ maxLength: Number.POSITIVE_INFINITY,
22
25
  onChange: function(field, editor, tags) {
23
26
  return field.scrivito('save', tags);
24
27
  }
@@ -13,5 +13,17 @@
13
13
  //= require jquery.caret
14
14
  //= require jquery.tag-editor
15
15
  //= require medium-editor
16
- //= require scrivito_editors_addons
17
- //= require scrivito_editors_core
16
+ //= require jquery-ui/sortable
17
+ //= require jquery-ui/datepicker
18
+ //= require jquery-ui/slider
19
+ //= require jquery-ui-timepicker-addon.min
20
+ //= require jquery-ui/autocomplete
21
+ //= require redactor
22
+ //= require redactor_plugins/table
23
+ //= require canvas-to-blob
24
+ //= require imglykit
25
+ //= require_self
26
+ //= require scrivito_editors_sortable
27
+ //= require_tree ./scrivito_editors
28
+
29
+ scrivito.editors = {};
@@ -20,7 +20,7 @@
20
20
  border: 1px solid #ddd;
21
21
  }
22
22
 
23
- [data-scrivito-field-type="linklist"] ul li.ui-sortable-placeholder:before {
23
+ [data-scrivito-field-type="linklist"] ul li.scrivito-sortable-placeholder:before {
24
24
  display:none;
25
25
  }
26
26
 
@@ -66,7 +66,7 @@
66
66
  cursor: move;
67
67
  }
68
68
 
69
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="linklist"] ul li.ui-sortable-placeholder {
69
+ [data-scrivito-display-mode="editing"] [data-scrivito-field-type="linklist"] ul li.scrivito-sortable-placeholder {
70
70
  background: #f3f3f3;
71
71
  border: 2px dashed #9bc2cf;
72
72
  opacity: .5;
@@ -24,7 +24,7 @@
24
24
  display: inline-block;
25
25
  }
26
26
 
27
- [data-scrivito-field-type="referencelist"] ul li.ui-sortable-placeholder:before {
27
+ [data-scrivito-field-type="referencelist"] ul li.scrivito-sortable-placeholder:before {
28
28
  display:none;
29
29
  }
30
30
 
@@ -61,7 +61,7 @@
61
61
  cursor: move;
62
62
  }
63
63
 
64
- [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li.ui-sortable-placeholder {
64
+ [data-scrivito-display-mode="editing"] [data-scrivito-field-type="referencelist"] ul li.scrivito-sortable-placeholder {
65
65
  background: #f3f3f3;
66
66
  border: 2px dashed #9bc2cf;
67
67
  height: 36px;
@@ -0,0 +1,105 @@
1
+
2
+ .scrivito-editor-image-button-container {
3
+ display:inline-block; position: relative;
4
+ max-width:100%;
5
+ }
6
+ .scrivito-editor-binary-ui-container:not(.scrivito-editor-image-button-container) {
7
+ display:block; position: relative;
8
+ box-shadow: 0 0 0 2px rgba(0,0,0,.2);
9
+ min-height: 90px; padding:5px;
10
+ }
11
+
12
+ .scrivito-editor-binary-ui-container:not(.scrivito-editor-image-button-container):not(.scrivito_element_overlay) {
13
+ background: rgba(0,0,0,.1);
14
+ }
15
+
16
+ .scrivito-editor-image-button-container .editing-button,
17
+ .scrivito-editor-binary-ui-container .editing-button {
18
+ padding: 5px 8px; margin: 0px;
19
+ position: absolute; right: 10px; top: 10px;
20
+ background: rgba(0,0,0,.7);
21
+ border:1px solid rgba(255, 255, 255, 0.3);
22
+ box-shadow: 0 0 3px 2px rgba(255, 255, 255, 0.2);
23
+ }
24
+ .scrivito-editor-image-button-container .editing-button:hover,
25
+ .scrivito-editor-binary-ui-container .editing-button:hover {
26
+ background: rgba(88,88,88,.8);
27
+ }
28
+ .scrivito_binary_file_name_editor_wrapper {position: absolute; left: 0; bottom: 0; right: 0;}
29
+ .scrivito_binary_file_name_editor {height: 30px; min-width: 200px;}
30
+ .scrivito_binary_file_name_editor input { background: #fff; border: 1px solid #ddd;
31
+ border-radius:5px ; color: #555;display: block; font-size: 14px; min-height: 32px;
32
+ margin: 0; padding: 4px 120px 4px 12px; width: 100%;
33
+ font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-weight:normal;
34
+ }
35
+ .scrivito_binary_file_name_editor input.scrivito_error {
36
+ color: #aa4040;
37
+ background-size:40px 40px;
38
+ background-color: rgba(170,64,64,.2);
39
+ background-image: linear-gradient(45deg, rgba(255,255,255,.7) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.7) 50%, rgba(255,255,255,.7) 75%, transparent 75%, transparent);
40
+ }
41
+ .scrivito_binary_file_name_editor input:disabled { background: #ddd;cursor: not-allowed;}
42
+ .scrivito_binary_file_name_editor .scrivito_editing_button {position:absolute; top:0; right:0;
43
+ color: #555; cursor: pointer; border:0px; display: inline-block; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
44
+ font-size: 14px; font-weight: normal; line-height: 14px; margin: 0 10px 0 0; min-height: 14px; min-width: 30px;
45
+ padding: 8px 15px; text-align: center; vertical-align: middle; background: #fcfcfc;
46
+ border-radius: 5px; user-select: none; min-width: 120px; padding: 9px 15px; margin:0;
47
+ text-decoration: none; background: #658b51; color: #fff;
48
+ border-top-left-radius: 0; border-bottom-left-radius: 0;
49
+ }
50
+ .scrivito_binary_file_name_editor .scrivito_editing_button:hover { background: #7ea46a;}
51
+ .scrivito_binary_file_name_editor .scrivito_editing_button:active { background: #52783e;}
52
+ .scrivito_binary_file_name_editor .scrivito_clear { position:absolute; top:5px; right:125px;
53
+ line-height:24px; display:block; cursor: pointer; padding:0 5px;
54
+ text-align:center;
55
+ }
56
+ .scrivito_binary_file_name_editor .scrivito_clear:before { font-family: 'scrivito_iconsregular';
57
+ float:left; display:block; padding:0; color:#888; content:'\F03e'; font-size:18px;
58
+ }
59
+
60
+ .scrivito_binary_file_name_editor a.scrivito_disabled { cursor: not-allowed; background: #bbb;}
61
+ .scrivito_binary_file_name_editor a.scrivito_disabled:hover { background: #bbb;}
62
+ .scrivito_binary_file_name_editor a.scrivito_disabled.scrivito_saving { cursor: pointer; background: #7ea46a;}
63
+ .scrivito_binary_file_name_editor a.scrivito_disabled.scrivito_saving:hover { cursor: pointer; background: #7ea46a;}
64
+ .scrivito_binary_file_name_editor div.scrivito_error {
65
+ font-weight:bold;
66
+ display: none;
67
+ position: absolute;
68
+ top: 41px;
69
+ left: 0;
70
+ right: 0;
71
+ padding: 10px;
72
+ margin-bottom: 15px;
73
+ margin-top: -3px;
74
+ font-weight: 300;
75
+ background-color: #33312D; border-radius: 5px; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, .15);
76
+ color: #eee;
77
+ }
78
+ .scrivito_binary_file_name_editor span.scrivito_error_icon:before {
79
+ font-family: 'scrivito_iconsregular';
80
+ float:left;
81
+ display:block;
82
+ padding:0 7px 0 0;
83
+ color:#ff4301;
84
+ content:'\F021';
85
+ font-weight:normal;
86
+ }
87
+
88
+ .scrivito_binary_file_name_editor div.scrivito_error:before {
89
+ content: '';
90
+ position: absolute;
91
+ border-style: solid;
92
+ border-width: 0 11px 11px;
93
+ border-color: #33312D transparent;
94
+ display: block;
95
+ margin-top: -19px;
96
+ width: 0;
97
+ z-index: 1;
98
+ }
99
+
100
+ .scrivito-editor-image-button-container .editing-button + .editing-button,
101
+ .scrivito-editor-binary-ui-container .editing-button + .editing-button {
102
+ right: 50px;
103
+ }
104
+ .scrivito-editor-image-button-container .editing-button .editing-icon,
105
+ .scrivito-editor-binary-ui-container .editing-button .editing-icon { color:#fff;}
@@ -13,6 +13,6 @@
13
13
  *= require jquery-ui-timepicker-addon.min
14
14
  *= require redactor
15
15
  *= require imglykit-night-ui
16
- *= require scrivito-editors-imglykit-override
16
+ *= require scrivito_editors/imglykit_override
17
17
  *= require_tree .
18
18
  */
@@ -20,7 +20,7 @@ module ScrivitoEditors
20
20
  private
21
21
 
22
22
  def imgly_assets_paths
23
- images_path = ScrivitoEditors::Engine.root + 'app/assets/images/'
23
+ images_path = ScrivitoEditors::Engine.root + 'vendor/assets/images/'
24
24
  absolute_paths = Dir[images_path + 'imgly_sdk/**/*'].select { |f| File.file?(f) }
25
25
 
26
26
  absolute_paths.map do |absolute_path|