Bugfixes and Bootstrap 5 finalized

This commit is contained in:
Joey Kimsey
2024-12-17 22:57:55 -05:00
parent 2220c6cda3
commit a859fb7ace
79 changed files with 2011 additions and 1597 deletions

View File

@ -39,7 +39,7 @@ class Admin extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
return Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
}
public function view( $id = null ) {

View File

@ -59,6 +59,6 @@ class Composer extends AdminController {
$out[] = (object) $versionsInstalled[ $name ];
}
Views::view( 'admin.modules.composer.dependencies', $out );
Views::view( 'admin.modules.dependencies', $out );
}
}

View File

@ -39,7 +39,7 @@ class Errors extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
return Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
}
public function view( $id = null ) {

View File

@ -15,8 +15,11 @@ use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Classes\AdminController;
use TheTempusProject\Models\User;
use TheTempusProject\Plugins\Comments;
use TheTempusProject\Plugins\Blog;
use TheTempusProject\Models\Comments;
use TheTempusProject\Models\Posts;
use TheTempusProject\Plugins\Comments as CommentPlugin;
use TheTempusProject\Plugins\Blog as BlogPlugin;
use TheTempusProject\Canary\Bin\Canary as Debug;
class Home extends AdminController {
public static $user;
@ -30,17 +33,29 @@ class Home extends AdminController {
public function index() {
if ( class_exists( 'TheTempusProject\Plugins\Comments' ) ) {
$comments = new Comments;
self::$comments = $comments->getModel();
$comments = Views::simpleView( 'comments.admin.dashboard', self::$comments->recent( 'all', 5 ) );
Components::set( 'commentDash', $comments );
$plugin = new CommentPlugin;
if ( ! $plugin->checkEnabled() ) {
Debug::info( 'Comments Plugin is disabled in the control panel.' );
Components::set( 'commentDash', '' );
} else {
$comments = new Comments;
$commentList = Views::simpleView( 'comments.admin.dashboard', $comments->recent( 'all', 5 ) );
Components::set( 'commentDash', $commentList );
}
}
if ( class_exists( 'TheTempusProject\Plugins\Blog' ) ) {
$blog = new Blog;
self::$posts = $blog->posts;
$posts = Views::simpleView( 'blog.admin.dashboard', self::$posts->recent( 5 ) );
Components::set( 'blogDash', $posts );
$plugin = new BlogPlugin;
if ( ! $plugin->checkEnabled() ) {
Debug::info( 'Blog Plugin is disabled in the control panel.' );
Components::set( 'blogDash', '' );
} else {
$posts = new Posts;
$postsList = Views::simpleView( 'blog.admin.dashboard', $posts->recent( 5 ) );
Components::set( 'blogDash', $postsList );
}
}
self::$user = new User;

View File

@ -39,7 +39,7 @@ class Logins extends AdminController {
}
public function index() {
return Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
return Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
}
public function view( $id = null ) {

View File

@ -26,8 +26,8 @@ class Logs extends AdminController {
}
public function index( $data = null ) {
Views::view( 'admin.logs.error_list', self::$log->listPaginated( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->listPaginated( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->listPaginated( 'login' ) );
Views::view( 'admin.logs.error_list', self::$log->list( 'error' ) );
Views::view( 'admin.logs.admin_list', self::$log->list( 'admin' ) );
Views::view( 'admin.logs.login_list', self::$log->list( 'login' ) );
}
}

View File

@ -39,7 +39,12 @@ class Plugins extends AdminController {
}
public function disable( $name = null ) {
if ( empty( $name ) ) {
Session::flash( 'error', 'Unknown Plugin.' );
Redirect::to( 'admin/plugins' );
}
Components::set( 'PLUGIN', $name );
self::$title = 'Admin - Disable ' . $name;
if ( !Input::exists( 'installHash' ) ) {
return Views::view( 'admin.modules.plugins.disable' );
}
@ -52,7 +57,12 @@ class Plugins extends AdminController {
}
public function enable( $name = null ) {
if ( empty( $name ) ) {
Session::flash( 'error', 'Unknown Plugin.' );
Redirect::to( 'admin/plugins' );
}
Components::set( 'PLUGIN', $name );
self::$title = 'Admin - Enable ' . $name;
if ( !Input::exists( 'installHash' ) ) {
return Views::view( 'admin.modules.plugins.enable' );
}
@ -71,6 +81,7 @@ class Plugins extends AdminController {
}
$name = strtolower( $name );
Components::set( 'PLUGIN', $name );
self::$title = 'Admin - Install ' . $name;
if ( ! Input::exists( 'installHash' ) ) {
return Views::view( 'admin.modules.plugins.install' );
}
@ -95,6 +106,7 @@ class Plugins extends AdminController {
}
$name = strtolower($name);
Components::set( 'PLUGIN', $name );
self::$title = 'Admin - Uninstall ' . $name;
if ( !Input::exists( 'uninstallHash' ) ) {
return Views::view( 'admin.modules.plugins.uninstall' );

View File

@ -26,6 +26,7 @@ use TheTempusProject\Classes\AdminController;
use TheTempusProject\Models\User;
use TheTempusProject\Models\Group;
use TheTempusProject\TheTempusProject as App;
use TheTempusProject\Houdini\Classes\Template;
class Users extends AdminController {
public static $user;
@ -63,8 +64,11 @@ class Users extends AdminController {
}
}
}
$select = Forms::getFormFieldHtml( 'groupSelect', 'User Group', 'select', Config::getValue( 'group/defaultGroup' ), self::$group->listGroupsSimple() );
$select = Forms::getSelectHtml(
'groupSelect',
self::$group->listGroupsSimple(),
Config::getValue( 'group/defaultGroup' ),
);
Components::set( 'groupSelect', $select );
Views::view( 'admin.users.create' );
}
@ -132,9 +136,15 @@ class Users extends AdminController {
$userGroup = $userData->userGroup;
}
Forms::selectRadio( 'confirmed', $userData->confirmed );
$avatar = Forms::getFormFieldHtml( 'avatar', 'User Avatar', 'file', $avatarLocation );
$select = Forms::getFormFieldHtml( 'groupSelect', 'User Group', 'select', $userGroup, self::$group->listGroupsSimple() );
$avatar = $this->getAvatar( 'avatar', $avatarLocation );
Components::set( 'AvatarSettings', $avatar );
$select = Forms::getSelectHtml(
'groupSelect',
self::$group->listGroupsSimple(),
$userGroup,
);
Components::set( 'groupSelect', $select );
Views::view( 'admin.users.edit', $userData );
}
@ -153,4 +163,28 @@ class Users extends AdminController {
}
$this->index();
}
private function getAvatar( $name, $value ) {
$fieldname = str_ireplace( '/', '-', $name );
$html = '';
$fieldHtml = '';
$fieldHtml = Forms::getFileHtml( $fieldname );
$html .= '<div class="mb-3 row">';
$html .= ' <label for="' . $fieldname . '" class="col-lg-6 col-form-label text-end">' . ucfirst( $fieldname ) . '</label>';
$html .= ' <div class="col-lg-2">';
$html .= ' ' . $fieldHtml;
$html .= ' </div>';
$html .= '</div>';
$html .= '<div class="mb-3 row">';
$html .= ' <h4 class="col-lg-6 col-form-label text-end">Current Image</h4>';
$html .= ' <div class="col-lg-2">';
$html .= ' <img alt="User Avatar" src="{ROOT_URL}' . $value . '" class="img-circle img-fluid p-2 avatar-125">';
$html .= ' </div>';
$html .= '</div>';
return Template::parse( $html );
}
}