page editor template rebuilt

There are some spacing issues that need to be addressed but the page
editor template has been added and the CSS all lines up

scripting is still an issue as the backend that handles content still
isn't in place, but the front facing piece is in place so now those
components can be built

scripting is going to get an overhaul anyway, so this is a good place to
start that process
This commit is contained in:
ro 2024-03-05 15:49:30 -06:00
parent 177f29802b
commit d1c3b4a8f6
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50
12 changed files with 7967 additions and 13 deletions

View file

@ -43,18 +43,15 @@ class DashController extends Controller
]);
}
public function page($uuid)
public function page($mode, $uuid)
{
$status = session('handle') !== null ? true : false;
$result = [];
if ($status) {
$result = $this->pages->getPage($pageNum, 4, $pageFilter);
}
return view('back.book', [
"status" => $status,
"result" => $result,
"currentPage" => $pageNum,
"title" => "Pages"
$page = $this->pages->getById($uuid)->first();
return view('back.page', [
"status" => $status,
"mode" => $mode,
"page" => $page,
"title" => 'Editing ' . $page['title']
]);
}
}

View file

@ -32,6 +32,7 @@ class PageRepository implements PageRepositoryInterface
public function getById($uuid)
{
return $this->pages->where('uuid', $uuid);
}
public function delete($uuid)

View file

@ -23,6 +23,7 @@
"laravel/tinker": "^2.8",
"league/commonmark": "^2.4",
"lodash-php/lodash-php": "^0.09.0",
"mindtwo/laravel-blade-spaceless": "^1.2",
"mnapoli/front-yaml": "^2.0",
"olegatro/html-sanitizer-relative": "^1.0",
"symfony/yaml": "^7.0",

51
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "35ea09eaea488e5d0e0c4a22059c367c",
"content-hash": "7fbeca42f1a6ac784e32ca1e42e61d7a",
"packages": [
{
"name": "brick/math",
@ -2088,6 +2088,55 @@
},
"time": "2023-05-10T11:58:31+00:00"
},
{
"name": "mindtwo/laravel-blade-spaceless",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/mindtwo/laravel-blade-spaceless.git",
"reference": "0559d365f61dbe4aba6a782736b6e782ce25714d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mindtwo/laravel-blade-spaceless/zipball/0559d365f61dbe4aba6a782736b6e782ce25714d",
"reference": "0559d365f61dbe4aba6a782736b6e782ce25714d",
"shasum": ""
},
"require": {
"illuminate/support": "6.*|^7.0|^8.0|^9.0|^10.0"
},
"type": "package",
"extra": {
"laravel": {
"providers": [
"mindtwo\\Spaceless\\SpacelessServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"mindtwo\\Spaceless\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "mindtwo GmbH",
"email": "info@mindtwo.de",
"homepage": "https://www.mindtwo.de/",
"role": "Developer"
}
],
"description": "Spaceless Blade Directive",
"support": {
"issues": "https://github.com/mindtwo/laravel-blade-spaceless/issues",
"source": "https://github.com/mindtwo/laravel-blade-spaceless/tree/1.2.2"
},
"time": "2023-04-05T15:53:59+00:00"
},
{
"name": "mnapoli/front-yaml",
"version": "2.0.3",

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,199 @@
@extends('frame')
@section('title', 'The Dash | Edit Page')
@php
@if($mode == 'edit')
$id = $page['id'];
$uuid = $page['uuid'];
$slug = $page['slug'];
$feature = $page['feature'];
$layout = $page['layout']
$tags = $page['tags'];
$content = $page['content'];
$date = $page['created'];
$updated = $page['updated'];
$media = $page['media'];
$files = $page['docs'];
@else
$id = "";
$uuid = "";
$slug = "";
$feature = "";
$layout = "";
$tags = "";
$content = "";
$date = "";
$updated = "";
$media = "";
$files = "";
@endif
@endphp
@section('main-content')
<section data-index="{{ $id }}" data-uuid="{{ $uuid }}" data-slug="{{ $slug }}" data-layout="{{ $layout }}" role="file-manager">
@if($page['feature'] == null)
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list"></div>
<label role="list-title">FILES</label>
<div role="page-files-list"></div>
@else
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list">
@if(count($media)>1)
{% for item in media %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp4" %}
<div id="{{ loop.index0 }}" class="video-item" data-source="{{ item.file }}">
<video>
<source src="{{ item.file }}"/>
</video>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="img-item" data-source="{{ item.file }}" style="background: url({{ item.file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% endfor %}
@else
{% if media[0] != '' %}
{% set fileName = media[0].file|split('/') %}
{% if media[0].type == "mp4" %}
<div id="0" class="video-item" data-source="{{ media[0].file }}">
<button id="{{ loop.index0 }}" class="media-remove">X</button>
</div>
{% else %}
<div id="0" class="img-item" data-source="{{ media[0].file }}" style="background: url({{ media[0].file }}) no-repeat center center / cover">
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% else %}
{% endif %}
@endif
</div>
<label role="list-title">FILES</label>
<div role="page-files-list">
{% if files|length > 1 %}
{% for item in files %}
{% set fileName = item.file|split('/') %}
{% if item.type == "mp3" %}
<div id="{{ loop.index0 }}" class="audio-item" data-source="{{ item.file }}">
<audio controls>
<source src="{{ item.file }}"/>
</audio>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="{{ loop.index0 }}" class="file-item" data-source="{{ item.file }}">
<a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% endfor %}
{% else %}
{% if files[0] != '' %}
{% set fileName = files[0].file|split('/') %}
{% if files[0].type == "mp3" %}
<div id="0" class="audio-item" data-source="{{ files[0].file }}">
<audio controls>
<source src="{{ files[0].file }}"/>
</audio>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% else %}
<div id="0" class="file-item" data-source="{{ files[0].file }}">
<a href="{{ item.file }}" target="_blank">{{ fileName[6] }}"</a>
<button id="{{ loop.index0 }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
{% endif %}
{% else %}
{% endif %}
{% endif %}
</div>
@endif
</section>
<section role="page-meta">
<div role="page-meta-wrapper">
<div role="page-title">
<strong>TITLE</strong>
<textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ title }}</textarea>
</div>
<div role="page-tags">
<strong>TAGS</strong>
<textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ tags }}</textarea>
</div>
<div role="page-layouts">
<strong>LAYOUTS</strong>
<select id="page-templates">
{% for view in views %}
{% if view == page['layout'] %}
<option value={{ view }} selected>{{ view }}</option>
{% else %}
<option value={{ view }}>{{ view }}</option>
{% endif %}
{% endfor %}
</select>
</div>
<div role="page-options">
<strong>OPTIONS</strong>
{% apply spaceless %}
{{ include("dash/partials/options.twig") }}
{% endapply %}
</div>
<div role="page-updated">
<strong>UPDATED</strong>
<span id="post-date" type="text">
{{ updated }}
</span>
</div>
<div role="page-created">
<strong>CREATED</strong>
<span id="post-date" type="text">
{{ date }}
</span>
<input id="page-files-upload" type="file" name="page-files-upload" multiple/>
<input id="post-image-upload" type="file" name="post-image-upload"/>
<input id="form_token" name="token" type="hidden" value="{{ token }}"></div>
</div>
</div>
</section>
<section role="text-editor">
{% apply spaceless %}
{{ include("dash/partials/editor.twig") }}
{% endapply %}
<div role="edit-post-wrapper">
<textarea id="edit" spellcheck="false" class="language-md">{{ content }}</textarea>
<pre id="highlight">
<code id="highlight-content" class="language-md"></code>
</pre>
</div>
</section>
@endsection

