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
@@ -1,311 +0,0 @@
1
- /**
2
- * The BelongsTo ChimeraField class
3
- *
4
- * @constructor
5
- *
6
- * @author Jelle De Loecker <jelle@develry.be>
7
- * @since 0.2.0
8
- * @version 0.3.0
9
- *
10
- * @param {Object} options
11
- * @param {ChimeraFieldWrapper} options.parent
12
- * @param {DOMElement} options.container
13
- * @param {Object} options.variables
14
- * @param {Mixed} options.value
15
- * @param {String} options.prefix
16
- * @param {Number} options.original_index
17
- */
18
- var BelongstoChimeraField = Function.inherits('ChimeraField', function BelongstoChimeraField(options) {
19
-
20
- var that = this,
21
- nested_path,
22
- urlparams,
23
- recordId,
24
- subject;
25
-
26
- this._original_value_object = options.value;
27
-
28
- if (Object.isEmpty(options.value)) {
29
- options.value = null;
30
- } else if (typeof options.value == 'object' && options.value.assoc_id) {
31
- options.value = options.value.assoc_id;
32
- }
33
-
34
- BelongstoChimeraField.super.call(this, options);
35
-
36
- urlparams = this.variables.__urlparams || {};
37
- this.default_options = {};
38
-
39
- if (urlparams.id) {
40
- recordId = urlparams.id;
41
- } else {
42
- recordId = Object.path(this.variables, 'item.value.id');
43
- }
44
-
45
- if (!recordId) {
46
- recordId = Object.path(this.variables, 'data.root_id');
47
-
48
- if (!recordId) {
49
- recordId = this.variables.__recordId || "000000000000000000000000";
50
- }
51
- }
52
-
53
- // Store the modelname
54
- this.modelName = this.field.fieldType.options.modelName;
55
-
56
- // Get the subject
57
- subject = urlparams.subject;
58
-
59
- if (!subject) {
60
- subject = Object.path(this.variables, 'data.root_model');
61
- }
62
-
63
- if (!subject) {
64
- subject = this.field.model_name || this.modelName;
65
- }
66
-
67
- if (!this.modelName) {
68
- this.modelName = subject;
69
- }
70
-
71
- // Create a router instance
72
- this.Router = new hawkejs.constructor.helpers.Router();
73
-
74
- // Construct the base url
75
- this.baseUrl = Blast.Collection.URL.parse(this.Router.routeUrl('RecordAction', {
76
- controller: 'editor',
77
- subject: subject,
78
- action: 'related_data',
79
- id: recordId
80
- }));
81
-
82
- // Get the path of the value it's nested in
83
- nested_path = Object.path(this.variables, 'data.nested_path');
84
-
85
- if (nested_path) {
86
- if (this.nested_path) {
87
- nested_path += '.' + this.nested_path;
88
- }
89
- } else {
90
- nested_path = this.getNestedPath();
91
- }
92
-
93
- // If this is a nested field, add that info
94
- // @todo: this will only work for 1 level, not multiple...
95
- if (nested_path) {
96
- this.baseUrl.addQuery('nested_in', nested_path);
97
- }
98
-
99
- // Construct the create url
100
- this.createUrl = Blast.Collection.URL.parse(this.Router.routeUrl('ModelAction', {
101
- controller: 'editor',
102
- subject: this.field.fieldType.options.modelName,
103
- action: 'create_field_value'
104
- }));
105
-
106
- if (this.field.options.create && !this.default_options.create) {
107
- this.default_options.create = function create(input, callback) {
108
-
109
- hawkejs.scene.fetch(that.createUrl, {post: {text: input}}, function gotResult(err, data) {
110
-
111
- if (err) {
112
- console.error(err);
113
- return callback();
114
- }
115
-
116
- callback({value: data._id, text: input});
117
- });
118
- };
119
- }
120
- });
121
-
122
- /**
123
- * Initialize the field
124
- *
125
- * @param {Mixed} value
126
- */
127
- BelongstoChimeraField.setMethod(function initEdit() {
128
-
129
- var that = this,
130
- $input = $(this.input),
131
- init_value_has_been_set = false,
132
- coordinates,
133
- modelName,
134
- initted,
135
- baseUrl,
136
- options,
137
- url;
138
-
139
- modelName = this.modelName;
140
- baseUrl = this.baseUrl;
141
-
142
- options = Object.assign({
143
- valueField: '_id',
144
- labelField: 'title',
145
- searchField: 'title',
146
- placeholder: '-- empty --',
147
- preload: true,
148
- create: false,
149
- render: {
150
- item: function selectedItem(item) {
151
- return '<div><span>' + item.title + '</span></div>';
152
- },
153
- option: function shownOption(item, escape) {
154
- return '<div class="option"><span>' + item.title + '</span></div>';
155
- }
156
- },
157
- load: function load(query, callback) {
158
-
159
- var url = baseUrl.clone(),
160
- thisSelect = this,
161
- setInitValue;
162
-
163
- url.addQuery('fieldpath', that.field.path);
164
-
165
- if (!initted) {
166
- initted = true;
167
- setInitValue = true;
168
- }
169
-
170
- hawkejs.scene.fetch(url, function gotResult(err, response) {
171
-
172
- var result = [],
173
- title,
174
- items,
175
- item,
176
- i,
177
- j;
178
-
179
- if (err) {
180
- throw err;
181
- }
182
-
183
- if (Array.isArray(response)) {
184
- items = response;
185
- } else {
186
- items = response.items;
187
- }
188
-
189
- for (i = 0; i < items.length; i++) {
190
-
191
- item = items[i];
192
-
193
- if (item[modelName]) {
194
- item = item[modelName];
195
- }
196
-
197
- if (Array.isArray(response.displayField)) {
198
- for (j = 0; j < response.displayField.length; j++) {
199
- title = Object.first(item[response.displayField[j]]);
200
-
201
- if (title) {
202
- break;
203
- }
204
- }
205
- } else {
206
- title = Object.first(item[response.displayField]);
207
- }
208
-
209
- if (!title) {
210
- title = Object.first(item.title) || Object.first(item.name) || item._id;
211
- }
212
-
213
- result.push({
214
- _id: item._id,
215
- title: title,
216
- data: items[i]
217
- });
218
- }
219
-
220
- callback(result);
221
-
222
- // @TODO: that.value is sometimes an empty object in new records, why is that?
223
- if (setInitValue && that.value && !Object.isEmpty(that.value)) {
224
- thisSelect.setValue(that.value);
225
- }
226
-
227
- init_value_has_been_set = true;
228
- });
229
- },
230
- onChange: function changed(value) {
231
- that.setValue(value, init_value_has_been_set);
232
- }
233
- }, this.default_options);
234
-
235
- $input.selectize(options);
236
-
237
- this.selectizeInstance = $input[0].selectize;
238
- });
239
-
240
- /**
241
- * Set the new value for this field.
242
- * Only new values will be sent to the server on save.
243
- *
244
- * @param {Mixed} value
245
- */
246
- BelongstoChimeraField.setMethod(function setReadOnly(value) {
247
- this.selectizeInstance.disable(value);
248
- });
249
-
250
- /**
251
- * The HasOneParent ChimeraField class
252
- *
253
- * @constructor
254
- *
255
- * @author Jelle De Loecker <jelle@develry.be>
256
- * @since 0.2.0
257
- * @version 0.3.0
258
- *
259
- * @param {Object} options
260
- * @param {ChimeraFieldWrapper} options.parent
261
- * @param {DOMElement} options.container
262
- * @param {Object} options.variables
263
- * @param {Mixed} options.value
264
- * @param {String} options.prefix
265
- * @param {Number} options.original_index
266
- */
267
- var HasoneparentChimeraField = BelongstoChimeraField.extend(function HasoneparentChimeraField(options) {
268
- HasoneparentChimeraField.super.call(this, options);
269
- });
270
-
271
- /**
272
- * The Enum ChimeraField class
273
- *
274
- * @constructor
275
- *
276
- * @author Jelle De Loecker <jelle@develry.be>
277
- * @since 0.2.0
278
- * @version 0.3.0
279
- *
280
- * @param {Object} options
281
- * @param {ChimeraFieldWrapper} options.parent
282
- * @param {DOMElement} options.container
283
- * @param {Object} options.variables
284
- * @param {Mixed} options.value
285
- * @param {String} options.prefix
286
- * @param {Number} options.original_index
287
- */
288
- var EnumChimeraField = BelongstoChimeraField.extend(function EnumChimeraField(options) {
289
- EnumChimeraField.super.call(this, options);
290
- });
291
-
292
- /**
293
- * The HasAndBelongsToMany ChimeraField class
294
- *
295
- * @constructor
296
- *
297
- * @author Jelle De Loecker <jelle@develry.be>
298
- * @since 0.2.0
299
- * @version 0.3.0
300
- *
301
- * @param {Object} options
302
- * @param {ChimeraFieldWrapper} options.parent
303
- * @param {DOMElement} options.container
304
- * @param {Object} options.variables
305
- * @param {Mixed} options.value
306
- * @param {String} options.prefix
307
- * @param {Number} options.original_index
308
- */
309
- var HABTMChimeraField = BelongstoChimeraField.extend(function HabtmChimeraField(options) {
310
- HabtmChimeraField.super.call(this, options);
311
- });
@@ -1,53 +0,0 @@
1
- /**
2
- * The Boolean ChimeraField class
3
- *
4
- * @constructor
5
- *
6
- * @author Kjell Keisse <kjell@codedor.be>
7
- * @since 0.2.0
8
- * @version 0.2.0
9
- *
10
- * @param {ChimeraFieldWrapper} parent
11
- * @param {Mixed} value
12
- * @param {DOMElement} container
13
- * @param {Object} variables
14
- * @param {String} prefix
15
- */
16
- BooleanChimeraField = ChimeraField.extend(function BooleanChimeraField(parent, value, container, variables, prefix) {
17
- BooleanChimeraField.super.call(this, parent, value, container, variables, prefix);
18
- });
19
-
20
- /**
21
- * Create the edit input element
22
- *
23
- * @author Jelle De Loecker <jelle@kipdola.be>
24
- * @since 0.2.0
25
- * @version 0.2.0
26
- */
27
- BooleanChimeraField.setMethod(function renderEdit() {
28
-
29
- var html = '<input type="checkbox"';
30
-
31
- if (this.value) {
32
- html += ' checked';
33
- }
34
-
35
- html += '>';
36
-
37
- this.setMainElement(html);
38
- });
39
-
40
- /**
41
- * Initialize the field
42
- *
43
- * @param {Mixed} value
44
- */
45
- BooleanChimeraField.setMethod(function initEdit() {
46
-
47
- var that = this,
48
- $input = $(this.input);
49
-
50
- $input.change(function onBooleanEdit() {
51
- that.setValue($input.is(':checked'));
52
- });
53
- });