alchemy-chimera 1.2.3 → 1.2.5

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,11 @@
1
+ ## 1.2.5 (2023-06-17)
2
+
3
+ * Improve stylings
4
+
5
+ ## 1.2.4 (2023-04-20)
6
+
7
+ * Add document watcher & toolbar manager support
8
+
1
9
  ## 1.2.3 (2023-03-10)
2
10
 
3
11
  * Add support for setting a record preview action per model
@@ -210,6 +210,10 @@ body {
210
210
  display: block;
211
211
  font-size: 1.2rem;
212
212
  }
213
+
214
+ > al-widgets-column > [type="header"] h1 {
215
+ padding-top: 0;
216
+ }
213
217
  }
214
218
 
215
219
  al-widgets-navigation {
@@ -532,20 +536,6 @@ al-field[mode="inline"] {
532
536
  }
533
537
  }
534
538
 
535
- .chimera-confirm-page {
536
- flex: 1;
537
- justify-content: center;
538
- display: flex;
539
- align-items: center;
540
- flex-flow: column;
541
- flex-direction: column;
542
-
543
- .action-buttons {
544
- display: flex;
545
- gap: 1rem;
546
- }
547
- }
548
-
549
539
  al-file {
550
540
  button {
551
541
  @extend .btn;
@@ -565,6 +555,32 @@ al-field[mode="inline"] {
565
555
  background: initial;
566
556
  }
567
557
  }
558
+
559
+ al-editor-toolbar {
560
+ width: 100%;
561
+ align-items: center;
562
+ justify-content: space-between;
563
+
564
+ [data-area="buttons"] {
565
+ display: flex;
566
+ gap: 1rem;
567
+ }
568
+ }
569
+ }
570
+
571
+ .chimera-centered-page,
572
+ .chimera-confirm-page {
573
+ flex: 1;
574
+ justify-content: center;
575
+ display: flex;
576
+ align-items: center;
577
+ flex-flow: column;
578
+ flex-direction: column;
579
+
580
+ .action-buttons {
581
+ display: flex;
582
+ gap: 1rem;
583
+ }
568
584
  }
569
585
 
570
586
  al-field {
package/config/routes.js CHANGED
File without changes
@@ -13,4 +13,35 @@ let ChimeraController = Function.inherits('Alchemy.Controller', 'Alchemy.Control
13
13
  if (alchemy.plugins.chimera.theme) {
14
14
  this.view_render.setTheme(alchemy.plugins.chimera.theme);
15
15
  }
16
+ });
17
+
18
+ /**
19
+ * Do something before the action is executed
20
+ *
21
+ * @author Jelle De Loecker <jelle@elevenways.be>
22
+ * @since 1.2.4
23
+ * @version 1.2.4
24
+ */
25
+ ChimeraController.setMethod(function beforeAction() {
26
+ this.set('toolbar_manager', this.toolbar_manager);
27
+ this.toolbar_manager.queueModelFallback(this.conduit.params.model);
28
+ });
29
+
30
+ /**
31
+ * Get this client's toolbar manager
32
+ *
33
+ * @author Jelle De Loecker <jelle@elevenways.be>
34
+ * @since 1.2.4
35
+ * @version 1.2.4
36
+ *
37
+ * @return {Alchemy.Widget.EditorToolbarManager}
38
+ */
39
+ ChimeraController.enforceProperty(function toolbar_manager(new_value) {
40
+
41
+ if (!new_value && this.conduit) {
42
+ new_value = Classes.Alchemy.Widget.EditorToolbarManager.create(this.conduit);
43
+ new_value.scenario = 'chimera';
44
+ }
45
+
46
+ return new_value;
16
47
  });
@@ -12,7 +12,7 @@ const Editor = Function.inherits('Alchemy.Controller.Chimera', 'Editor');
12
12
  *
13
13
  * @author Jelle De Loecker <jelle@elevenways.be>
14
14
  * @since 1.0.1
15
- * @version 1.0.5
15
+ * @version 1.2.4
16
16
  *
17
17
  * @param {String} title
18
18
  */
