Changing template engine to Mustache. Updating Bootstrap. Creating mustache helpers. Changing plugins on the base template
This commit is contained in:
Executable → Regular
+33
-20
@@ -6,10 +6,10 @@ class Dashboard extends RenderableTemplate {
|
||||
|
||||
public $content;
|
||||
|
||||
public function render() {
|
||||
public function render($content = '') {
|
||||
global $DROPDOWN, $SIDEBAR;
|
||||
|
||||
if (is_ajax_request()) {
|
||||
/*if (is_ajax_request()) {
|
||||
if(is_file($this->getView()['location'])){
|
||||
$this->content = file_get_contents($this->getView()['location']);
|
||||
$this->implate();
|
||||
@@ -18,36 +18,54 @@ class Dashboard extends RenderableTemplate {
|
||||
$this->implate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
//global $DROPDOWN, $SIDEBAR;
|
||||
|
||||
$head = '';
|
||||
|
||||
$head .= '<script src="/plugins/jquery/jquery.min.js"></script>';
|
||||
$head .= '<script src="/plugins/jquery/dist/jquery.min.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/mousetrap/mousetrap.min.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/jquery-mask-plugin/jquery.mask.min.js"></script>';
|
||||
$head .= '<script src="/plugins/jquery-mask-plugin/dist/jquery.mask.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/bootstrap/bootstrap.min.css" rel="stylesheet" />';
|
||||
$head .= '<script src="/plugins/bootstrap/bootstrap.bundle.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />';
|
||||
$head .= '<script src="/plugins/remoteFill/remoteFill.js"></script>';
|
||||
|
||||
// Trumbowyg WYSIWYG
|
||||
$head .= '<link href="/plugins/trumbowyg/ui/trumbowyg.min.css" rel="stylesheet" />';
|
||||
$head .= '<script src="/plugins/trumbowyg/trumbowyg.min.js"></script>';
|
||||
|
||||
$head .= '<link href="/plugins/fontawesome/css/font-awesome.min.css" rel="stylesheet" />';
|
||||
|
||||
$head .= '<link href="/plugins/normalize-css/normalize.css" rel="stylesheet">';
|
||||
$head .= '<link href="/dist/style.css" rel="stylesheet">';
|
||||
|
||||
$head .= '<link href="/dist/themes/black_and_white.css" rel="stylesheet">';
|
||||
|
||||
$head .= '<link href="/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">';
|
||||
$head .= '<script src="/plugins/metisMenu/metisMenu.min.js"></script>';
|
||||
$head .= '<link href="/plugins/metismenu/dist/metisMenu.min.css" rel="stylesheet">';
|
||||
$head .= '<script src="/plugins/metismenu/dist/metisMenu.min.js"></script>';
|
||||
|
||||
$head .= '<link rel="stylesheet" href="/plugins/datatables/dataTables.css">';
|
||||
$head .= '<script src="/plugins/datatables/dataTables.js"></script>';
|
||||
$head .= '<link href="https://unpkg.com/dropzone@5/dist/min/dropzone.min.css" rel="stylesheet">';
|
||||
$head .= '<script src="https://unpkg.com/dropzone@5/dist/min/dropzone.min.js"></script>';
|
||||
|
||||
$head .= '<link rel="stylesheet" href="/plugins/datatables.net-dt/css/jquery.dataTables.min.css">';
|
||||
$head .= '<script src="/plugins/datatables.net/js/jquery.dataTables.min.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/bootstrapToastWrapper/dist/bootstrapToastWrapper.js"></script>';
|
||||
|
||||
$head .= '<script src="/plugins/html5-qrcode/html5-qrcode.min.js"></script>';
|
||||
|
||||
$head .= '<script src="https://cdn.datatables.net/1.11.4/js/dataTables.bootstrap5.min.js"></script>';
|
||||
$head .= '<link rel="stylesheet" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap5.min.css">';
|
||||
|
||||
$head .= '<script src="/dist/libs.js" defer="true"></script>';
|
||||
$head .= '<script src="/dist/validation.js" defer="true"></script>';
|
||||
|
||||
$foot = '';
|
||||
$foot .= '<script src="/dist/script.js"></script>';
|
||||
$foot .= '<script src="/dist/script.js" defer="true"></script>';
|
||||
|
||||
$this->content = file_get_contents(__DIR__ . '/template.html');
|
||||
|
||||
@@ -60,19 +78,14 @@ class Dashboard extends RenderableTemplate {
|
||||
foreach ($DROPDOWN as $item){
|
||||
$header .= "<a class='dropdown-item' href='".$item['route']."'>".$item['name']."</a>";
|
||||
}
|
||||
|
||||
$this->content = str_replace("{{dropdown}}", $header, $this->content);
|
||||
|
||||
$this->content = str_replace("{{head}}", $head, $this->content);
|
||||
|
||||
if(isset($this->getView()['location']) && is_file($this->getView()['location'])){
|
||||
$this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
|
||||
}else{
|
||||
$this->content = str_replace('{{>content}}', '', $this->content);
|
||||
}
|
||||
|
||||
$this->content = str_replace("{{footer}}", $foot, $this->content);
|
||||
$this->content = str_replace('{{content}}', $content, $this->content);
|
||||
|
||||
$this->implate();
|
||||
return $this->content;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
+79
-60
@@ -1,78 +1,97 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
{{head}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<!-- Sidebar -->
|
||||
<nav id="sidebar-wrapper">
|
||||
<button class="form-control btn-danger menu-toggle menu-small">Fechar</button>
|
||||
<div class="logo" style="">
|
||||
<img src='/media/logo_white.png' alt="logo" />
|
||||
</div>
|
||||
|
||||
<div class="search-nav" style="">
|
||||
<input class="form-control" type="text" placeholder="Busca"/>
|
||||
</div>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
{{head}}
|
||||
</head>
|
||||
|
||||
{{elements}}
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<!-- Sidebar -->
|
||||
<nav id="sidebar-wrapper">
|
||||
<button class="form-control btn-danger menu-toggle menu-small">Fechar</button>
|
||||
<div class="logo">
|
||||
<img src='/media/logo_white.png' alt="logo" />
|
||||
</div>
|
||||
|
||||
<ul id="side-second-menu" class="hidden nav"></ul>
|
||||
</nav>
|
||||
<!-- /#sidebar-wrapper -->
|
||||
<!-- /#sidebar-wrapper -->
|
||||
<div class="search-nav">
|
||||
<input class="form-control" type="text" placeholder="Busca" />
|
||||
</div>
|
||||
|
||||
<!-- Page Content -->
|
||||
<div id="main-page-wrapper">
|
||||
{{elements}}
|
||||
|
||||
<header class='navbar navbar-default navbar-fixed-top' style='min-height: 50px; background-color: #000;'>
|
||||
<ul id="side-second-menu" class="hidden nav"></ul>
|
||||
</nav>
|
||||
<!-- /#sidebar-wrapper -->
|
||||
<!-- /#sidebar-wrapper -->
|
||||
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li class="tooltip-sidebar-toggle">
|
||||
<a href="" class="menu-toggle">
|
||||
<i class="fa fa-th-list" aria-hidden="true"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Page Content -->
|
||||
<div id="main-page-wrapper">
|
||||
|
||||
<ul class="nav navbar-top-links navbar-right">
|
||||
<li class="nav-item dropdown no-arrow">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-cog fa-fw"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" >
|
||||
{{dropdown}}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<header class='navbar navbar-default navbar-fixed-top' style='min-height: 50px; background-color: #000;'>
|
||||
|
||||
</header>
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li class="tooltip-sidebar-toggle">
|
||||
<a href="" class="menu-toggle">
|
||||
{{#icons}} th-list {{/icons}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="progress" class="progress hidden" >
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated active" style="width: 100%;"></div>
|
||||
</div>
|
||||
<ul class="nav navbar-top-links navbar-right">
|
||||
<li class="nav-item dropdown no-arrow">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
||||
aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-cog fa-fw"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
{{dropdown}}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- BreadCrumbs -->
|
||||
<div class='breadcrumb'>{{breadcrumb}}</div>
|
||||
<!-- /BreadCrumbs -->
|
||||
</header>
|
||||
|
||||
<div id="page-content-wrapper">
|
||||
<div class="container-fluid" style="height: 1024px;">
|
||||
<div id="progress" class="progress hidden">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated active" style="width: 100%;"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div id="content" class="col-lg-12">
|
||||
{{>content}}
|
||||
</div>
|
||||
<!-- BreadCrumbs -->
|
||||
<div class='breadcrumb'>{{> /core/breadcrumb/view/breadcrumb}}</div>
|
||||
<!-- /BreadCrumbs -->
|
||||
|
||||
<div id="page-content-wrapper" style="margin-bottom: 60px;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div id="content" class="col-lg-12">
|
||||
{{content}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /#page-content-wrapper -->
|
||||
|
||||
</div>
|
||||
<div id="modal" class="modal fade" role="dialog"> </div>
|
||||
{{footer}}
|
||||
</body>
|
||||
</html>
|
||||
</div>
|
||||
|
||||
<div id="toast-container" class="toast-container p-3 error" style="position: fixed; right: 0px; bottom: 0px;">
|
||||
</div>
|
||||
|
||||
<div id="modal" class="modal fade">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{footer}}
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
+6
-5
@@ -8,12 +8,13 @@ class NullTemplate extends RenderableTemplate {
|
||||
|
||||
}
|
||||
|
||||
public function render() {
|
||||
public function render($content = "") {
|
||||
|
||||
if (is_file($this->getView()['location'])) {
|
||||
$this->content = file_get_contents($this->getView()['location']);
|
||||
$this->implate();
|
||||
}
|
||||
$this->content = file_get_contents(__DIR__ . '/template.html');
|
||||
|
||||
$this->content = str_replace('{{content}}', $content, $this->content);
|
||||
|
||||
return $this->content;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
{{head}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{content}}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user