Compare commits
No commits in common. "c0c5deeddacdbc77f99d1166447eb8ca50ea8f88" and "7b635a4f0054359bec4eb371c68edd472d7e3f2c" have entirely different histories.
c0c5deedda
...
7b635a4f00
4 changed files with 38 additions and 71 deletions
|
@ -1,10 +0,0 @@
|
|||
{extends file='TplCore:empty.tpl'}
|
||||
{block name="navbar-extra-content"}
|
||||
<form class="d-flex" role="search" action='item'>
|
||||
<div class="input-group input-group-sm me-2">
|
||||
<input class="form-control" type="search" name="pattern"
|
||||
placeholder="{t}Search{/t}" aria-label="{t}Search{/t}">
|
||||
<span class="input-group-text"><i class="fa fa-search" aria-hidden="true"></i></span>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
16
src/Tpl.php
16
src/Tpl.php
|
@ -160,7 +160,6 @@ class Tpl {
|
|||
self :: $smarty->setTemplateDir(self :: $core_templates_directory);
|
||||
self :: $smarty->setCompileDir($templates_c_dir);
|
||||
self :: $smarty->registerResource('Tpl', new TplSmartyResource());
|
||||
self :: $smarty->registerResource('TplCore', new TplSmartyResource(true));
|
||||
$debug_ajax = App::get('templates.debug_ajax', null, 'bool');
|
||||
self :: $_debug_ajax = boolval($debug_ajax);
|
||||
Log :: register_fatal_error_handler(array('\\EesyPHP\\Tpl', 'fatal_error'));
|
||||
|
@ -618,13 +617,10 @@ class Tpl {
|
|||
/**
|
||||
* Resolve templates path against registered templates directories
|
||||
* @param string $path
|
||||
* @param bool $core_only Core only mode (optional, default: false)
|
||||
* @return string|false
|
||||
*/
|
||||
public static function resolve_templates_path($path, $core_only=false) {
|
||||
public static function resolve_templates_path($path) {
|
||||
foreach(array_keys(self :: $templates_directories) as $dir) {
|
||||
if ($core_only && $dir != self :: $core_templates_directory)
|
||||
continue;
|
||||
$fullpath = "$dir/$path";
|
||||
if (file_exists($fullpath)) {
|
||||
Log::trace('Templates file "%s" resolved as "%s"', $path, $fullpath);
|
||||
|
@ -639,12 +635,11 @@ class Tpl {
|
|||
* Return the content of a Smarty template file.
|
||||
*
|
||||
* @param string $template The template name (eg: base.tpl)
|
||||
* @param bool $core_only Core only mode (optional, default: false)
|
||||
*
|
||||
* @return string The content of the Smarty template file
|
||||
**/
|
||||
public static function get_template_source($template, $core_only=false) {
|
||||
$path = self :: resolve_templates_path($template, $core_only);
|
||||
public static function get_template_source($template) {
|
||||
$path = self :: resolve_templates_path($template);
|
||||
if (!is_readable($path)) {
|
||||
// No error return with Smarty3 and highter because it's call
|
||||
// template name in lower first systematically
|
||||
|
@ -658,12 +653,11 @@ class Tpl {
|
|||
* template file.
|
||||
*
|
||||
* @param string $template The template name (eg: empty.tpl)
|
||||
* @param bool $core_only Core only mode (optional, default: false)
|
||||
*
|
||||
* @return int|null The timestamp of the last change of the Smarty template file
|
||||
**/
|
||||
public static function get_template_timestamp($template, $core_only=false) {
|
||||
$path = self :: resolve_templates_path($template, $core_only);
|
||||
public static function get_template_timestamp($template) {
|
||||
$path = self :: resolve_templates_path($template);
|
||||
if (is_file($path)) {
|
||||
$time = filemtime($path);
|
||||
if ($time)
|
||||
|
|
|
@ -11,17 +11,10 @@ use Smarty_Resource_Custom;
|
|||
*/
|
||||
class TplSmartyResource extends Smarty_Resource_Custom {
|
||||
|
||||
// Core only templates
|
||||
protected $core_only;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param bool $core_only Core only mode (optional, default: false)
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($core_only=false) {
|
||||
$this -> core_only = $core_only;
|
||||
}
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
// prepared fetchTimestamp() statement
|
||||
protected $mtime;
|
||||
|
||||
/**
|
||||
* Fetch a template and its modification time
|
||||
|
@ -32,8 +25,8 @@ class TplSmartyResource extends Smarty_Resource_Custom {
|
|||
* @return void
|
||||
*/
|
||||
protected function fetch($name, &$source, &$mtime) {
|
||||
$source = Tpl :: get_template_source($name, $this -> core_only);
|
||||
$mtime = Tpl :: get_template_timestamp($name, $this -> core_only);
|
||||
$source = Tpl :: get_template_source($name);
|
||||
$mtime = Tpl :: get_template_timestamp($name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,6 +39,6 @@ class TplSmartyResource extends Smarty_Resource_Custom {
|
|||
* @return integer timestamp (epoch) the template was modified
|
||||
*/
|
||||
protected function fetchTimestamp($name) {
|
||||
return Tpl :: get_template_timestamp($name, $this -> core_only);
|
||||
return Tpl :: get_template_timestamp($name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,23 +31,16 @@
|
|||
{block name="body"}
|
||||
|
||||
{block name="navbar"}
|
||||
<header>
|
||||
<nav class="{block name="navbar-class"}navbar navbar-expand-lg{/block}" {block name="navbar-extra-args"}{/block}>
|
||||
<div class="{block name="navbar-container-class"}container{/block}">
|
||||
<header class="p-3 mb-3 border-bottom">
|
||||
<div class="container">
|
||||
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
|
||||
{block name="navbar-brand"}
|
||||
<a class="navbar-brand me-3" href="#">
|
||||
<a href="/" class="d-flex align-items-center mb-2 mb-lg-0 text-dark text-decoration-none">
|
||||
<img id="logo" src="{static_url path="images/logo.svg"}" alt="Logo" title="Logo"/>
|
||||
</a>
|
||||
{/block}
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbar-menu" aria-controls="navbar-menu" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbar-menu">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<ul class="pr-2 nav col-12 col-lg-auto me-lg-auto mb-2 justify-content-center mb-md-0">
|
||||
{block name="navbar-menu"}
|
||||
{/block}
|
||||
</ul>
|
||||
|
@ -56,10 +49,9 @@
|
|||
|
||||
{block name="navbar-user"}
|
||||
{if isset($auth_user) && $auth_user}
|
||||
<ul class="navbar-nav text-end">
|
||||
<li class="nav-item dropdown">
|
||||
<div class="dropdown text-end">
|
||||
{block name="navbar-user-name"}
|
||||
<a class="nav-link active dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<a href="#" class="d-block link-dark text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-user-circle" aria-hidden="true"></i>
|
||||
{$auth_user->name|escape:"htmlall"}
|
||||
</a>
|
||||
|
@ -69,18 +61,16 @@
|
|||
{block name="navbar-user-menu-content"}{/block}
|
||||
<li>
|
||||
<a class="dropdown-item" href="logout">
|
||||
<i class="fa fa-sign-out"></i> {t domain=$CORE_TEXT_DOMAIN}Sign out{/t}
|
||||
<i class="fas fa-sign-out-alt"></i> {t domain=$CORE_TEXT_DOMAIN}Sign out{/t}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{/block}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{/block}
|
||||
|
||||
|
|
Loading…
Reference in a new issue