Replaced Moment with Carbon #84

Merged
Ghost merged 148 commits from develop into beta 2022-09-22 05:53:36 +02:00
8 changed files with 28 additions and 14 deletions
Showing only changes of commit c85e145774 - Show all commits

View file

@ -88,7 +88,7 @@ class DashController extends Controller
$title;
$page = [];
$views = [];
$mode == 'edit' ? $page = $this->pages->getById($uuid) : $page = [];
$mode == 'edit' ? $page = $this->pages->getByUuid($uuid) : $page = [];
$mode == 'edit' ? $title = $page['title'] : $title = 'Add New';
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';

View file

@ -56,14 +56,14 @@ class ThemeController extends Controller
$page;
if ($view == 'index') {
$template = $currentTheme . '.index';
$page = $this->pages->getBySlug('first');
$page = $this->pages->getById(0);
} else {
$template = $currentTheme . '.page';
//if coming from theme page, grabs id of latest page
if ($id == null) {
$id = $this->getPageID();
$uuid = $this->getPageUUID();
}
$page = $this->pages->getById($id);
$page = $this->pages->getByUuid($uuid);
}
$pageData = $this->sort->page($page);
break;
@ -88,7 +88,7 @@ class ThemeController extends Controller
}
}
private function getPageID()
private function getPageUUID()
{
$book = $this->pages->getAll();
$page = $book->where('layout', 'page')->first();

View file

@ -6,7 +6,9 @@ interface PageRepositoryInterface
{
public function getAll();
public function getByID($uuid);
public function getById($id);
public function getByUuid($uuid);
public function getBySlug($slug);

View file

@ -45,7 +45,15 @@ class PageRepository implements PageRepositoryInterface
return $this->pages;
}
public function getById($uuid)
public function getById($id)
{
$page = $this->pages->where('id', $id)->first();
//quick check to see if layout is set
$page['layout'] == '' ? $page['layout'] = 'page' : $page['layout'] = $page['layout'];
return $page;
}
public function getByUuid($uuid)
{
$page = $this->pages->where('uuid', $uuid)->first();
//quick check to see if layout is set
@ -121,6 +129,7 @@ class PageRepository implements PageRepositoryInterface
$id = $task != 'create' ? $body->id : $this->settings->getSettings()['library_stats']['current_index'];
$uuid = $task != 'create' ? $body->uuid : createUUID();
//set variables post body for saving
$body->title = urlencode($body->title);
$body->id = $id;
$body->uuid = $uuid;
$body->path = $path;

View file

@ -216,7 +216,7 @@ class SortingService
array_push($recent, [
'path' => $item['path'],
'slug' => $item['slug'],
'title' => $item['title'],
'title' => urldecode($item['title']),
'feature' => $item['feature'],
]);
}
@ -226,7 +226,7 @@ class SortingService
array_push($featured, [
'path' => $item['path'],
'slug' => $item['slug'],
'title' => $item['title'],
'title' => urldecode($item['title']),
'feature' => $item['feature'],
]);
}
@ -237,7 +237,7 @@ class SortingService
"debug" => $debug,
"theme" => $this->info['theme'],
"status" => session('member') != null ? true : false,
"title" => $page['title'],
"title" => urldecode($page['title']),
"meta" => $meta,
"menu" => $this->settings->getMenu(),
"info" => $this->info,

View file

@ -88,7 +88,7 @@ class InitService
//create index file
//TODO: upate path attribute to use env variable
$index = [
'id' => 1,
'id' => 0,
'uuid' => createUUID(),
'title' => 'FIRST!',
'imageList' => '/assets/images/global/default-bg.jpg',

View file

@ -1,8 +1,7 @@
@extends('frame')
@section('title', 'The Dash | Editing '. $title)
@php
$title = urldecode($title);
if($mode == 'edit')
{
$id = $page['id'];
@ -30,6 +29,7 @@
$files = "";
}
@endphp
@section('title', 'The Dash | Editing '. $title)
@section('main-content')
<section data-index="{{ $id }}" data-uuid="{{ $uuid }}" data-slug="{{ $slug }}" data-layout="{{ $layout }}" class="file-manager">

View file

@ -29,7 +29,10 @@ if($page['featured'] == 'true')
</strong>
<hr/>
<strong>
{{ $page['title'] }}
@php
$title = urldecode($page['title']);
@endphp
{{ $title }}
</strong>
<hr/>
<button data-active="{{ $menu }}">