Fixes for removing media items and page deletion

The upload process changed, so some tweaks needed to me made to the page
deletion process, which just marks the page as deleted but keeps the
file. Also updated the file manager to properly delete items from the
display list.

The css for page listings also had to updated [forgot to put that on the
list] so the styles for that were updated and the template pages
adjusted accordingnly.

Also forgot to mention changes to the notification display in the last
commit. It's basic as of right now but it will be enhanced as needed.
This commit is contained in:
Ro 2023-03-24 14:57:01 -07:00
parent 07b422a9c3
commit fcca7357bc
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50
9 changed files with 206 additions and 120 deletions

View file

@ -5,95 +5,76 @@
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=dfvgy">
<link rel="stylesheet" type="text/css" href="/assets/css/dash/start.css?=vdthg">
{% endblock %}
{% block mainContent %}
<div id="post-index">
<div id="post-index-wrapper">
<div id="post-index-header">
<div id="post-index-header-left">
{{ filter }}
Pages
</div>
<div id="post-index-header-right">
<a href="/dashboard/pages/all" title="view all pages">
<button>
<svg>
<use xlink:href="/assets/images/global/sprite.svg#entypo-archive"/>
</svg>
{{ stats['all'] }}
</button>
</a>
<a href="/dashboard/pages/published" title="view publised pages">
<button>
<svg>
<use xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg>
{{ stats['published'] }}
</button>
</a>
<a href="/dashboard/pages/deleted" title="view deleted pages">
<button>
<svg>
<use xlink:href="/assets/images/global/sprite.svg#entypo-circle-with-cross"/>
</svg>
{{ stats['deleted'] }}
</button>
</a>
</div>
<section role="book-index-header">
<div role="book-index-header-left">
{{ filter }}
Pages
</div>
<div role="book-index-header-right">
<a href="/dashboard/pages/all" title="view all pages">
<button>
<i class="ti ti-clipboard-list"></i>
{{ stats['all'] }}
</button>
</a>
<a href="/dashboard/pages/published" title="view publised pages">
<button>
<i class="ti ti-clipboard-check"></i>
{{ stats['published'] }}
</button>
</a>
<a href="/dashboard/pages/deleted" title="view deleted pages">
<button>
<i class="ti ti-clipboard-off"></i>
{{ stats['deleted'] }}
</button>
</a>
</section>
<section role="book-index-pages">
{% for page in pages %}
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
<div class="page-video">
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
</div>
<div id="posts-list">
{% for page in pages %}
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
<div class="page-video">
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
<label>
{{ page.title }}
</label>
<div id="meta">
{{ include("dash/partials/recent-options.twig") }}
</div>
Sorry, your browser doesn't support embedded videos.
</video>
<div id="meta">
{{ include("dash/partials/recent-meta.twig") }}
</div>
</a>
{% else %}
<a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}">
<div class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<label>
{{ page.title }}
</label>
<div id="meta">
{{ include("dash/partials/recent-options.twig") }}
</div>
</div>
</a>
{% else %}
<a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}">
<div class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<div id="meta">
{{ include("dash/partials/recent-meta.twig") }}
</div>
</a>
{% endif %}
{% endfor %}
{% if numOfPages > 1 %}
<div class="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-left"/></svg>
</a>
<span class="count">
{{ currentPage }}
of
{{ numOfPages }}
</span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}">
<svg viewbox="0 0 20 20" class="icons"><use xlink:href="/assets/images/global/sprite.svg#entypo-chevron-right"/></svg>
</a>
</div>
</div>
</a>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% endfor %}
{% if numOfPages > 1 %}
<div role="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}">
<i class="ti ti-square-arrow-left"></i>
</a>
<span class="count">
{{ currentPage }}
of
{{ numOfPages }}
</span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}">
<i class="ti ti-square-arrow-right"></i>
</a>
</div>
{% endif %}
</section>
{% endblock %}

View file

