alchemy-chimera 1.2.5 → 1.2.7

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.2.7 (2023-11-27)
2
+
3
+ * Fix expecting underscored model names
4
+
5
+ ## 1.2.6 (2023-10-05)
6
+
7
+ * Do not queue a toolbar_manager model fallback on system routes without a model
8
+ * Fix the toolbar not having an `add` button on non-ajax pageviews
9
+ * Fix abstract model classes from showing up in the default chimera sidebar
10
+ * Don't show models without a valid chimera configuration in the sidebar
11
+ * Make date input fields look like the others
12
+
1
13
  ## 1.2.5 (2023-06-17)
2
14
 
3
15
  * Improve stylings
@@ -3,6 +3,10 @@
3
3
 
4
4
  body {
5
5
  font-family: 'Roboto', sans-serif;
6
+
7
+ .he-context-contents {
8
+ overflow: auto;
9
+ }
6
10
  }
7
11
 
8
12
  .default-form-editor,
@@ -343,6 +347,30 @@ al-field[mode="inline"] {
343
347
  background: rgba(190,190,190,0.1);
344
348
  min-height: 37px;
345
349
  }
350
+
351
+ .field {
352
+ input[type="text"],
353
+ input[type="number"],
354
+ input[type="color"],
355
+ input[type="datetime-local"],
356
+ input[type="date"],
357
+ input[type="password"] {
358
+ @extend .chimera-input-field;
359
+ height: 3rem;
360
+ }
361
+
362
+ textarea {
363
+ @extend .chimera-input-field;
364
+ min-height: 5rem;
365
+ padding: 1rem;
366
+ }
367
+
368
+ input[type="color"] {
369
+ background-color: transparent;
370
+ border: none;
371
+ padding: 0;
372
+ }
373
+ }
346
374
  }
347
375
 
348
376
  .default-form-editor,
@@ -410,6 +438,10 @@ al-field[mode="inline"] {
410
438
  flex: 10;
411
439
  }
412
440
 