View file

@ -0,0 +1,187 @@
@extends('frame')
@section('title', 'The Dash | Edit Page')
@php
if($mode == 'edit')
{
$id = $page['id'];
$uuid = $page['uuid'];
$slug = $page['slug'];
$feature = $page['feature'];
$layout = $page['layout'];
$tags = $page['tags'];
$content = $page['content'];
$date = $page['created'];
$updated = $page['updated'];
$media = $page['media'];
$files = $page['docs'];
}else{
$id = "";
$uuid = "";
$slug = "";
$feature = "";
$layout = "";
$tags = "";
$content = "";
$date = "";
$updated = "";
$media = "";
$files = "";
}
@endphp
@section('main-content')
<section data-index="{{ $id }}" data-uuid="{{ $uuid }}" data-slug="{{ $slug }}" data-layout="{{ $layout }}" role="file-manager">
@if($page['feature'] == null)
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list"></div>
<label role="list-title">FILES</label>
<div role="page-files-list"></div>
@else
<div role="file-drop">
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
</div>
<label role="list-title">IMAGES AND VIDEO</label>
<div role="page-images-list">
@if(count($media)>1)
@foreach($media as $item)
@if($item['type'] == "mp4")
<div id="{{ $loop->index }}" class="video-item" data-source="{{ $item['file'] }}">
<video>
<source src="{{ $item['file'] }}"/>
</video>
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@else
<div id="{{ $loop->index }}" class="img-item" data-source="{{ $item['file'] }}" style="background: url({{ $item['file'] }}) no-repeat center center / cover">
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@endif
@endforeach
@else
@if(media[0] != '')
@if(media[0]['type'] == "mp4")
<div id="0" class="video-item" data-source="{{ media[0]['file'] }}">
<button id="{{ $loop->index }}" class="media-remove">X</button>
</div>
@else
<div id="0" class="img-item" data-source="{{ media[0]['file'] }}" style="background: url({{ media[0]['file'] }}) no-repeat center center / cover">
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@endif
@endif
@endif
</div>
<label role="list-title">FILES</label>
<div role="page-files-list">
@if(count($files) > 1)
@foreach($files as $item)
@php
$fileName = explode("/", $item['file']);
@endphp
@if($item['type'] == "mp3")
<div id="{{ $loop->index }}" class="audio-item" data-source="{{ $item['file'] }}">
<audio controls>
<source src="{{ $item['file'] }}"/>
</audio>
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@else
<div id="{{ $loop->index }}" class="file-item" data-source="{{ $item['file'] }}">
<a href="{{ $item['file'] }}" target="_blank">{{ $fileName[6] }}"</a>
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@endif
@endforeach
@else
@if($files[0] != '')
@php
$fileName = explode("/", $item['file']);
@endphp
@if($files[0]['type'] == "mp3")
<div id="0" class="audio-item" data-source="{{ $files[0]['file'] }}">
<audio controls>
<source src="{{ $files[0]['file'] }}"/>
</audio>
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@else
<div id="0" class="file-item" data-source="{{ $files[0]['file'] }}">
<a href="{{ $item['file'] }}" target="_blank">{{ $fileName[6] }}"</a>
<button id="{{ $loop->index }}" class="media-remove">
<i class="ti ti-x"></i>
</button>
</div>
@endif
@else
@endif
@endif
</div>
@endif
</section>
<section role="page-meta">
<div role="page-meta-wrapper">
<div role="page-title">
<strong>TITLE</strong>
<textarea id="post-title-text" type="text" name="post-title-text" class="post-edit" placeholder="TITLE">{{ $title }}</textarea>
</div>
<div role="page-tags">
<strong>TAGS</strong>
<textarea id="post-tags" type="text" name="post-tags" class="form-control" placeholder="tags [comma seperated]">{{ $tags }}</textarea>
</div>
<div role="page-layouts">
<strong>LAYOUTS</strong>
</div>
<div role="page-options">
<strong>OPTIONS</strong>
@spaceless
@include('includes.options')
@endspaceless
</div>
<div role="page-updated">
<strong>UPDATED</strong>
<span id="post-date" type="text">
{{ $updated }}
</span>
</div>
<div role="page-created">
<strong>CREATED</strong>
<span id="post-date" type="text">
{{ $date }}
</span>
<input id="page-files-upload" type="file" name="page-files-upload" multiple/>
<input id="post-image-upload" type="file" name="post-image-upload"/>
<input id="form_token" name="token" type="hidden" value="needtoaddtoken"></div>
</div>
</div>
</section>
<section role="text-editor">
@spaceless
@include('includes.editor')
@endspaceless
<div role="edit-post-wrapper">
<textarea id="edit" spellcheck="false" class="language-md">{{ $content }}</textarea>
<pre id="highlight"><code id="highlight-content" class="language-md"></code></pre>
</div>
</section>
@endsection

