~evanj/cms

ref: 991b370ac6b6208e5f2fd7dcada177d52be58d9f cms/internal/v/html/content.html -rw-r--r-- 16.2 KiB
991b370aEvan M Jones Feat(Big): Added a few things here... 1 year, 2 months ago
                                                                                
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<!DOCTYPE html>
<html lang=en>
<head>
  {{ template "html/_head.html" }}
  <title>CMS | {{ .Space.Name }} | {{ .ContentType.Name }} | {{ (.Content.MustValueByName "name").Value }}</title>
</head>
<body class='content bg-light'>
  <style>{{ template "css/main.css" }}</style>
  <main>
    {{ template "html/_header.html" $ }}
    <div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
      <h1 class="display-4">{{ (.Content.MustValueByName "name").Value }}</h1>
    </div>
    <article class='container'>
      <div class='row'>
        <div class='col-12 col-lg-8 offset-lg-2'>
          <form method=POST action='/content' enctype='multipart/form-data'>
            <input type=hidden name=method value=PATCH />
            <input required type=hidden name=space value="{{ .Space.ID }}" />
            <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
            <input required type=hidden name=content value="{{ .Content.ID }}" />

            {{ range $index, $item := .ContentType.Fields }}
              {{ $val := $.Content.MustValueByName ( $item.Name ) }}

              <div class='form-group'>
              {{ if $val }} 
                <label for="value_update_{{ $val.Type }}-{{ $val.ID }}">{{ title $val.Name }}</label>

                {{ if eq $val.Type "StringSmall" }}
                  <input class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" value="{{ $val.Value }}" required type=text name="value_update_{{ $val.Type }}-{{ $val.ID }}" placeholder="{{ $val.Name }}" />
                {{ end }}

                {{ if eq $val.Type "StringBig" }}
                  <textarea class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" required type=text name="value_update_{{ $val.Type }}-{{ $val.ID }}" placeholder="{{ $val.Name }}">{{ $val.Value }}</textarea>
                {{ end }}

                {{ if eq $val.Type "InputHTML" }}
                  <textarea class="form-control input-html" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" value="{{ $val.Value }}" required type=text name="value_update_{{ $val.Type }}-{{ $val.ID }}" placeholder="{{ $val.Name }}">{{ $val.Value }}</textarea>
                {{ end }}

                {{ if eq $val.Type "InputMarkdown" }}
                  <textarea class="form-control input-markdown" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" value="{{ $val.Value }}" required type=text name="value_update_{{ $val.Type }}-{{ $val.ID }}" placeholder="{{ $val.Name }}">{{ $val.Value }}</textarea>
                {{ end }}

                {{ if eq $val.Type "File" }}
                  <div class="form-file mb-3">
                    <input {{ if eq $index 0 }} autofocus {{ end }} name="value_update_{{ $val.Type }}-{{ $val.ID }}" id="value_update_{{ $val.Type }}-{{ $val.ID }}" value="{{ $val.Value }}" required multiple=false type="file" class="form-file-input">
                    <label class="form-file-label" for="value_update_{{ $val.Type }}-{{ $val.ID }}">
                      <span class="form-file-text">Choose file...</span>
                      <span class="form-file-button">Browse</span>
                    </label>
                  </div>
                {{ end }}

                {{ if eq $val.Type "Date" }}
                  <input class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" value="{{ $val.Value }}" required type=date name="value_update_{{ $val.Type }}-{{ $val.ID }}" placeholder="{{ $val.Name }}" />
                {{ end }}

                {{ if eq $val.Type "Reference" }}
                  <div class='ref-modal'>
                    <input {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" class='output-ref' required type=hidden value="{{ $val.Value }}" name="value_update_{{ $val.Type }}-{{ $val.ID}}" />
                    <input data-toggle="modal" data-target="#modal_value_update_{{ $val.Type }}-{{ $val.ID }}" class="form-control input-ref w-auto" type=button value="{{ if  $val.RefName }}{{ $val.RefName }}{{ else }}Open{{ end}}"/>
                    <div id="modal_value_update_{{ $val.Type }}-{{ $val.ID }}" data-focus="false" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="refModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h5 class="modal-title">Find Content for Reference</h5>
                            <button type="button" class="close" data-dismiss-inner="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>
                          <div class='modal-body overflow-initial'>
                            <label class='d-block'>Content Type</label>
                            <input class='mb-3 form-control input-contenttype' type=text placeholder='Search by Content Type' />
                            <label class='d-block'>Content Name</label>
                            <input disabled class='mb-3 form-control input-content' type=text placeholder='Search by Content Name' />
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary btn-clear">Clear</button>
                            <button type="button" class="btn btn-primary" data-dismiss-inner="modal">Go</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                {{ end }}

                {{ if eq $val.Type "ReferenceList" }}
                  <div class='ref-modal ref-list'>
                    <input {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ $val.Type }}-{{ $val.ID }}" class='output-ref' required type=hidden value="{{ $val.Value }}" name="value_update_{{ $val.Type }}-{{ $val.ID }}" />
                    <input data-toggle="modal" data-target="#modal_value_update_{{ $val.Type }}-{{ $val.ID }}" class="form-control input-ref w-auto" type=button value="{{ if  $val.RefListNames }}{{ $val.RefListNames }}{{ else }}Open{{ end}}"/>
                    <div id="modal_value_update_{{ $val.Type }}-{{ $val.ID }}" data-focus="false" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="refModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h5 class="modal-title">Find Content for Reference List</h5>
                            <button type="button" class="close" data-dismiss-inner="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>
                          <div class='modal-body overflow-initial'>
                            <label class='d-block'>Content Type</label>
                            <input class='mb-3 form-control input-contenttype' type=text placeholder='Search by Content Type' />
                            <label class='d-block'>Content Name</label>
                            <input disabled class='mb-3 form-control input-content' type=text placeholder='Search by Content Name' />
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary btn-clear">Clear</button>
                            <button type="button" class="btn btn-primary" data-dismiss-inner="modal">Go</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                {{ end }}
                <div class="mb-3"></div>
              {{ else }}
                <label for="value_update_{{ .Type }}-{{ .Name }}">{{ title .Name }}</label>

                {{ if eq .Type "StringSmall" }}
                  <input class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" required type=text name="{{ .Type }}-{{ .Name }}" placeholder="{{ .Name }}" />
                {{ end }}

                {{ if eq .Type "StringBig" }}
                  <textarea class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" required type=text name="{{ .Type }}-{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
                {{ end }}

                {{ if eq .Type "InputHTML" }}
                  <textarea class="form-control input-html" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" required type=text name="{{ .Type }}-{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
                {{ end }}

                {{ if eq .Type "InputMarkdown" }}
                  <textarea class="form-control input-markdown" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" required type=text name="{{ .Type }}-{{ .Name }}" placeholder="{{ .Name }}" ></textarea>
                {{ end }}

                {{ if eq .Type "File" }}
                  <div class="form-file mb-3">
                    <input {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" name="{{ .Type }}-{{ .Name }}" required multiple=false type="file" class="form-file-input">
                    <label class="form-file-label" for="value_update_{{ .Type }}-{{ .Name }}">
                      <span class="form-file-text">Choose file...</span>
                      <span class="form-file-button">Browse</span>
                    </label>
                  </div>
                {{ end }}

                {{ if eq .Type "Date" }}
                  <input class="form-control" {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" required type=date name="{{ .Type }}-{{ .Name }}" placeholder="{{ .Name }}" />
                {{ end }}

                {{ if eq .Type "Reference" }}
                  <div class='ref-modal'>
                    <input {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" class='output-ref' required type=hidden name="{{ .Type }}-{{ .Name }}" />
                    <input data-toggle="modal" data-target="#modal_value_update_{{ .Type }}-{{ .ID }}" class="form-control input-ref w-auto" type=button value=Open />
                    <div id="modal_value_update_{{ .Type }}-{{ .ID }}" data-focus="false" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="refModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h5 class="modal-title">Find Content for Reference</h5>
                            <button type="button" class="close" data-dismiss-inner="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>
                          <div class='modal-body overflow-initial'>
                            <label class='d-block'>Content Type</label>
                            <input class='mb-3 form-control input-contenttype' type=text placeholder='Search by Content Type' />
                            <label class='d-block'>Content Name</label>
                            <input disabled class='mb-3 form-control input-content' type=text placeholder='Search by Content Name' />
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary btn-clear">Clear</button>
                            <button type="button" class="btn btn-primary" data-dismiss-inner="modal">Go</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                {{ end }}

                {{ if eq .Type "ReferenceList" }}
                  <div class='ref-modal ref-list'>
                    <input {{ if eq $index 0 }} autofocus {{ end }} id="value_update_{{ .Type }}-{{ .Name }}" class='output-ref' required type=hidden name="{{ .Type }}-{{ .Name }}" />
                    <input data-toggle="modal" data-target="#modal_value_update_{{ .Type }}-{{ .ID }}" class="form-control input-ref w-auto" type=button value=Open />
                    <div id="modal_value_update_{{ .Type }}-{{ .ID }}" data-focus="false" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="refModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-dialog-centered">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h5 class="modal-title">Find Content for Reference List</h5>
                            <button type="button" class="close" data-dismiss-inner="modal" aria-label="Close">
                              <span aria-hidden="true">&times;</span>
                            </button>
                          </div>
                          <div class='modal-body overflow-initial'>
                            <label class='d-block'>Content Type</label>
                            <input class='mb-3 form-control input-contenttype' type=text placeholder='Search by Content Type' />
                            <label class='d-block'>Content Name</label>
                            <input disabled class='mb-3 form-control input-content' type=text placeholder='Search by Content Name' />
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary btn-clear">Clear</button>
                            <button type="button" class="btn btn-primary" data-dismiss-inner="modal">Go</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  <div class='ref-modal'>
                {{ end }}
                <div class="mb-3"></div>
              {{ end }}
              </div>
            {{ end}}
            <div class='d-flex justify-content-end mb-3'>
              <button type="submit" class="btn btn-primary">Save</button>
            </div>
          </form>

          <form method=POST action='/content' enctype='multipart/form-data'>
            <input type=hidden name=method value=DELETE />
            <input required type=hidden name=space value="{{ .Space.ID }}" />
            <input required type=hidden name=contenttype value="{{ .ContentType.ID }}" />
            <input required type=hidden name=content value="{{ .Content.ID }}" />
            <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
              <div class="modal-dialog modal-dialog-scrollable">
                <div class="modal-content">
                  <div class="modal-header">
                    <h5 class="modal-title" id="deleteModalLabel">Delete {{ (.Content.MustValueByName "name").Value }}</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                      <span aria-hidden="true">&times;</span>
                    </button>
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-primary">Go</button>
                  </div>
                </div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </article>
    {{ template "html/_footer.html" $ }}
  </main>
  {{ template "html/_scripts.html" }}
  <script src="/static/js/tinymce.min.js"></script>
  <script src='/static/js/autocomplete.min.js'></script>
  <script>{{ template "js/main.js" $ }}</script>
  <script>{{ template "js/content.js" $ }}</script>
</body>

</html>