Proper assets template
This commit is contained in:
parent
16a7d81535
commit
184b062135
@ -9,8 +9,12 @@ const topSection = window.location.pathname.split('/')[1]
|
|||||||
if (topSection) document.body.classList.add(topSection)
|
if (topSection) document.body.classList.add(topSection)
|
||||||
|
|
||||||
// Differentiate users and authors
|
// Differentiate users and authors
|
||||||
if ('pages' === topSection)
|
if ('pages' === topSection) {
|
||||||
document.body.classList.add('author')
|
document.body.classList.add('author')
|
||||||
|
} else {
|
||||||
|
// Check if access is authorized to root page
|
||||||
|
fetch('/').then(() => document.body.classList.add('author'))
|
||||||
|
}
|
||||||
|
|
||||||
// Setup a "property" attribute, to send to the backend for insertion/update/deletion
|
// Setup a "property" attribute, to send to the backend for insertion/update/deletion
|
||||||
document.querySelectorAll('body > header h1, main article header h1')
|
document.querySelectorAll('body > header h1, main article header h1')
|
||||||
|
27
themes/acoeur/layouts/_default/assets.html
Normal file
27
themes/acoeur/layouts/_default/assets.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<article class="pa3 pa4-ns nested-copy-line-height">
|
||||||
|
<aside id="actions" class="w-30-l mt4-l fr tc">
|
||||||
|
<button class="br-pill pa3 pointer"><label for="file">{{ T (print .Section ".create") }}</label></button>
|
||||||
|
<input id="file" multiple name="file" type="file"/>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
{{ with .Content }}
|
||||||
|
<section id="content"
|
||||||
|
class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
|
||||||
|
{{- . -}}
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<section class="flex-ns flex-wrap justify-around">
|
||||||
|
{{ range .Resources }}
|
||||||
|
<div class="relative w-100 w-30-l mb4 bg-white">
|
||||||
|
<img src="{{ .RelPermalink }}" title="{{.}}" alt="{{.}}" />
|
||||||
|
{{ . }}
|
||||||
|
<button class="delete_image br-pill pa3 pointer" data-target="{{.RelPermalink}}">
|
||||||
|
{{ T (print $.Section ".delete") }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
@ -1,12 +1,9 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<article class="pa3 pa4-ns nested-copy-line-height">
|
<article class="pa3 pa4-ns nested-copy-line-height">
|
||||||
<aside id="actions" class="w-30-l mt4-l fr tc">
|
<aside id="actions" class="w-30-l mt4-l fr tc">
|
||||||
{{ if eq .Section "assets" }}
|
{{ if .Parent.IsHome }}
|
||||||
<button class="br-pill pa3 pointer"><label for="file">{{ T (print .Section ".create") }}</label></button>
|
|
||||||
<input id="file" multiple name="file" type="file"/>
|
|
||||||
{{ else if .Parent.IsHome }}
|
|
||||||
<button id="create" class="br-pill pa3 pointer">{{ T (print .Section ".create") }}</button>
|
<button id="create" class="br-pill pa3 pointer">{{ T (print .Section ".create") }}</button>
|
||||||
{{ else }}
|
{{ else if .Parent.Parent.IsHome }}
|
||||||
<button id="delete" class="br-pill pa3 pointer">{{ T (print .Section ".delete") }}</button>
|
<button id="delete" class="br-pill pa3 pointer">{{ T (print .Section ".delete") }}</button>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</aside>
|
</aside>
|
||||||
@ -33,19 +30,8 @@
|
|||||||
{{ .Render "summary-with-image" }}
|
{{ .Render "summary-with-image" }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- template "_internal/pagination.html" . -}}
|
|
||||||
|
|
||||||
{{ if .Parent.IsHome }}
|
{{- template "_internal/pagination.html" . -}}
|
||||||
{{ range .Resources }}
|
|
||||||
<div class="relative w-100 w-30-l mb4 bg-white">
|
|
||||||
<img src="{{ .RelPermalink }}" title="{{.}}" alt="{{.}}" />
|
|
||||||
{{ . }}
|
|
||||||
<button class="delete_image br-pill pa3 pointer" data-target="{{.RelPermalink}}">
|
|
||||||
{{ T (print $.Section ".delete") }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user