@@ -39,6 +39,22 @@ Editor.setMethod(function setTitle(title) {
39
39
 
40
40
  this.set('page_title', page_title);
41
41
  this.set('window_title', window_title || page_title);
42
+ this.toolbar_manager.title = page_title;
43
+ });
44
+
45
+ /**
46
+ * Set the context document
47
+ *
48
+ * @author Jelle De Loecker <jelle@elevenways.be>
49
+ * @since 1.2.4
50
+ * @version 1.2.4
51
+ *
52
+ * @param {Document} doc
53
+ */
54
+ Editor.setMethod(function setContextDocument(doc) {
55
+ let document_watcher = this.toolbar_manager.setDocument(doc);
56
+ this.toolbar_manager.setModel(doc.$model_name);
57
+ document_watcher.addWatcher(this.conduit);
42
58
  });
43
59
 
44
60
  /**
@@ -125,7 +141,7 @@ Editor.setAction(async function add(conduit, model_name) {
125
141
  *
126
142
  * @author Jelle De Loecker <jelle@elevenways.be>
127
143
  * @since 0.1.0
128
- * @version 1.2.3
144
+ * @version 1.2.4
129
145
  *
130
146
  * @param {Conduit} conduit
131
147
  * @param {String} model_name
@@ -185,6 +201,8 @@ Editor.setAction(async function edit(conduit, model_name, pk_val) {
185
201
  this.set('add_preview_button', true);
186
202
  }
187
203
 
204
+ this.setContextDocument(record);
205
+
188
206
  this.set('record_pk', record.$pk);
189
207
  this.set('model_name', model.model_name.toLowerCase());
190
208
  this.set('widget_config', widget_config);
File without changes
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.3",
4
+ "version": "1.2.5",
5
5
  "author": "Jelle De Loecker <jelle@elevenways.be>",
6
6
  "keywords": [
7
7
  "alchemy",
File without changes
File without changes
File without changes
@@ -0,0 +1,8 @@
1
+ <a
2
+ !Route="Chimera.Editor#add"
3
+ #model={% model_name %}
4
+ class="btn"
5
+ >
6
+ <al-icon icon-name="plus"></al-icon>
7
+ {%t "new" model=model_name %}
8
+ </a>
@@ -0,0 +1,10 @@
1
+ <a
2
+ !Route="Chimera.Editor#edit"
3
+ +model={% model_name %}
4
+ +pk={% record_pk %}
5
+ class="btn"
6
+ target="_blank"
7
+ >
8
+ <al-icon icon-name="pencil"></al-icon>
9
+ {%t "edit" model=model_name in="backend" %}
10
+ </a>
@@ -0,0 +1,10 @@
1
+ <a
2
+ !Route="Chimera.Editor#preview"
3
+ +model={% model_name %}
4
+ +pk={% record_pk %}
5
+ class="btn"
6
+ target="_blank"
7
+ >
8
+ <al-icon icon-name="eye"></al-icon>
9
+ {%t "preview" model=model_name %}
10
+ </a>
@@ -12,9 +12,40 @@
12
12
  </div>
13
13
  <div class="chimera-content">
14
14
  <div class="chimera-page-header">
15
- <div class="page-title" data-he-name="page-title"></div>
16
- <div class="page-notification" data-he-name="page-notification"></div>
17
- <div class="page-actions" data-he-name="page-actions"></div>
15
+ <div hidden>
16
+ <div class="page-title" data-he-name="page-title"></div>
17
+ <div class="page-notification" data-he-name="page-notification"></div>
18
+ <div class="page-actions" data-he-name="page-actions"></div>
19
+ </div>
20
+
21
+ <al-editor-toolbar
22
+ #toolbar_manager={% toolbar_manager %}
23
+ >
24
+ <div slot="left">
25
+ <div class="page-title">
26
+ <span data-toolbar="title"></span>
27
+ </div>
28
+ <div data-area="left-content"></div>
29
+ </div>
30
+
31
+ <div slot="center">
32
+ <al-user-avatar-group
33
+ class="watchers"
34
+ ></al-user-avatar-group>
35
+ </div>
36
+
37
+ <div slot="right">
38
+ <div data-area="buttons">
39
+
40
+ </div>
41
+ </div>
42
+ </al-editor-toolbar>
43
+
44
+ {#
45
+ <al-user-avatar
46
+ #user={% Acl.data %}
47
+ ></al-user-avatar>
48
+ #}
18
49
  </div>
19
50
  <div data-he-name="main" class="chimera-main">
20
51