alchemy-chimera 0.5.4 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +39 -4
  2. package/assets/scripts/chimera/chimera.js +13 -288
  3. package/assets/stylesheets/chimera/chimera.scss +451 -0
  4. package/bootstrap.js +6 -302
  5. package/config/routes.js +53 -5
  6. package/controller/00-chimera_controller.js +16 -0
  7. package/controller/chimera_editor_controller.js +159 -614
  8. package/controller/chimera_static_controller.js +102 -9
  9. package/lib/chimera_config.js +138 -163
  10. package/model/model.js +1 -1
  11. package/package.json +8 -12
  12. package/view/chimera/dashboard.hwk +8 -0
  13. package/view/chimera/editor/index.hwk +20 -0
  14. package/view/chimera/sidebar.hwk +4 -0
  15. package/view/chimera/widgets.hwk +8 -0
  16. package/view/layouts/chimera_base.hwk +15 -0
  17. package/view/layouts/chimera_basics.hwk +15 -0
  18. package/view/layouts/chimera_body.hwk +24 -0
  19. package/assets/scripts/chimera/assoc_field.js +0 -311
  20. package/assets/scripts/chimera/boolean_field.js +0 -53
  21. package/assets/scripts/chimera/chimera_field.js +0 -622
  22. package/assets/scripts/chimera/chimera_field_wrapper.js +0 -558
  23. package/assets/scripts/chimera/date_field.js +0 -170
  24. package/assets/scripts/chimera/geopoint_field.js +0 -147
  25. package/assets/scripts/chimera/medium-button.js +0 -6
  26. package/assets/scripts/chimera/object_field.js +0 -51
  27. package/assets/scripts/chimera/page-editor.js +0 -3
  28. package/assets/scripts/chimera/password_field.js +0 -73
  29. package/assets/scripts/chimera/schema_field.js +0 -300
  30. package/assets/scripts/chimera/text_field.js +0 -119
  31. package/assets/scripts/rome/rome.js +0 -4978
  32. package/assets/scripts/vex/vex.dialog.js +0 -151
  33. package/assets/scripts/vex/vex.js +0 -193
  34. package/assets/stylesheets/chimera/chimera.less +0 -1075
  35. package/assets/stylesheets/chimera_old/chimera.less +0 -351
  36. package/assets/stylesheets/chimera_old/core.less +0 -315
  37. package/assets/stylesheets/chimera_old/font.less +0 -38
  38. package/assets/stylesheets/chimera_old/mixins.less +0 -35
  39. package/assets/stylesheets/chimera_old/page-editor.less +0 -23
  40. package/assets/stylesheets/rome/rome.less +0 -130
  41. package/assets/stylesheets/vex/vex-theme-bottom-right-corner.less +0 -613
  42. package/assets/stylesheets/vex/vex.default.less +0 -501
  43. package/assets/stylesheets/vex/vex.flat.less +0 -443
  44. package/assets/stylesheets/vex/vex.less +0 -320
  45. package/controller/chimera_page_controller.js +0 -14
  46. package/controller/chimera_settings_controller.js +0 -129
  47. package/controller/tasks_chimera_controller.js +0 -106
  48. package/helper/chimera_helper.js +0 -202
  49. package/lib/chimera_action_fields.js +0 -292
  50. package/lib/chimera_field/belongsto_chimera_field.js +0 -160
  51. package/lib/chimera_field/boolean_chimera_field.js +0 -19
  52. package/lib/chimera_field/date_chimera_field.js +0 -20
  53. package/lib/chimera_field/datetime_chimera_field.js +0 -20
  54. package/lib/chimera_field/enum_chimera_field.js +0 -131
  55. package/lib/chimera_field/geopoint_chimera_field.js +0 -20
  56. package/lib/chimera_field/habtm_chimera_field.js +0 -55
  57. package/lib/chimera_field/hasoneparent_chimera_field.js +0 -18
  58. package/lib/chimera_field/html_chimera_field.js +0 -20
  59. package/lib/chimera_field/object_chimera_field.js +0 -18
  60. package/lib/chimera_field/password_chimera_field.js +0 -18
  61. package/lib/chimera_field/schema_chimera_field.js +0 -149
  62. package/lib/chimera_field/text_chimera_field.js +0 -20
  63. package/lib/chimera_field/time_chimera_field.js +0 -18
  64. package/lib/chimera_field.js +0 -208
  65. package/model/setting_model.js +0 -51
  66. package/public/chimera/codedor.svg +0 -28
  67. package/view/chimera/dashboard.ejs +0 -5
  68. package/view/chimera/editor/add.ejs +0 -32
  69. package/view/chimera/editor/edit.ejs +0 -33
  70. package/view/chimera/editor/index.ejs +0 -87
  71. package/view/chimera/editor/remove.ejs +0 -23
  72. package/view/chimera/editor/view.ejs +0 -54
  73. package/view/chimera/elements/editor_actions.ejs +0 -4
  74. package/view/chimera/elements/empty +0 -0
  75. package/view/chimera/field_wrappers/_entries.ejs +0 -91
  76. package/view/chimera/field_wrappers/_wrapper.ejs +0 -82
  77. package/view/chimera/field_wrappers/date_edit.ejs +0 -23
  78. package/view/chimera/field_wrappers/date_list.ejs +0 -3
  79. package/view/chimera/field_wrappers/date_view.ejs +0 -16
  80. package/view/chimera/field_wrappers/default_edit.ejs +0 -22
  81. package/view/chimera/field_wrappers/default_list.ejs +0 -3
  82. package/view/chimera/field_wrappers/default_peek.ejs +0 -3
  83. package/view/chimera/field_wrappers/default_view.ejs +0 -14
  84. package/view/chimera/field_wrappers/geopoint_edit.ejs +0 -25
  85. package/view/chimera/field_wrappers/geopoint_list.ejs +0 -5
  86. package/view/chimera/field_wrappers/geopoint_view.ejs +0 -18
  87. package/view/chimera/field_wrappers/schema_edit.ejs +0 -19
  88. package/view/chimera/field_wrappers/text_edit.ejs +0 -22
  89. package/view/chimera/field_wrappers/text_list.ejs +0 -1
  90. package/view/chimera/fields/belongsto_edit.ejs +0 -4
  91. package/view/chimera/fields/belongsto_list.ejs +0 -1
  92. package/view/chimera/fields/belongsto_peek.ejs +0 -1
  93. package/view/chimera/fields/boolean_edit.ejs +0 -17
  94. package/view/chimera/fields/boolean_list.ejs +0 -3
  95. package/view/chimera/fields/boolean_view.ejs +0 -3
  96. package/view/chimera/fields/date_edit.ejs +0 -14
  97. package/view/chimera/fields/date_list.ejs +0 -9
  98. package/view/chimera/fields/date_peek.ejs +0 -9
  99. package/view/chimera/fields/date_view.ejs +0 -9
  100. package/view/chimera/fields/datetime_edit.ejs +0 -24
  101. package/view/chimera/fields/datetime_list.ejs +0 -9
  102. package/view/chimera/fields/datetime_view.ejs +0 -10
  103. package/view/chimera/fields/default_edit.ejs +0 -10
  104. package/view/chimera/fields/default_list.ejs +0 -15
  105. package/view/chimera/fields/default_view.ejs +0 -1
  106. package/view/chimera/fields/enum_edit.ejs +0 -10
  107. package/view/chimera/fields/geopoint_edit.ejs +0 -10
  108. package/view/chimera/fields/geopoint_list.ejs +0 -9
  109. package/view/chimera/fields/geopoint_view.ejs +0 -9
  110. package/view/chimera/fields/habtm_edit.ejs +0 -5
  111. package/view/chimera/fields/hasoneparent_edit.ejs +0 -6
  112. package/view/chimera/fields/hasoneparent_list.ejs +0 -1
  113. package/view/chimera/fields/object_edit.ejs +0 -8
  114. package/view/chimera/fields/password_edit.ejs +0 -12
  115. package/view/chimera/fields/schema_edit.ejs +0 -14
  116. package/view/chimera/fields/text_edit.ejs +0 -5
  117. package/view/chimera/fields/text_list.ejs +0 -9
  118. package/view/chimera/fields/text_view.ejs +0 -3
  119. package/view/chimera/fields/time_edit.ejs +0 -15
  120. package/view/chimera/fields/time_list.ejs +0 -9
  121. package/view/chimera/fields/time_view.ejs +0 -9
  122. package/view/chimera/page/edit.ejs +0 -18
  123. package/view/chimera/page_editor.ejs +0 -5
  124. package/view/chimera/sidebar.ejs +0 -40
  125. package/view/chimera/tasks/index.ejs +0 -114
  126. package/view/layouts/chimera.ejs +0 -12
  127. package/view/layouts/chimera_base.ejs +0 -11
  128. package/view/layouts/chimera_body.ejs +0 -43
