alchemy-chimera 1.0.3 → 1.0.4
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
|
@@ -48,11 +48,21 @@ body {
|
|
|
48
48
|
border-radius: 2px;
|
|
49
49
|
font-weight: 500;
|
|
50
50
|
cursor: pointer;
|
|
51
|
+
padding: 0.4rem 0.7rem;
|
|
52
|
+
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
gap: 0.2rem;
|
|
51
57
|
|
|
52
58
|
&:hover {
|
|
53
59
|
background-color: var(--button-bg-hover-color);
|
|
54
60
|
//filter: brightness(1.05);
|
|
55
61
|
}
|
|
62
|
+
|
|
63
|
+
al-ico {
|
|
64
|
+
margin-right: 4px;
|
|
65
|
+
}
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
.primary {
|
|
@@ -127,7 +137,7 @@ body {
|
|
|
127
137
|
|
|
128
138
|
.chimera-content {
|
|
129
139
|
background-color: var(--main-bg-color);
|
|
130
|
-
flex:
|
|
140
|
+
flex: 10 0;
|
|
131
141
|
display: flex;
|
|
132
142
|
flex-flow: column;
|
|
133
143
|
|
|
@@ -163,6 +173,8 @@ body {
|
|
|
163
173
|
.chimera-main {
|
|
164
174
|
flex: 1;
|
|
165
175
|
padding: 0.5rem;
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-flow: column;
|
|
166
178
|
|
|
167
179
|
&[data-he-template="chimera/widgets"] {
|
|
168
180
|
h1 {
|
|
@@ -290,7 +302,7 @@ alchemy-field {
|
|
|
290
302
|
display: flex;
|
|
291
303
|
|
|
292
304
|
button {
|
|
293
|
-
flex:
|
|
305
|
+
flex: 10;
|
|
294
306
|
font-size: 16px;
|
|
295
307
|
font-weight: 500;
|
|
296
308
|
color: var(--button-text-color);
|
|
@@ -319,10 +331,10 @@ alchemy-field {
|
|
|
319
331
|
.field {
|
|
320
332
|
display: flex;
|
|
321
333
|
padding: 1rem;
|
|
322
|
-
flex:
|
|
334
|
+
flex: 10;
|
|
323
335
|
|
|
324
336
|
> * {
|
|
325
|
-
flex:
|
|
337
|
+
flex: 10;
|
|
326
338
|
}
|
|
327
339
|
|
|
328
340
|
> alchemy-widget {
|
|
@@ -397,7 +409,7 @@ alchemy-field-array {
|
|
|
397
409
|
.chimera-editor-widgets {
|
|
398
410
|
|
|
399
411
|
alchemy-widgets-column.toc-col {
|
|
400
|
-
flex:
|
|
412
|
+
flex: 2 2;
|
|
401
413
|
}
|
|
402
414
|
|
|
403
415
|
table-of-contents[elements-selector="alchemy-field"] {
|
|
@@ -448,4 +460,18 @@ alchemy-field-schema {
|
|
|
448
460
|
background-color: var(--button-bg-hover-color);
|
|
449
461
|
}
|
|
450
462
|
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.chimera-confirm-page {
|
|
466
|
+
flex: 1;
|
|
467
|
+
justify-content: center;
|
|
468
|
+
display: flex;
|
|
469
|
+
align-items: center;
|
|
470
|
+
flex-flow: column;
|
|
471
|
+
flex-direction: column;
|
|
472
|
+
|
|
473
|
+
.action-buttons {
|
|
474
|
+
display: flex;
|
|
475
|
+
gap: 1rem;
|
|
476
|
+
}
|
|
451
477
|
}
|
package/config/routes.js
CHANGED
|
@@ -35,6 +35,14 @@ chimera_section.add({
|
|
|
35
35
|
breadcrumb : 'chimera.editor.{model}.edit.{pk}'
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
// Editor trash action
|
|
39
|
+
chimera_section.add({
|
|
40
|
+
name : 'Chimera.Editor#trash',
|
|
41
|
+
methods : ['get', 'post'],
|
|
42
|
+
paths : '/editor/{model}/trash/{pk}',
|
|
43
|
+
breadcrumb : 'chimera.editor.{model}.trash.{pk}'
|
|
44
|
+
});
|
|
45
|
+
|
|
38
46
|
// Editor data action
|
|
39
47
|
chimera_section.add({
|
|
40
48
|
name : 'Chimera.Editor#records',
|
|
@@ -178,12 +178,52 @@ Editor.setAction(async function edit(conduit, model_name, pk_val) {
|
|
|
178
178
|
this.render('chimera/widgets');
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* The trash action
|
|
183
|
+
*
|
|
184
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
185
|
+
* @since 1.0.4
|
|
186
|
+
* @version 1.0.4
|
|
187
|
+
*
|
|
188
|
+
* @param {Conduit} conduit
|
|
189
|
+
* @param {String} model_name
|
|
190
|
+
* @param {String} pk_val
|
|
191
|
+
*/
|
|
192
|
+
Editor.setAction(async function trash(conduit, model_name, pk_val) {
|
|
193
|
+
|
|
194
|
+
let model = this.getModel(model_name);
|
|
195
|
+
|
|
196
|
+
model.translateItems = false;
|
|
197
|
+
|
|
198
|
+
let record = await model.findByPk(pk_val);
|
|
199
|
+
|
|
200
|
+
if (!record) {
|
|
201
|
+
return conduit.notFound();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
let index_url = alchemy.routeUrl('Chimera.Editor#index', {
|
|
205
|
+
model : model_name
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
if (conduit.method == 'post') {
|
|
209
|
+
await record.remove();
|
|
210
|
+
conduit.redirect(index_url);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let referer = conduit.headers.referer || index_url;
|
|
215
|
+
|
|
216
|
+
this.set('back_url', referer);
|
|
217
|
+
this.set('record', record);
|
|
218
|
+
this.render('chimera/editor/trash');
|
|
219
|
+
});
|
|
220
|
+
|
|
181
221
|
/**
|
|
182
222
|
* The records API action
|
|
183
223
|
*
|
|
184
224
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
185
225
|
* @since 1.0.0
|
|
186
|
-
* @version 1.0.
|
|
226
|
+
* @version 1.0.4
|
|
187
227
|
*
|
|
188
228
|
* @param {Conduit} conduit
|
|
189
229
|
* @param {String} model_name
|
|
@@ -241,15 +281,29 @@ Editor.setAction(async function records(conduit, model_name) {
|
|
|
241
281
|
|
|
242
282
|
for (record of records) {
|
|
243
283
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
284
|
+
let edit_action = new Classes.Alchemy.Form.Action.Url({
|
|
285
|
+
name : 'edit',
|
|
286
|
+
icon : 'edit',
|
|
287
|
+
placement : ['row', 'context'],
|
|
288
|
+
url : alchemy.routeUrl('Chimera.Editor#edit', {
|
|
289
|
+
model : model_name,
|
|
290
|
+
pk : record.$pk,
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
let trash_action = new Classes.Alchemy.Form.Action.Url({
|
|
295
|
+
name : 'trash',
|
|
296
|
+
icon : 'trash',
|
|
297
|
+
placement : ['context'],
|
|
298
|
+
url : alchemy.routeUrl('Chimera.Editor#trash', {
|
|
249
299
|
model : model_name,
|
|
250
300
|
pk : record.$pk,
|
|
251
301
|
})
|
|
252
|
-
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
record.$hold.actions = [
|
|
305
|
+
edit_action,
|
|
306
|
+
trash_action,
|
|
253
307
|
];
|
|
254
308
|
}
|
|
255
309
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{% include "layouts/chimera_basics" %}
|
|
2
|
+
|
|
3
|
+
{% block "main" %}
|
|
4
|
+
<div class="chimera-confirm-page">
|
|
5
|
+
<h1>{%t "confirm-delete-title" %}</h1>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
{%t "confirm-delete-text" model=record.$model_name title=record.getDisplayFieldValue() %}
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<br>
|
|
12
|
+
|
|
13
|
+
<form class="action-buttons">
|
|
14
|
+
<a class="btn" href={% back_url %}>
|
|
15
|
+
{%t "cancel" %}
|
|
16
|
+
</a>
|
|
17
|
+
<button class="btn danger">
|
|
18
|
+
<al-ico type="trash" class="fas fa-trash"></al-ico>
|
|
19
|
+
{%t "delete" %}
|
|
20
|
+
</button>
|
|
21
|
+
</form>
|
|
22
|
+
</div>
|
|
23
|
+
{% /block %}
|
|
24
|
+
|
|
25
|
+
{% block "page-actions" %}
|
|
26
|
+
<a
|
|
27
|
+
!Route="Chimera.Editor#add"
|
|
28
|
+
#model={% model_name %}
|
|
29
|
+
class="btn"
|
|
30
|
+
>
|
|
31
|
+
<al-ico type="plus"></al-ico>
|
|
32
|
+
{%t "new" model=model_name %}
|
|
33
|
+
</a>
|
|
34
|
+
{% /block %}
|