alchemy-chimera 1.1.0 → 1.2.0

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.0 (2022-11-02)
2
+
3
+ * Update to `alchemy-form` v0.2.0
4
+
5
+ ## 1.1.1 (2022-10-12)
6
+
7
+ * Add more alchemy-field options
8
+ * Disable translations when getting records from the chimera api
9
+ * Style inline translatable fields
10
+ * Style inline enum field view
11
+ * Fix sidebar routes not being marked as active
12
+
1
13
  ## 1.1.0 (2022-07-23)
2
14
 
3
15
  * Upgrade `alchemy-acl` and `alchemy-form`
@@ -5,6 +5,7 @@ body {
5
5
  font-family: 'Roboto', sans-serif;
6
6
  }
7
7
 
8
+ .default-form-editor,
8
9
  .chimera-wrapper {
9
10
  --sidebar-bg-color: #4a4e58;
10
11
  --text-color: #475466;
@@ -25,6 +26,11 @@ body {
25
26
  --color-text: #475466;
26
27
  --color-input-border: #CCD7E6;
27
28
 
29
+ --alchemy-tab-button-border: var(--color-box-border);
30
+ --alchemy-tab-panel-border: var(--color-box-border);
31
+ }
32
+
33
+ .chimera-wrapper {
28
34
  display: flex;
29
35
  min-height: 100vh;
30
36
  width: 100%;
@@ -60,7 +66,7 @@ body {
60
66
  //filter: brightness(1.05);
61
67
  }
62
68
 
63
- al-ico {
69
+ al-icon {
64
70
  margin-right: 4px;
65
71
  }
66
72
  }
@@ -190,18 +196,18 @@ body {
190
196
  .chimera-editor-widgets {
191
197
  padding: 1rem;
192
198
 
193
- alchemy-widget[type="alchemy_field"] {
199
+ al-widget[type="alchemy_field"] {
194
200
  margin-bottom: 1rem;
195
201
  }
196
202
 
197
203
  .form-field-info label,
198
- .form-field-info alchemy-label {
204
+ .form-field-info al-label {
199
205
  display: block;
200
206
  font-size: 1.2rem;
201
207
  }
202
208
  }
203
209
 
204
- alchemy-widgets-navigation {
210
+ al-widgets-navigation {
205
211
  --border-color: #333333;
206
212
 
207
213
  ul {
@@ -217,7 +223,7 @@ alchemy-widgets-navigation {
217
223
  }
218
224
  }
219
225
 
220
- alchemy-widget[type="link"] {
226
+ al-widget[type="link"] {
221
227
  width: 100%;
222
228
  height: 3rem;
223
229
  display: flex;
@@ -232,7 +238,8 @@ alchemy-widgets-navigation {
232
238
  color: white;
233
239
 
234
240
  &:hover,
235
- &.active-link {
241
+ &.active-link,
242
+ &.active-sublink {
236
243
  background-color: rgba(190, 190, 190, 0.5);
237
244
  }
238
245
  }
@@ -266,21 +273,86 @@ alchemy-widgets-navigation {
266
273
  opacity: 0;
267
274
  }
268
275
 
276
+ .alchemy-field-enum.alchemy-field-value {
277
+ margin: auto;
278
+ background: #777;
279
+ display: inline-block;
280
+ padding: 6px;
281
+ border-radius: 7px;
282
+ color: white;
283
+ }
284
+
285
+ al-field-translatable {
286
+ .prefix-buttons {
287
+ width: 100%;
288
+ border-bottom: 1px solid var(--color-box-border);
289
+ display: flex;
290
+
291
+ button {
292
+ flex: 10;
293
+ font-size: 16px;
294
+ font-weight: 500;
295
+ color: var(--button-text-color);
296
+ letter-spacing: 0px;
297
+ background: transparent;
298
+ border: none;
299
+ cursor: pointer;
300
+
301
+ height: 3rem;
302
+ display: flex;
303
+ flex-flow: column;
304
+ justify-content: center;
305
+ align-items: center;
306
+
307
+ &.active {
308
+ box-shadow: inset 0 -2px var(--color-active);
309
+ }
310
+
311
+ &:hover {
312
+ background-color: var(--button-bg-hover-color);
313
+ }
314
+ }
315
+ }
316
+ }
317
+
318
+ al-field[mode="inline"] {
319
+ al-field-translatable {
320
+ .prefix-buttons {
321
+ button {
322
+ height: 2rem;
323
+ font-size: 14px;
324
+ }
325
+ }
326
+
327
+ .entries {
328
+
329
+ }
330
+ }
331
+
332
+ al-field-translatable-entry {
333
+ display: block;
334
+ padding: 9px;
335
+ background: rgba(190,190,190,0.1);
336
+ min-height: 37px;
337
+ }
338
+ }
339
+
340
+ .default-form-editor,
269
341
  .chimera-wrapper {
270
342
 
271
- alchemy-table .aft-column-filters input {
343
+ al-table .aft-column-filters input {
272
344
  @extend .chimera-input-field;
273
345
  width: 100%;
274
346
  }
275
347
 
276
- alchemy-form {
348
+ al-form {
277
349
  .error-area:not(:empty) {
278
350
  @extend .error, .alert-box;
279
351
  margin-top: 0;
280
352
  }
281
353
  }
282
354
 
283
- alchemy-field {
355
+ al-field {
284
356
  .wrapped-inline {
285
357
  > .field {
286
358
  padding: 0 !important;
@@ -288,11 +360,11 @@ alchemy-widgets-navigation {
288
360
  }
289
361
  }
290
362
 
291
- alchemy-field[mode="inline"] {
363
+ al-field[mode="inline"] {
292
364
  border: none;
293
365
  }
294
366
 
295
- alchemy-field:not([mode="inline"]) {
367
+ al-field:not([mode="inline"]) {
296
368
  border: 1px solid var(--color-box-border);
297
369
  background-color: white;
298
370
  border-radius: 4px;
@@ -300,7 +372,7 @@ alchemy-widgets-navigation {
300
372
  // In case something goes wrong:
301
373
  min-height: 1rem;
302
374
 
303
- alchemy-label {
375
+ al-label {
304
376
  padding-left: 1rem;
305
377
  line-height: 3rem;
306
378
  font-size: 16px;
@@ -309,39 +381,6 @@ alchemy-widgets-navigation {
309
381
  border-bottom: 1px solid var(--color-box-border);
310
382
  }
311
383
 
312
- alchemy-field-translatable {
313
- .prefix-buttons {
314
- width: 100%;
315
- border-bottom: 1px solid var(--color-box-border);
316
- display: flex;
317
-
318
- button {
319
- flex: 10;
320
- font-size: 16px;
321
- font-weight: 500;
322
- color: var(--button-text-color);
323
- letter-spacing: 0px;
324
- background: transparent;
325
- border: none;
326
- cursor: pointer;
327
-
328
- height: 3rem;
329
- display: flex;
330
- flex-flow: column;
331
- justify-content: center;
332
- align-items: center;
333
-
334
- &.active {
335
- box-shadow: inset 0 -2px var(--color-active);
336
- }
337
-
338
- &:hover {
339
- background-color: var(--button-bg-hover-color);
340
- }
341
- }
342
- }
343
- }
344
-
345
384
  .field {
346
385
  display: flex;
347
386
  padding: 1rem;
@@ -351,7 +390,7 @@ alchemy-widgets-navigation {
351
390
  flex: 10;
352
391
  }
353
392
 
354
- > alchemy-widget {
393
+ > al-widget {
355
394
  border: 1px solid var(--color-input-border);
356
395
  padding: 0 12px;
357
396
  }
@@ -381,7 +420,7 @@ alchemy-widgets-navigation {
381
420
  }
382
421
  }
383
422
 
384
- alchemy-field-array {
423
+ al-field-array {
385
424
  .add-entry {
386
425
  @extend .btn;
387
426
  margin: 1rem 0 0 1rem;
@@ -398,7 +437,7 @@ alchemy-widgets-navigation {
398
437
  margin-top: 0.5rem;
399
438
  }
400
439
 
401
- alchemy-field-array-entry:not(:last-of-type) {
440
+ al-field-array-entry:not(:last-of-type) {
402
441
  //border-bottom: 1px solid gray;
403
442
  position: relative;
404
443
 
@@ -415,18 +454,18 @@ alchemy-widgets-navigation {
415
454
  }
416
455
  }
417
456
 
418
- alchemy-field-array-entry:not(:first-of-type) {
457
+ al-field-array-entry:not(:first-of-type) {
419
458
  margin-top: 1rem;
420
459
  }
421
460
  }
422
461
 
423
462
  .chimera-editor-widgets {
424
463
 
425
- alchemy-widgets-column.toc-col {
464
+ al-widgets-column.toc-col {
426
465
  flex: 2 2;
427
466
  }
428
467
 
429
- table-of-contents[elements-selector="alchemy-field"] {
468
+ al-toc[elements-selector="al-field"] {
430
469
  align-self: start;
431
470
  top: 2rem;
432
471
  position: sticky;
@@ -454,21 +493,22 @@ alchemy-widgets-navigation {
454
493
  }
455
494
  }
456
495
 
457
- alchemy-field-schema {
458
- alchemy-field {
496
+ al-field-schema {
497
+ al-field {
459
498
  border: none;
460
499
  margin-bottom: 1rem;
461
500
  }
462
501
  }
463
502
 
464
503
  .aft-actions {
504
+ al-button,
465
505
  a {
466
506
  color: var(--button-text-color);
467
507
  background-color: var(--button-bg-color);
468
508
  padding: 0.5rem;
469
509
  border-radius: 6px;
470
510
  margin: 0.2rem;
471
- display: inline-block;
511
+ display: inline-flex;
472
512
 
473
513
  &:hover {
474
514
  background-color: var(--button-bg-hover-color);
@@ -496,7 +536,7 @@ alchemy-widgets-navigation {
496
536
  }
497
537
  }
498
538
 
499
- alchemy-password-input {
539
+ al-password-input {
500
540
  label:first-of-type {
501
541
  margin-bottom: 0;
502
542
  }
package/config/routes.js CHANGED
@@ -12,13 +12,12 @@ chimera_section.add({
12
12
  paths : '/',
13
13
  handler : 'Chimera.Static#dashboard',
14
14
  });
15
-
16
15
  // Editor index action
17
16
  chimera_section.add({
18
17
  name : 'Chimera.Editor#index',
19
18
  methods : 'get',
20
19
  paths : '/editor/{model}/index',
21
- breadcrumb : 'chimera.editor.{model}.index'
20
+ breadcrumb : 'chimera.editor.{model}'
22
21
  });
23
22
 
24
23
  // Editor add action
@@ -227,7 +227,7 @@ Editor.setAction(async function trash(conduit, model_name, pk_val) {
227
227
  *
228
228
  * @author Jelle De Loecker <jelle@elevenways.be>
229
229
  * @since 1.0.0
230
- * @version 1.1.0
230
+ * @version 1.2.0
231
231
  *
232
232
  * @param {Conduit} conduit
233
233
  * @param {String} model_name
@@ -237,6 +237,8 @@ Editor.setAction(async function records(conduit, model_name) {
237
237
  let body = conduit.body,
238
238
  model = this.getModel(model_name),
239
239
  crit = model.find();
240
+
241
+ model.disableTranslations();
240
242
 
241
243
  let page_size = body.page_size,
242
244
  fields = body.fields,
@@ -252,6 +254,10 @@ Editor.setAction(async function records(conduit, model_name) {
252
254
  crit.select(fields);
253
255
  }
254
256
 
257
+ if (page_size && !page) {
258
+ page = 1;
259
+ }
260
+
255
261
  if (page) {
256
262
  crit.page(page, page_size);
257
263
  }
@@ -65,7 +65,7 @@ Config.setMethod(function getFieldSet(name) {
65
65
  *
66
66
  * @author Jelle De Loecker <jelle@elevenways.be>
67
67
  * @since 1.0.0
68
- * @version 1.1.0
68
+ * @version 1.2.0
69
69
  *
70
70
  * @param {String} action
71
71
  * @param {Conduit} conduit
@@ -84,23 +84,76 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
84
84
  if (action == 'edit') {
85
85
  fieldset = this.getFieldSet('edit');
86
86
 
87
- let field_widgets = [];
88
-
87
+ let action_widgets = [];
89
88
  let field;
90
89
 
90
+ let groups = {
91
+ main : {
92
+ title : 'Main',
93
+ widgets : [],
94
+ },
95
+ };
96
+
91
97
  for (field of fieldset) {
92
98
 
93
- field_widgets.push({
99
+ let field_group = groups.main;
100
+
101
+ let field_widget ={
94
102
  type : 'alchemy_field',
95
103
  config : {
96
104
  field : field.name,
105
+ purpose : field.options.purpose,
106
+ mode : field.options.mode,
107
+ readonly : field.options.readonly,
97
108
  view : field.options.view,
109
+ wrapper : field.options.wrapper,
110
+ data_src : field.options.data_src,
111
+ title : field.options.title,
98
112
  widget_settings : field.options.widget_settings || {},
99
113
  }
114
+ };
115
+
116
+ if (field.options.group) {
117
+ field_group = groups[field.options.group];
118
+
119
+ if (!field_group) {
120
+ field_group = {
121
+ widgets : [],
122
+ };
123
+
124
+ groups[field.options.group] = field_group;
125
+ }
126
+ }
127
+
128
+ field_group.widgets.push(field_widget);
129
+ }
130
+
131
+ if (Object.size(groups) == 1) {
132
+ action_widgets.include(groups.main.widgets);
133
+ } else {
134
+ let tabs = [];
135
+
136
+ for (let name in groups) {
137
+ let group = groups[name];
138
+
139
+ let tab = {
140
+ name : name,
141
+ title : name.titleize(),
142
+ contents : group.widgets,
143
+ };
144
+
145
+ tabs.push(tab);
146
+ }
147
+
148
+ action_widgets.push({
149
+ type : 'alchemy_tabs',
150
+ config : {
151
+ tabs : tabs,
152
+ }
100
153
  });
101
154
  }
102
155
 
103
- field_widgets.push({
156
+ action_widgets.push({
104
157
  type : 'html',
105
158
  config : {
106
159
  html : '<button class="btn btn-submit" type="submit">Save</button>'
@@ -132,7 +185,7 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
132
185
  "config": {
133
186
  model : this.ModelClass.type_name,
134
187
  purpose : 'edit',
135
- widgets : field_widgets
188
+ widgets : action_widgets
136
189
  }
137
190
  }
138
191
  ]
@@ -146,9 +199,9 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
146
199
  {
147
200
  type: "table_of_contents",
148
201
  config: {
149
- parent_selector: 'alchemy-widgets-row',
150
- elements_selector: 'alchemy-field',
151
- title_selector: 'alchemy-label'
202
+ parent_selector: 'al-widgets-row',
203
+ elements_selector: 'al-field',
204
+ title_selector: 'al-label'
152
205
  }
153
206
  }
154
207
  ]
@@ -174,9 +227,10 @@ Config.setMethod(function getWidgetConfig(action, conduit) {
174
227
  "type": "alchemy_table",
175
228
  "config": {
176
229
  fieldset : fieldset,
177
- page_size : 50,
230
+ page_size : 25,
178
231
  show_filters : true,
179
232
  id : 'aft-' + this.ModelClass.type_name,
233
+ use_url_pagination : true,
180
234
  recordsource : {
181
235
  route : 'Chimera.Editor#records',
182
236
  parameters : {
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.1.0",
4
+ "version": "1.2.0",
5
5
  "author": "Jelle De Loecker <jelle@elevenways.be>",
6
6
  "keywords": [
7
7
  "alchemy",
@@ -11,10 +11,10 @@
11
11
  ],
12
12
  "repository": "11ways/alchemy-chimera",
13
13
  "peerDependencies": {
14
- "alchemy-acl" : "~0.8.0",
15
- "alchemymvc" : "~1.2.4",
16
- "alchemy-form" : "~0.1.11",
17
- "alchemy-widget" : "~0.1.5"
14
+ "alchemy-acl" : "~0.8.3",
15
+ "alchemymvc" : "~1.2.7",
16
+ "alchemy-form" : "~0.2.0",
17
+ "alchemy-widget" : "~0.2.0"
18
18
  },
19
19
  "license": "MIT",
20
20
  "engines": {
@@ -1,8 +1,7 @@
1
1
  {% extend "layouts/chimera_body" %}
2
2
 
3
3
  {% block "main" %}
4
- Dashboard Widgets:
5
- <alchemy-widgets>
4
+ <al-widgets>
6
5
 
7
- </alchemy-widgets>
6
+ </al-widgets>
8
7
  {% /block %}
@@ -1,11 +1,11 @@
1
1
  {% include "layouts/chimera_basics" %}
2
2
 
3
3
  {% block "main" %}
4
- <alchemy-widgets
4
+ <al-widgets
5
5
  class="main-widgets"
6
6
  #context_variables={% context_variables %}
7
7
  #value={% widget_config %}
8
- ></alchemy-widgets>
8
+ ></al-widgets>
9
9
  {% /block %}
10
10
 
11
11
  {% block "page-actions" %}
@@ -14,7 +14,7 @@
14
14
  #model={% model_name %}
15
15
  class="btn"
16
16
  >
17
- <al-ico type="plus"></al-ico>
17
+ <al-icon icon-name="plus"></al-icon>
18
18
  {%t "new" model=model_name %}
19
19
  </a>
20
20
  {% /block %}
@@ -15,7 +15,10 @@
15
15
  {%t "cancel" %}
16
16
  </a>
17
17
  <button class="btn danger">
18
- <al-ico type="trash" class="fas fa-trash"></al-ico>
18
+ <al-icon
19
+ icon-name="trash"
20
+ icon-style="duotone"
21
+ ></al-icon>
19
22
  {%t "delete" %}
20
23
  </button>
21
24
  </form>
@@ -28,7 +31,7 @@
28
31
  #model={% model_name %}
29
32
  class="btn"
30
33
  >
31
- <al-ico type="plus"></al-ico>
34
+ <al-icon icon-name="plus"></al-icon>
32
35
  {%t "new" model=model_name %}
33
36
  </a>
34
37
  {% /block %}
@@ -1,4 +1,4 @@
1
- <alchemy-widgets
1
+ <al-widgets
2
2
  class="sidebar-widgets"
3
3
  #value=<% navigation_widgets %>
4
- ></alchemy-widgets>
4
+ ></al-widgets>
@@ -1,8 +1,8 @@
1
1
  {% include "layouts/chimera_basics" %}
2
2
 
3
3
  {% block "main" %}
4
- <alchemy-widgets
4
+ <al-widgets
5
5
  #context_variables={% context_variables %}
6
6
  #value={% widget_config %}
7
- ></alchemy-widgets>
7
+ ></al-widgets>
8
8
  {% /block %}