View file

@ -37,13 +37,15 @@
@endif
<main>
@spaceless
@section('main-content')
@show
@endspaceless
</main>
<footer>
</footer>
</body>
<script type="module" src="/assets/scripts/dash.js"></script>
</body>
</html>

View file

@ -0,0 +1,38 @@
<div role="text-editor-control">
<button id="edit-bold" class="content-editor-btn-text editor-button" title="bold">
<i id="edit-bold" class="ti ti-bold"></i>
</button>
<button id="edit-italic" class="content-editor-btn-text editor-button" title="italic">
<i id="edit-italic" class="ti ti-italic"></i>
</button>
<button id="edit-strikethrough" class="content-editor-btn-text editor-button" title="strikethrough">
<i id="edit-strikethrough" class="ti ti-strikethrough"></i>
</button>
<button id="edit-link" class="content-editor-btn-icon editor-button" title="insert link">
<i id="edit-link" class="ti ti-link"></i>
</button>
<button id="edit-header1" class="content-editor-btn-text editor-button" title="header 1">
<i id="edit-header1" class="ti ti-h-1"></i>
</button>
<button id="edit-header2" class="content-editor-btn-text editor-button" title="header 2">
<i id="edit-header2" class="ti ti-h-2"></i>
</button>
<button id="edit-header3" class="content-editor-btn-text editor-button" title="header 3">
<i id="edit-header3" class="ti ti-h-3"></i>
</button>
<button id="edit-image" class="content-editor-btn-icon editor-button" title="insert image">
<i id="edit-image" class="ti ti-photo"></i>
</button>
@if($mode == "edit")
<button id="edit-update" class="post-sumbit-btn submit-start editor-button" data-action='blog-update' data-id="{{ $page['uuid'] }} type='submit' title=" bold">
<i id="edit-update" class="ti ti-device-floppy"></i>
</button>
<button id="edit-delete" class="content-editor-btn-icon editor-button submit-delete" for="post-delete" title='delete post'>
<i id="edit-delete" class="ti ti-x"></i>
</button>
@else
<button id="edit-save" class="post-sumbit-btn submit-start editor-button" data-action='blog-add' type='submit'>
<i id="edit-save" class="ti ti-file-plus"></i>
</button>
@endif
</div>