package/CHANGELOG.md CHANGED
@@ -1,7 +1,42 @@
1
- ## 0.5.4 (2019-06-18)
2
-
3
- * Backport fixes from 0.6.0
4
- * Upgrade ajatar-theme
1
+ ## 1.0.2 (2022-02-20)
2
+
3
+ * Improve editor styling
4
+ * Put editor errors in the Widget context
5
+ * Add TOC to editor
6
+ * Make sidebar sticky
7
+
8
+ ## 1.0.1 (2022-01-28)
9
+
10
+ * Allow setting a simple menu sidebar in the config
11
+ * Add simple notification after adding/saving
12
+ * Add page & window titles
13
+ * Improve edit buttons
14
+
15
+ ## 1.0.0 (2021-09-12)
16
+
17
+ * Use widgets to create the interface
18
+ * Release preview version of 1.0.0
19
+
20
+ ## 0.6.0 (2020-07-21)
21
+
22
+ * Make compatible with Alchemy v1.1.0
23
+ * If no field title is found, use the name instead
24
+ * Fix "empty" still showing html content on client renders
25
+ * Use `display_field_select` model property when querying for related data
26
+ * Also use `display_field_select` when querying for the actionValue
27
+ * Do not html-encode string input values, hawkejs will do that
28
+ * Use `display_field_select` property when editing a record & in habtm requests
29
+ * Fix client-side renders of schema fields
30
+ * If a change is made to a translatable field, send it entirely to the server, not just the changed prefix
31
+ * Use ckeditor 4.13 from now on + fix pasting styled text
32
+ * Go back to index page when clicking on save&close and nothing has changed
33
+ * The chimera editor now queries the document before saving, this fixed subschema saves
34
+ * Add checkbox toggle-switch stylings + some small ui fixes
35
+ * Use Tail datetime picker
36
+ * Use `export` field group for exports + use formatted action values
37
+ * Get model title from the `title` property of the class
38
+ * Allow setting a default page size in the plugin config or on the model
39
+ * Make sure to translate `BelongsTo#actionValue()` responses
5
40
 
