template caching disabled in debug mode, cleanup projects page
This commit is contained in:
@@ -502,19 +502,6 @@ dl.horizontal {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: (@base-font-size + .5pt);
|
font-size: (@base-font-size + .5pt);
|
||||||
}
|
}
|
||||||
dl.horizontal {
|
|
||||||
display: none;
|
|
||||||
dt {
|
|
||||||
text-align: left;
|
|
||||||
width: 1cm;
|
|
||||||
}
|
|
||||||
dd {
|
|
||||||
padding-right: 1cm;
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p, li {
|
p, li {
|
||||||
line-height: @intro-paragraph-line-height;
|
line-height: @intro-paragraph-line-height;
|
||||||
font-size: @intro-paragraph-size;
|
font-size: @intro-paragraph-size;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
{% import "macros.html.twig" as macros %}
|
||||||
|
|
||||||
{% if projects|length > 0 %}
|
{% if projects|length > 0 %}
|
||||||
<section class="projects">
|
<section class="projects">
|
||||||
<h2>{{ 'projects.header'|trans }}</h2>
|
<h2>{{ 'projects.header'|trans }}</h2>
|
||||||
@@ -6,21 +8,13 @@
|
|||||||
{% for project in projects %}
|
{% for project in projects %}
|
||||||
<article class="project">
|
<article class="project">
|
||||||
<h3>{{ project.name }} {% if project.stack %}<small>({{ project.stack }})</small>{% endif %}</h3>
|
<h3>{{ project.name }} {% if project.stack %}<small>({{ project.stack }})</small>{% endif %}</h3>
|
||||||
<dl class="horizontal">
|
|
||||||
<dt>{{ 'projects.fields.status'|trans }}</dt>
|
|
||||||
<dd>
|
|
||||||
<p class="badge badge-{{ project.status }}">{{ ('projects.status.' ~ project.status)|trans }}</p>
|
|
||||||
</dd>
|
|
||||||
{% if project.role %}
|
|
||||||
<dt>{{ 'projects.fields.role'|trans }}</dt>
|
|
||||||
<dd>{{ project.role }}</dd>
|
|
||||||
{% endif %}
|
|
||||||
</dl>
|
|
||||||
<p class="short-description">{{ project.shortDescription }}</p>
|
<p class="short-description">{{ project.shortDescription }}</p>
|
||||||
{% if project.repository %}
|
|
||||||
<p><a href="{{ project.repository }}" target="_blank">{{ project.repository }}</a></p>
|
|
||||||
{% endif %}
|
|
||||||
{{ project.content|raw }}
|
{{ project.content|raw }}
|
||||||
|
{% if project.hasUrls() %}
|
||||||
|
<ul>
|
||||||
|
{{ macros.list_link_array(project.urls) }}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</article>
|
</article>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -69,16 +69,6 @@ class Intro extends BaseModel implements PhotoInterface, AnalyzableInterface
|
|||||||
protected $showQuotes = self::SHOW_TOP;
|
protected $showQuotes = self::SHOW_TOP;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the headline
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getHeadline(): string
|
|
||||||
{
|
|
||||||
return $this->headline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +83,17 @@ class Intro extends BaseModel implements PhotoInterface, AnalyzableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the headline
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHeadline(): string
|
||||||
|
{
|
||||||
|
return $this->headline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the quotes
|
* Get the quotes
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,26 +30,40 @@
|
|||||||
|
|
||||||
namespace Magdev\Dossier\Model;
|
namespace Magdev\Dossier\Model;
|
||||||
|
|
||||||
|
|
||||||
use Magdev\Dossier\Model\Base\BaseModel;
|
use Magdev\Dossier\Model\Base\BaseModel;
|
||||||
|
use Mni\FrontYAML\Document;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model for projects page
|
||||||
|
*
|
||||||
|
* @author magdev
|
||||||
|
*/
|
||||||
class Project extends BaseModel
|
class Project extends BaseModel
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Project name
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $name = '';
|
protected $name = '';
|
||||||
protected $status = '';
|
|
||||||
protected $url = '';
|
/**
|
||||||
|
* Public URLs
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $urls = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Short Description
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $shortDescription = '';
|
protected $shortDescription = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Project stack
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $stack = '';
|
protected $stack = '';
|
||||||
protected $role = '';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getRole(): string
|
|
||||||
{
|
|
||||||
return $this->role;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getStack(): string
|
public function getStack(): string
|
||||||
{
|
{
|
||||||
@@ -57,35 +71,26 @@ class Project extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function hasUrls(): bool
|
||||||
public function getStatus(): string
|
|
||||||
{
|
{
|
||||||
return $this->status;
|
return sizeof($this->urls) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getUrls(): array
|
||||||
public function getUrl(): string
|
|
||||||
{
|
{
|
||||||
return $this->url;
|
return $this->urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getShortDescription(): string
|
public function getShortDescription(): string
|
||||||
{
|
{
|
||||||
return $this->shortDescription;
|
return $this->shortDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,13 +120,15 @@ class TemplateService
|
|||||||
{
|
{
|
||||||
$theme = !$theme ? $this->theme : $theme;
|
$theme = !$theme ? $this->theme : $theme;
|
||||||
|
|
||||||
if (getenv('DOSSIER_THEME_DIR')) {
|
if (getenv('APP_ENV') == 'prod') {
|
||||||
if (is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme) && file_exists(getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file)) {
|
if (getenv('DOSSIER_THEME_DIR')) {
|
||||||
return getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file;
|
if (is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme) && file_exists(getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file)) {
|
||||||
|
return getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme) && file_exists(getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file)) {
|
||||||
|
return getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme) && file_exists(getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file)) {
|
|
||||||
return getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file;
|
|
||||||
}
|
}
|
||||||
return DOSSIER_ROOT.'/app/tpl/'.$theme.'/'.$file;
|
return DOSSIER_ROOT.'/app/tpl/'.$theme.'/'.$file;
|
||||||
}
|
}
|
||||||
@@ -143,16 +145,23 @@ class TemplateService
|
|||||||
$this->theme = $theme;
|
$this->theme = $theme;
|
||||||
|
|
||||||
$loaders = array();
|
$loaders = array();
|
||||||
if (getenv('DOSSIER_THEME_DIR') && is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme)) {
|
if (getenv('APP_ENV') == 'prod') {
|
||||||
$loaders[] = new \Twig_Loader_Filesystem(getenv('DOSSIER_THEME_DIR').'/'.$theme);
|
if (getenv('DOSSIER_THEME_DIR') && is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme)) {
|
||||||
}
|
$loaders[] = new \Twig_Loader_Filesystem(getenv('DOSSIER_THEME_DIR').'/'.$theme);
|
||||||
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme)) {
|
}
|
||||||
$loaders[] = new \Twig_Loader_Filesystem(getenv('HOME').'/.dossier/tpl/'.$theme);
|
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme)) {
|
||||||
|
$loaders[] = new \Twig_Loader_Filesystem(getenv('HOME').'/.dossier/tpl/'.$theme);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$loaders[] = new \Twig_Loader_Filesystem(DOSSIER_ROOT.'/app/tpl/'.$theme);
|
$loaders[] = new \Twig_Loader_Filesystem(DOSSIER_ROOT.'/app/tpl/'.$theme);
|
||||||
|
|
||||||
|
$cache = false;
|
||||||
|
if (getenv('APP_ENV') == 'prod') {
|
||||||
|
$cache = new \Twig_Cache_Filesystem(DOSSIER_CACHE, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION);
|
||||||
|
}
|
||||||
|
|
||||||
$this->twig = new \Twig_Environment(new \Twig_Loader_Chain($loaders), array(
|
$this->twig = new \Twig_Environment(new \Twig_Loader_Chain($loaders), array(
|
||||||
'cache' => new \Twig_Cache_Filesystem(DOSSIER_CACHE, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION),
|
'cache' => $cache,
|
||||||
'debug' => getenv('APP_DEBUG'),
|
'debug' => getenv('APP_DEBUG'),
|
||||||
));
|
));
|
||||||
$this->addTwigExtensions($this->translator->getTranslator(), $this->config);
|
$this->addTwigExtensions($this->translator->getTranslator(), $this->config);
|
||||||
@@ -290,7 +299,7 @@ class TemplateService
|
|||||||
}, array('is_safe' => array('html'))));
|
}, array('is_safe' => array('html'))));
|
||||||
|
|
||||||
$this->twig->addFilter(new \Twig_Filter('debug', function ($var) {
|
$this->twig->addFilter(new \Twig_Filter('debug', function ($var) {
|
||||||
return getenv('APP_DEBUG') == true ? '<code>'.print_r($var, true).'</code>' : '';
|
return getenv('APP_DEBUG') == true || getenv('APP_ENV') == 'dev' ? '<code>'.print_r($var, true).'</code>' : '';
|
||||||
}, array('is_safe' => array('html'))));
|
}, array('is_safe' => array('html'))));
|
||||||
|
|
||||||
$this->twig->addFunction(new \Twig_Function('is_today', function (\DateTime $checkDate) {
|
$this->twig->addFunction(new \Twig_Function('is_today', function (\DateTime $checkDate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user