View file

@ -0,0 +1,49 @@
@php
if($page['menu'])
{
$menu = 'true';
}else{
$menu = 'false';
}
if($page['featured'])
{
$featured = 'true';
}else{
$featured = 'false';
}
if($page['published'])
{
$published = 'true';
}else{
$published = 'false';
}
@endphp
<br>
<button id="option-menu-pin" class="option-inactive post-option-btn" data-active="{{ $menu }}" title='Pin to Menu'>
<svg id="option-page-icon" role="icon">
<use id="option-page-icon" xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
</svg>
</button>
<button id="option-feature" class="option-inactive post-option-btn" data-active="{{ $featured }}" title='Feature'>
<svg id="option-feature-icon" role="icon">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
</svg>
</button>
<button id="option-published" class="option-inactive post-option-btn" data-active="{{ $published }}" title='Published'>
<svg id="option-published-icon" role="icon">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
</svg>
</button>
<a href="/dashboard/page/preview/{{ $page['uuid'] }}" target="_blank">
<button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page'>
<svg id="option-preview-icon" role="icon">
<use id="option-preview-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye"/>
</svg>
</button>
</a>

View file

@ -28,6 +28,6 @@ Route::post("/login", [AuthController::class, 'enter']);
Route::group(['prefix' => 'dashboard'], function () {
Route::get("/", [DashController::class, 'start']);
Route::get("/pages/{pageFilter?}/{pageNum?}", [DashController::class, 'book']);
Route::get("/page/{uuid}", [DashController::class, 'page']);
Route::get("/page/{mode}/{uuid}", [DashController::class, 'page']);
Route::get("/logout", [AuthController::class, 'exit']);
});