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 119 additions and 48 deletions
Showing only changes of commit eda377aba3 - Show all commits

View file

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\SettingsService;
use App\Services\RenderService;
class SettingsAPIController extends Controller
{
protected $settings;
protected $render;
public function __construct(SettingsService $settingsService, RenderService $renderService)
{
$this->settings = $settingsService;
$this->render = $renderService;
}
public function publish(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->render->publishAll();
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -25,6 +25,35 @@ class RenderService
$this->theme = $this->settings->getGlobal()['theme'];
}
public function publishAll()
{
$message = [];
$dynamicRender = $this->settings->getGlobal()['dynamicRender'];
if (isset($dynamicRender) && $dynamicRender === 'true') {
$message = [
'message' => 'Auto Rendering is already enabled!',
'type' => 'RENDER_SUCCESS',
];
} else {
try {
$this->archive();
$this->tags();
$this->pages();
$message = [
'message' => 'Site Rendered. GOOD EFFORT',
'type' => 'RENDER_SUCCESS',
];
} catch (Error $error) {
$message = [
'message' => 'Issue With Rendering. DONT PANIC',
'type' => 'RENDER_ERROR',
];
}
}
return $message;
}
public function archive()
{
$template = $this->theme . '.archive';

View file

@ -0,0 +1,9 @@
import Settings from './controllers/SettingsIndex.js';
document.addEventListener(
'DOMContentLoaded',
function () {
new Settings();
},
false
);

View file

@ -1,44 +1,44 @@
import FipamoAdminAPI from "../../libraries/FipamoAdminAPI";
import Notficaton from "../ui/Notifications";
import FipamoAdminAPI from '../../libraries/FipamoAdminAPI.js';
import Notficaton from '../ui/Notifications.js';
const notify = new Notficaton();
export default class Mailer {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
sendMail() {
let mailData = {
content: "This is a test email"
};
let admin = new FipamoAdminAPI();
admin
.sendMail(mailData)
.then((result) => {
notify.alert(result.message, true);
})
.catch((err) => {
notify.alert(err.message, false);
});
}
testMail() {
let mailData = {
content: "This is a test email",
mail_task: "TESTING"
};
let admin = new FipamoAdminAPI();
admin
.sendMail(mailData)
.then((result) => {
notify.alert(result.message, true);
})
.catch((err) => {
notify.alert(err.message, false);
});
}
//--------------------------
// event handlers
//--------------------------
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
sendMail() {
let mailData = {
content: 'This is a test email'
};
let admin = new FipamoAdminAPI();
admin
.sendMail(mailData)
.then(result => {
notify.alert(result.message, true);
})
.catch(err => {
notify.alert(err.message, false);
});
}
testMail() {
let mailData = {
content: 'This is a test email',
mail_task: 'TESTING'
};
let admin = new FipamoAdminAPI();
admin
.sendMail(mailData)
.then(result => {
notify.alert(result.message, true);
})
.catch(err => {
notify.alert(err.message, false);
});
}
//--------------------------
// event handlers
//--------------------------
}

View file

@ -1,9 +1,9 @@
import SettingsActions from '../actions/SettingsActions';
import Maintenance from './MaintenanceManager';
import FipamoAdminAPI, { TASK_SYNC_SETTNIGS } from '../../libraries/FipamoAdminAPI';
import * as DataEvent from '../../../src/com/events/DataEvent';
import Mailer from '../actions/Mailer';
import Notifications from '../ui/Notifications';
import SettingsActions from '../actions/SettingsActions.js';
import Maintenance from './MaintenanceManager.js';
import FipamoAdminAPI, { TASK_SYNC_SETTNIGS } from '../../libraries/FipamoAdminAPI.js';
import * as DataEvent from '../../../dash/app/events/DataEvent.js';
import Mailer from '../actions/Mailer.js';
import Notifications from '../ui/Notifications.js';
const notify = new Notifications();
export default class SettingsIndex {
//--------------------------

View file

@ -189,7 +189,7 @@ class FipamoAdminAPI {
//API_PUBLISH_PAGES,
this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES,
TASK_PUBLISH_SITE,
REQUEST_TYPE_POST,
REQUEST_TYPE_PUT,
CONTENT_TYPE_JSON,
data
)

View file

@ -110,3 +110,6 @@
</section>
</article>
@endsection
@section('scripting')
<script type="module" src="/assets/scripts/dash/app/EditSettings.js"></script>
@endsection

View file

@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Route;
use App\Http\Controllers\API\AuthAPIController;
use App\Http\Controllers\API\PageAPIController;
use App\Http\Controllers\API\FileUploadAPIController;
use App\Http\Controllers\API\SettingsAPIController;
/*
|--------------------------------------------------------------------------
@ -23,3 +24,5 @@ Route::put("/v1/page/write", [PageAPIController::class, 'write']);
Route::post("/v1/page/create", [PageAPIController::class, 'create']);
//handle file uploads
Route::post("/v1/files", [FileUploadAPIController::class, 'upload']);
//settings
Route::put("/v1/settings/publish", [SettingsAPIController::class, 'publish']);