This repository was archived by the owner on Mar 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolidjs-admin.jinja
More file actions
81 lines (76 loc) · 2.38 KB
/
solidjs-admin.jinja
File metadata and controls
81 lines (76 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{%- import "macros.jinja" as macros -%}
{%- macro get_input_type(name, property, required=false) -%}
{%- filter trim -%}
{%- if macros.relation_is_many_to_one(property)=='true' or macros.relation_is_one_to_one(property)=='true' -%}
SelectField
{%- elif macros.relation_is_many_to_many(property)=='true' or macros.relation_is_one_to_many(property)=='true' -%}
SelectField
{%- elif 'type' in property and property.type == "string" -%}
{%- if property.format and property.format == "uuid" -%}
TextField
{%- elif property.format and property.format == "date-time" -%}
DateTimeField
{%- elif property.format and property.format == "date" -%}
DateField
{%- elif property.format and property.format == "time" -%}
TextField
{%- else -%}
TextField
{%- endif -%}
{%- elif 'type' in property and property.type == "boolean" -%}
BooleanField
{%- elif 'type' in property and property.type == "integer" -%}
NumberField
{%- elif 'type' in property and property.type == "number" -%}
NumberField
{%- elif 'enum' in property -%}
SelectField
{%- else -%}
TextField
{%- endif -%}
{%- endfilter -%}
{%- endmacro -%}
{%- macro get_choices(property) -%}
{%- filter trim -%}
{%- if 'enum' in property -%}
options={[
{%- for enum in property.enum -%}{ value: '{{ enum }}', label: '{{ enum }}' }{{ ',' if not loop.last }}{%- endfor -%}]}
{%- endif -%}
{%- endfilter -%}
{%- endmacro -%}
{%- macro source(name, property) -%}
{%- filter trim -%}
{{name | camel_case}}
{%- if macros.relation_is_many_to_one(property)=='true' -%}
.id
{%- endif -%}
{%- endfilter -%}
{%- endmacro -%}
{%- macro get_column_type(property) -%}
{%- filter trim -%}
{%- if 'type' in property and property.type == "string" -%}
{%- if property.format and property.format == "date-time" -%}
date
{%- elif property.format and property.format == "date" -%}
date
{%- else -%}
string
{%- endif -%}
{%- elif 'type' in property and property.type == "boolean" -%}
boolean
{%- elif 'type' in property and property.type == "integer" -%}
number
{%- elif 'type' in property and property.type == "number" -%}
number
{%- else -%}
string
{%- endif -%}
{%- endfilter -%}
{%- endmacro -%}
{%- macro is_required(entity, name) -%}
{%- filter trim -%}
{%- if 'required' in entity and name in entity.required -%}
required
{%- endif -%}
{%- endfilter -%}
{%- endmacro -%}