441
+ > .does-not-expand {
442
+ flex: 0 1 auto;
443
+ }
444
+
413
445
  > al-widget {
414
446
  border: 1px solid var(--color-input-border);
415
447
  padding: 0 12px;
@@ -421,6 +453,7 @@ al-field[mode="inline"] {
421
453
  input[type="number"],
422
454
  input[type="color"],
423
455
  input[type="datetime-local"],
456
+ input[type="date"],
424
457
  input[type="password"] {
425
458
  @extend .chimera-input-field;
426
459
  height: 3rem;
@@ -440,6 +473,10 @@ al-field[mode="inline"] {
440
473
  }
441
474
  }
442
475
 
476
+ .field {
477
+ justify-content: flex-start;
478
+ }
479
+
443
480
  al-field-array {
444
481
  .add-entry {
445
482
  @extend .btn;
package/config/routes.js CHANGED
@@ -46,16 +46,18 @@ chimera_section.add({
46
46
 
47
47
  // Editor data action
48
48
  chimera_section.add({
49
- name : 'Chimera.Editor#records',
50
- methods : ['post'],
51
- paths : '/api/editor/{model}/records',
49
+ name : 'Chimera.Editor#records',
50
+ methods : ['post'],
51
+ paths : '/api/editor/{model}/records',
52
+ is_system_route : true,
52
53
  });
53
54
 
54
55
  // Sidebar
55
56
  chimera_section.add({
56
- name : 'Chimera.Static#sidebar',
57
- methods : ['get'],
58
- paths : '/api/content/sidebar',
57
+ name : 'Chimera.Static#sidebar',
58
+ methods : ['get'],
59
+ paths : '/api/content/sidebar',
60
+ is_system_route : true,
59
61
  });
60
62
 
61
63
  alchemy.sputnik.after('base_app', () => {
@@ -20,11 +20,27 @@ let ChimeraController = Function.inherits('Alchemy.Controller', 'Alchemy.Control
20
20
  *
21
21
  * @author Jelle De Loecker <jelle@elevenways.be>
22
22
  * @since 1.2.4
23
- * @version 1.2.4
23
+ * @version 1.2.6
24
24
  */
25
25
  ChimeraController.setMethod(function beforeAction() {
26
+
27
+ const model = this.conduit.params.model,
28
+ is_system_route = this.conduit.route.is_system_route;
29
+
26
30
  this.set('toolbar_manager', this.toolbar_manager);
27
- this.toolbar_manager.queueModelFallback(this.conduit.params.model);
31
+
32
+ // If this is not a system route and no model is defined in the parameters,
33
+ // do not queue a model fallback
34
+ if (is_system_route && !model) {
35
+ return;
36
+ }
37
+
38
+ // Ignore loopback conduits
39
+ if (this.conduit instanceof Classes.Alchemy.Conduit.Loopback) {
40
+ return;
41
+ }
42
+
43
+ this.toolbar_manager.queueModelFallback(model);
28
44
  });
29
45
 
30
46
  /**
@@ -87,7 +87,7 @@ Editor.setAction(function index(conduit, model_name) {
87
87
  *
88
88
  * @author Jelle De Loecker <jelle@elevenways.be>
89
89
  * @since 0.1.0
90
- * @version 1.0.2
90
+ * @version 1.2.7
91
91
  *
92
92
  * @param {Conduit} conduit
93
93
  * @param {String} model_name
@@ -102,7 +102,7 @@ Editor.setAction(async function add(conduit, model_name) {
102
102
 
103
103
  let record = model.createDocument();
104
104
 
105
- record.setDataRecord(conduit.body[model_name]);
105
+ record.setDataRecord(conduit.body);
106
106
 
107
107
  try {
108
108
  await record.save();
@@ -141,7 +141,7 @@ Editor.setAction(async function add(conduit, model_name) {
141
141
  *
142
142
  * @author Jelle De Loecker <jelle@elevenways.be>
143
143
  * @since 0.1.0
144
- * @version 1.2.4
144
+ * @version 1.2.7
145
145
  *
146
146
  * @param {Conduit} conduit
147
147
  * @param {String} model_name
@@ -169,7 +169,7 @@ Editor.setAction(async function edit(conduit, model_name, pk_val) {
169
169
 
170
170
  if (conduit.method == 'post') {
171
171
 
172
- Object.assign(record, conduit.body[model_name]);
172
+ Object.assign(record, conduit.body);
173
173
 
174
174
  try {
175
175
  await record.save();
@@ -26,7 +26,7 @@ ChimeraStatic.setAction(function dashboard(conduit) {
26
26
  *
27
27
  * @author Jelle De Loecker <jelle@elevenways.be>
28
28
  * @since 1.0.0
29
- * @version 1.2.2
29
+ * @version 1.2.6
30
30
  *
31
31
  * @param {Conduit} conduit
32
32
  */
@@ -95,6 +95,13 @@ ChimeraStatic.setAction(function sidebar(conduit) {
95
95
  models.sortByPath(1, 'model_name');
96
96
 
97
97
  for (let model of models) {
98
+
99
+ // Skip abstract classes (like `App`)
100
+ // or models without any chimera configuration
101
+ if (model.is_abstract || !model.chimera.has_configuration) {
102
+ continue;
103
+ }
104
+
98
105
  let entry = {
99
106
  type : 'link',
100
107
  config : {
@@ -109,8 +116,6 @@ ChimeraStatic.setAction(function sidebar(conduit) {
109
116
  }
110
117
  };
111
118
 
112
- console.log(entry)
113
-
114
119
  widgets.push(entry);
115
120
  }
116
121
  }
@@ -17,7 +17,7 @@ const Config = Function.inherits('Alchemy.Base', 'Alchemy.Chimera', function Con
17
17
  this.ModelClass = ModelClass;
18
18
 
19
19
  // The different default field sets
20
- this.field_sets = {};
20
+ this.field_sets = null;
21
21
 
22
22
  // The record preview action
23
23
  this.record_preview = null;
@@ -25,6 +25,38 @@ const Config = Function.inherits('Alchemy.Base', 'Alchemy.Chimera', function Con
25
25
  this.record_preview_action = null;
26
26
  });
27
27
 
28
+ /**
29
+ * Has this been configured in any way?
30
+ *
31
+ * @author Jelle De Loecker <jelle@elevenways.be>
32
+ * @since 1.2.6
33
+ * @version 1.2.6
34
+ *
35
+ * @type {Boolean}
36
+ */
37
+ Config.setProperty(function has_configuration() {
38
+
39
+ let result = false;
40
+
41
+ if (this.field_sets) {
42
+ let key,
43
+ fieldset;
44
+
45
+ for (key in this.field_sets) {
46
+ fieldset = this.field_sets[key];
47
+
48
+ if (!fieldset.size) {
49
+ continue;
50
+ }
51
+
52
+ result = true;
53
+ break;
54
+ }
55
+ }
56
+
57
+ return result;
58
+ });
59
+
28
60
  /**
29
61
  * Set a record preview
30
62
  *
@@ -71,7 +103,7 @@ Config.setMethod(function getActionFields(name) {
71
103
  *
72
104
  * @author Jelle De Loecker <jelle@elevenways.be>
73
105
  * @since 0.2.0
74
- * @version 1.0.0
106
+ * @version 1.2.6
75
107
  *
76
108
  * @return {FieldSet}
77
109
  */
@@ -81,6 +113,10 @@ Config.setMethod(function getFieldSet(name) {
81
113
  throw new Error('No action group name was given');
82
114
  }
83
115
 
116
+ if (!this.field_sets) {
117
+ this.field_sets = {};
118
+ }
119
+
84
120
  let set = this.field_sets[name];
85
121
 
86
122
  if (!set) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alchemy-chimera",
3
3
  "description": "Chimera plugin for Alchemy MVC",
4
- "version": "1.2.5",
4
+ "version": "1.2.7",
5
5
  "author": "Jelle De Loecker <jelle@elevenways.be>",
6
6
  "keywords": [
7
7
  "alchemy",
@@ -11,9 +11,9 @@
11
11
  ],
12
12
  "repository": "11ways/alchemy-chimera",
13
13
  "peerDependencies": {
14
- "alchemy-acl" : "~0.8.3",
15
- "alchemymvc" : ">=1.2.7",
16
- "alchemy-form" : "~0.2.1",
14
+ "alchemy-acl" : "~0.8.4",
15
+ "alchemymvc" : ">=1.3.16",
16
+ "alchemy-form" : "~0.2.7",
17
17
  "alchemy-widget" : "~0.2.1"
18
18
  },
19
19
  "license": "MIT",