6
41
  ## 0.5.3 (2018-12-06)
7
42
 
@@ -1,294 +1,19 @@
1
- hawkejs.scene.on({type: 'set', entry: 'chimera/field_wrappers/_wrapper'}, function applyField(element, variables) {
1
+ hawkejs.scene.after({
2
+ type : 'set',
3
+ name : 'page-notification',
4
+ }, function onNotification(element, variables, block) {
2
5
 
3
- // Ignore nested wrappers
4
- if (element.classList.contains('chimeraField-is-nested')) {
5
- return;
6
- }
7
-
8
- hawkejs.require(['chimera/chimera_field_wrapper', 'chimera/chimera_field'], function loaded(err) {
9
-
10
- var options;
11
-
12
- if (err) {
13
- throw err;
14
- }
15
-
16
- // Create the wrap options
17
- options = {
18
- variables: variables,
19
- container: element,
20
- viewname: variables.data.field.viewname
21
- };
22
-
23
- new ChimeraFieldWrapper(options);
24
- });
25
- });
26
-
27
- hawkejs.scene.on({type: 'rendered'}, function rendered(variables, renderData) {
28
-
29
- var key;
30
-
31
- Object.each(variables.__newFlashes, function eachFlash(flash) {
32
- chimeraFlash(flash);
33
- });
34
- });
6
+ let notification = element.querySelector('.notification');
35
7
 
36
- hawkejs.scene.on({type: 'set', name: 'chimera-cage', template: 'chimera/editor/view'}, applySave);
37
- hawkejs.scene.on({type: 'set', name: 'chimera-cage', template: 'chimera/editor/edit'}, applySave);
38
- hawkejs.scene.on({type: 'set', name: 'chimera-cage', template: 'chimera/editor/add'}, applySave);
39
-
40
- /**
41
- * Apply save functionality when clicking on the "save" button
42
- */
43
- function applySave(el, variables) {
44
-
45
- var preventDuplicate,
46
- variables,
47
- isDraft,
48
- $editor,
49
- $save_close,
50
- $saves,
51
- $save;
52
-
53
- isDraft = this.filter.template === 'chimera/editor/add';
54
-
55
- $editor = $('.chimera-editor', el).first();
56
- $save = $('.action-save', $editor);
57
- $save_close = $('.action-saveClose', $editor);
58
- $saves = $('.action-save, .action-saveClose', $editor);
59
-
60
- if (variables.__chimeraReadOnly) {
61
- $save.remove();
62
- $save_close.remove();
8
+ if (!notification) {
63
9
  return;
64
10
  }
65
11
 
66
- $saves.click(function onClick(e) {
67
-
68
- var $fieldwrappers,
69
- containers,
70
- $this = $(this),
71
- data,
72
- obj;
73
-
74
- e.preventDefault();
75
-
76
- if (preventDuplicate === true) {
77
- //return chimeraFlash('Save ignored:<br>Save already in progress');
78
- }
79
-
80
- // Get all the non-nested containers
81
- containers = $editor[0].querySelectorAll('.chimeraField-container:not(.chimeraField-is-nested)');
82
-
83
- data = {};
84
- obj = {
85
- create: isDraft,
86
- data: data
87
- };
88
-
89
- if (isDraft) {
90
- // Set the initial passed-along-by-server values first
91
- Object.each(variables.groups, function eachGroup(group, name) {
92
- group[0].fields.forEach(function eachField(entry) {
93
- return doFieldEntry(entry);
94
- });
95
- });
96
-
97
- function doFieldEntry(entry, base_path) {
98
-
99
- var subgroup,
100
- subentry,
101
- subpath,
102
- path,
103
- i,
104
- j;
105
-
106
- if (base_path) {
107
- path = base_path;
108
- }
109
-
110
- if (!path) {
111
- path = '';
112
- } else {
113
- path += '.';
114
- }
115
-
116
- path += entry.field.path;
117
-
118
- if (entry.field.fieldType.type_name == 'schema') {
119
-
120
- if (entry.field.fieldType.isArray) {
121
- for (i = 0; i < entry.value.length; i++) {
122
- subgroup = entry.value[i];
123
- subpath = base_path += '.' + i;
124
-
125
- subgroup.fields.forEach(function eachSubField(entry) {
126
- return doFieldEntry(entry, subpath);
127
- });
128
- }
129
- } else if (entry.value) {
130
-
131
- subgroup = entry.value[0];
132
-
133
- subgroup.fields.forEach(function eachSubField(entry) {
134
- return doFieldEntry(entry, base_path);
135
- });
136
- }
137
- } else if (entry.value != null) {
138
- Object.setPath(data, path, entry.value);
139
- }
140
- }
141
- }
142
-
143
- containers.forEach(function eachFieldContainer(container) {
144
-
145
- var instance = container.CFWrapper,
146
- sub_data;
147
-
148
- if (!instance) {
149
- console.log('Found no instance on', container);
150
- return;
151
- }
152
-
153
- // Skip nested wrappers,
154
- // this could mess up the data
155
- if (instance.nested_in) {
156
- return;
157
- }
158
-
159
- sub_data = instance.getData(true);
160
-
161
- Object.merge(data, sub_data);
162
- });
163
-
164
- if (Object.isEmpty(obj.data)) {
165
- return chimeraFlash('Save ignored:<br>No modifications were made');
166
- }
167
-
168
- var editurl = document.location.href;
169
-
170
- var save_options = {
171
- post : obj,
172
- history : false
173
- };
174
-
175
- if (isDraft) {
176
- save_options.history = true;
177
- }
178
-
179
- hawkejs.scene.openUrl($this.attr('href'), save_options, function saved(err, result) {
180
-
181
- if (err != null && result != null) {
182
- preventDuplicate = false;
183
- chimeraFlash('Something went wrong: ' + result);
184
- }
185
-
186
- // @todo: go to the correct url
187
- //hawkejs.scene.reload(editurl);
188
- });
189
-
190
- preventDuplicate = true;
191
- });
192
- }
193
-
194
- hawkejs.scene.on({type: 'set', template: 'chimera/sidebar'}, sidebarCollapse);
195
-
196
- function sidebarCollapse(el) {
197
-
198
- var childclass = '',
199
- $active = $(el.querySelectorAll('.sideNav .active')),
200
- $section = $('.section'),
201
- $links = $('a', el);
202
-
203
- // Open active section
204
- toggleMenu($active.parent().parent().prev());
205
-
206
- $links.click(function(e) {
207
- var $this = $(this);
208
-
209
- if ($this.hasClass('section')) {
210
- return;
211
- }
212
-
213
- $links.removeClass('active');
214
- $this.addClass('active');
215
- });
216
-
217
- // Open clicked section
218
- $section.on('click', function onMenuParentClick(e){
219
- e.preventDefault();
220
- toggleMenu($(this));
221
- });
222
-
223
- // Handle opening/closing of sections
224
- function toggleMenu(section){
225
- childclass = '.'+section.data('childclass');
226
-
227
- if(section.attr('data-after') == '\u25B6'){
228
- section.attr('data-after', '\u25BC');
229
- } else {
230
- section.attr('data-after', '\u25B6');
231
- }
232
-
233
- $(childclass).toggleClass('hidden');
234
- }
235
- }
236
-
237
- hawkejs.scene.on({type: 'set', template: 'chimera/editor/remove'}, removeRecord);
238
-
239
- function removeRecord(el) {
240
-
241
- var url;
242
-
243
- $('.remove-btn').on('click', function(e){
244
- e.preventDefault();
245
- url = $(this).attr('href');
246
-
247
- hawkejs.scene.openUrl(url, {post: {sure: 'yes'}}, function(result) {
248
-
249
- });
250
- });
251
-
252
- }
253
-
254
- function chimeraFlash(flash) {
255
-
256
- var chimera_options,
257
- className,
258
- element,
259
- obj;
260
-
261
- if (typeof vex == 'undefined') {
262
- console.log('"vex" not found, flash:', flash);
263
- return;
264
- }
265
-
266
- chimera_options = hawkejs.scene.exposed.chimera_options || {};
267
-
268
- if (typeof flash == 'string') {
269
- flash = {
270
- message: flash
271
- }
272
- }
273
-
274
- if (flash.className) {
275
- className = ' ' + flash.className;
276
- } else {
277
- className = '';
278
- }
279
-
280
- obj = {
281
- className: 'vex-theme-bottom-right-corner vex-chimera-flash' + className,
282
- message: flash.message
283
- };
284
-
285
- element = vex.dialog.alert(obj);
286
-
287
- setTimeout(function closeVexFlash() {
288
- vex.close(element.data('id'))
289
- }, flash.timeout || chimera_options.notification_timeout || 2500);
290
- }
12
+ setTimeout(() => {
13
+ notification.classList.add('removing');
291
14
 
292
- // $(document).ready(function() {
293
- // vex.defaultOptions.className = 'vex-theme-flat-attack';
294
- // });
15
+ setTimeout(() => {
16
+ notification.remove();
17
+ }, 2500);
18
+ }, 4 * 1000);
19
+ });