@ -26,13 +26,12 @@
{% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="post-video-link recent-link">
{{ include("dash/partials/recent-meta.twig") }}
<video class="post-video" loop muted autoplay>
<source src="{{ page.media[0].file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
{{ include("dash/partials/recent-meta.twig") }}
</a>
{% else %}

View file

@ -0,0 +1,116 @@
section[role="book-index-header"] {
display: grid;
grid-template-columns: 1fr 1fr;
margin: 100px auto 20px;
width: 100%;
max-width: 900px;
}
section[role="book-index-header"] > div[role="book-index-header-left"] {
text-transform: capitalize;
display: inline-block;
color: var(--white);
font-size: 3em;
}
section[role="book-index-header"] > div[role="book-index-header-right"] {
text-align: right;
display: inline-block;
}
section[role="book-index-pages"] {
margin: 0 auto;
width: 100%;
max-width: 900px;
}
section[role="book-index-pages"] > a.page-link {
vertical-align: top;
display: inline-block;
width: 100%;
text-decoration: none;
margin: 0 0 20px;
border-radius: 3px;
height: 350px;
overflow: hidden;
}
section[role="book-index-pages"] > a.page-link div.page-video {
width: 100%;
height: 350px;
display: flex;
justify-content: left;
align-items: center;
border-radius: 5px;
border-bottom: none;
position: relative;
}
section[role="book-index-pages"] > a.page-link video {
width: 100%;
height: 100%;
position: absolute;
object-fit: cover;
}
section[role="book-index-pages"] > a.page-link > div.page-bg {
width: 100%;
height: 350px;
display: flex;
justify-content: left;
align-items: center;
border-radius: 5px;
border-bottom: none;
position: relative;
}
section[role="book-index-pages"] aside {
font-size: 1.1em;
color: var(--white);
text-shadow: 2px 2px 2px var(--black);
padding: 10px;
position: relative;
}
section[role="book-index-pages"] hr {
color: var(--white);
border: 0.1px solid;
margin: 7px 0;
}
section[role="book-index-pages"] button[data-active="true"] {
background: var(--primary);
}
section[role="book-index-pages"] button[data-active="true"] svg {
fill: var(--tertiary);
}
section[role="book-index-pages"] button[data-active="false"] {
background: var(--secondary);
}
section[role="book-index-pages"] button[data-active="false"] svg {
fill: var(--primary);
}
section[role="book-index-pages"] > div[role="paginate"] {
width: fit-content;
margin: 0 auto;
font-size: 1.5em;
color: var(--highlight);
}
section[role="book-index-pages"] > div[role="paginate"] i {
color: var(--secondary);
}
section[role="book-index-pages"] > div[role="paginate"] a,
section[role="book-index-pages"] > div[role="paginate"] span {
display: inline;
}
section[role="book-index-pages"] > div[role="paginate"] span {
position: relative;
top: -15px;
}

View file

@ -20,14 +20,10 @@ html body {
a {
color: var(--primary);
text-decoration: none;
border-bottom: 1px solid var(--secondary);
border-bottom: 0;
transition: all 0.2s linear;
}
a:hover {
border-bottom: 1px solid var(--highlight);
}
sup {
background: var(--black);
color: var(--white);

View file

@ -14,6 +14,15 @@ section[role="index-recent-pages"] a {
align-items: center;
border-radius: 5px;
border-bottom: none;
position: relative;
}
section[role="index-recent-pages"] a video {
width: 100%;
position: absolute;
object-fit: cover;
height: 100%;
border-radius: 5px;
}
section[role="index-recent-pages"] a:nth-child(1) {
@ -76,6 +85,7 @@ section[role="index-recent-pages"] aside {
color: var(--white);
text-shadow: 2px 2px 2px var(--black);
padding: 10px;
z-index: 10;
}
section[role="index-recent-pages"] hr {

View file

@ -5,5 +5,6 @@
@import url("icons.css");
@import url("notifications.css");
@import url("index.css");
@import url("book.css");
@import url("page-editor.css");
@import url("page-editor-highlights.css");

View file

@ -6954,25 +6954,18 @@ class $832f4be7bc001332$export$2e2bcd8739ae039 {
// event handlers
//--------------------------
removeFile(e) {
var list = [];
switch(e.target.parentNode.className){
var item = e.target.parentNode.parentNode;
switch(item.className){
case "img-item":
case "video-item":
list = this.imageList;
this.imageList.removeChild(item);
break;
case "audio-item":
case "file-item":
list = this.fileList;
this.fileList.removeChild(item);
break;
}
for(let index = 0; index < list.childNodes.length; index++){
let media = list.childNodes[index];
if (media.id == e.target.id) {
list.removeChild(media);
$832f4be7bc001332$var$notify.alert("REINDEXING MEDIA", null);
//this.updateFiles();
}
}
$832f4be7bc001332$var$notify.alert("File Removed!", true);
}
handleFileActions(e) {
e.stopPropagation();
@ -7104,7 +7097,7 @@ class $371d2518d50c1748$export$2e2bcd8739ae039 {
$371d2518d50c1748$var$notify.alert("Index cannot be deleted", false);
return;
}
if (confirm("AYE! You know you're deleting this post, right?")) new (0, $de01a7e5b1773530$export$2e2bcd8739ae039)().collectInfo(document.getElementById("featured-image-upload").files[0]).then((page)=>{
if (confirm("AYE! You know you're deleting this post, right?")) new (0, $de01a7e5b1773530$export$2e2bcd8739ae039)().collectInfo(this.fm.getFileOrder()).then((page)=>{
self.processing = true;
this.admin.pageActions((0, $cbea55afea03b976$export$f9aea0c55bfa15c9), page).then(()=>{
self.processing = false;

View file

@ -177,9 +177,7 @@ export default class PostEditor {
}
if (confirm("AYE! You know you're deleting this post, right?")) {
new PageActions()
.collectInfo(
document.getElementById('featured-image-upload').files[0]
)
.collectInfo(this.fm.getFileOrder())
.then(page => {
self.processing = true;
this.admin

View file

@ -249,26 +249,18 @@ export default class FileManager {
// event handlers
//--------------------------
removeFile(e) {
var list = [];
switch (e.target.parentNode.className) {
var item = e.target.parentNode.parentNode;
switch (item.className) {
case 'img-item':
case 'video-item':
list = this.imageList;
this.imageList.removeChild(item);
break;
case 'audio-item':
case 'file-item':
list = this.fileList;
this.fileList.removeChild(item);
break;
}
for (let index = 0; index < list.childNodes.length; index++) {
let media = list.childNodes[index];
if (media.id == e.target.id) {
list.removeChild(media);
notify.alert('REINDEXING MEDIA', null);
//this.updateFiles();
}
}
notify.alert('File Removed!', true);
}
handleFileActions(e) {