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.
toggle-buttons-#109
Ro 2 years ago
parent 07b422a9c3
commit fcca7357bc
Signed by: are0h
GPG Key ID: 29B551CDBD4D3B50

@ -5,46 +5,36 @@
{% endblock %} {% endblock %}
{% block stylesheets %} {% 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 %} {% endblock %}
{% block mainContent %} {% block mainContent %}
<div id="post-index"> <section role="book-index-header">
<div id="post-index-wrapper"> <div role="book-index-header-left">
<div id="post-index-header">
<div id="post-index-header-left">
{{ filter }} {{ filter }}
Pages Pages
</div> </div>
<div id="post-index-header-right"> <div role="book-index-header-right">
<a href="/dashboard/pages/all" title="view all pages"> <a href="/dashboard/pages/all" title="view all pages">
<button> <button>
<svg> <i class="ti ti-clipboard-list"></i>
<use xlink:href="/assets/images/global/sprite.svg#entypo-archive"/>
</svg>
{{ stats['all'] }} {{ stats['all'] }}
</button> </button>
</a> </a>
<a href="/dashboard/pages/published" title="view publised pages"> <a href="/dashboard/pages/published" title="view publised pages">
<button> <button>
<svg> <i class="ti ti-clipboard-check"></i>
<use xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg>
{{ stats['published'] }} {{ stats['published'] }}
</button> </button>
</a> </a>
<a href="/dashboard/pages/deleted" title="view deleted pages"> <a href="/dashboard/pages/deleted" title="view deleted pages">
<button> <button>
<svg> <i class="ti ti-clipboard-off"></i>
<use xlink:href="/assets/images/global/sprite.svg#entypo-circle-with-cross"/>
</svg>
{{ stats['deleted'] }} {{ stats['deleted'] }}
</button> </button>
</a> </a>
</div> </section>
<section role="book-index-pages">
</div>
<div id="posts-list">
{% for page in pages %} {% for page in pages %}
{% if page.media[0].type == 'mp4' %} {% if page.media[0].type == 'mp4' %}
<a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link"> <a href="/dashboard/page/edit/{{ page.uuid }}" id="{{ page.uuid }}" class="page-link">
@ -54,23 +44,16 @@
Sorry, your browser doesn't support embedded videos. Sorry, your browser doesn't support embedded videos.
</video> </video>
<label>
{{ page.title }}
</label>
<div id="meta"> <div id="meta">
{{ include("dash/partials/recent-options.twig") }} {{ include("dash/partials/recent-meta.twig") }}
</div> </div>
</div> </div>
</a> </a>
{% else %} {% else %}
<a class="page-link" href="/dashboard/page/edit/{{ page.uuid }}"> <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 class="page-bg" style="background: url({{ page.media[0].file }}) no-repeat center center / cover">
<label>
{{ page.title }}
</label>
<div id="meta"> <div id="meta">
{{ include("dash/partials/recent-options.twig") }} {{ include("dash/partials/recent-meta.twig") }}
</div> </div>
</div> </div>
</a> </a>
@ -78,9 +61,9 @@
{% endfor %} {% endfor %}
{% if numOfPages > 1 %} {% if numOfPages > 1 %}
<div class="paginate"> <div role="paginate">
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['prevPage'] }}"> <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> <i class="ti ti-square-arrow-left"></i>
</a> </a>
<span class="count"> <span class="count">
{{ currentPage }} {{ currentPage }}
@ -88,12 +71,10 @@
{{ numOfPages }} {{ numOfPages }}
</span> </span>
<a class="page-btns" href="/dashboard/pages/{{ paginate['sort'] }}/{{ paginate['nextPage'] }}"> <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> <i class="ti ti-square-arrow-right"></i>
</a> </a>
</div> </div>
{% endif %} {% endif %}
</div> </section>
</div>
</div>
{% endblock %} {% endblock %}

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

@ -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;
}

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

@ -14,6 +14,15 @@ section[role="index-recent-pages"] a {
align-items: center; align-items: center;
border-radius: 5px; border-radius: 5px;
border-bottom: none; 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) { section[role="index-recent-pages"] a:nth-child(1) {
@ -76,6 +85,7 @@ section[role="index-recent-pages"] aside {
color: var(--white); color: var(--white);
text-shadow: 2px 2px 2px var(--black); text-shadow: 2px 2px 2px var(--black);
padding: 10px; padding: 10px;
z-index: 10;
} }
section[role="index-recent-pages"] hr { section[role="index-recent-pages"] hr {

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

@ -6954,25 +6954,18 @@ class $832f4be7bc001332$export$2e2bcd8739ae039 {
// event handlers // event handlers
//-------------------------- //--------------------------
removeFile(e) { removeFile(e) {
var list = []; var item = e.target.parentNode.parentNode;
switch(e.target.parentNode.className){ switch(item.className){
case "img-item": case "img-item":
case "video-item": case "video-item":
list = this.imageList; this.imageList.removeChild(item);
break; break;
case "audio-item": case "audio-item":
case "file-item": case "file-item":
list = this.fileList; this.fileList.removeChild(item);
break; break;
} }
for(let index = 0; index < list.childNodes.length; index++){ $832f4be7bc001332$var$notify.alert("File Removed!", true);
let media = list.childNodes[index];
if (media.id == e.target.id) {
list.removeChild(media);
$832f4be7bc001332$var$notify.alert("REINDEXING MEDIA", null);
//this.updateFiles();
}
}
} }
handleFileActions(e) { handleFileActions(e) {
e.stopPropagation(); e.stopPropagation();
@ -7104,7 +7097,7 @@ class $371d2518d50c1748$export$2e2bcd8739ae039 {
$371d2518d50c1748$var$notify.alert("Index cannot be deleted", false); $371d2518d50c1748$var$notify.alert("Index cannot be deleted", false);
return; 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; self.processing = true;
this.admin.pageActions((0, $cbea55afea03b976$export$f9aea0c55bfa15c9), page).then(()=>{ this.admin.pageActions((0, $cbea55afea03b976$export$f9aea0c55bfa15c9), page).then(()=>{
self.processing = false; self.processing = false;

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

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

Loading…
Cancel
Save