template caching disabled in debug mode, cleanup projects page
This commit is contained in:
@@ -502,19 +502,6 @@ dl.horizontal {
|
||||
font-weight: bold;
|
||||
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 {
|
||||
line-height: @intro-paragraph-line-height;
|
||||
font-size: @intro-paragraph-size;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{% import "macros.html.twig" as macros %}
|
||||
|
||||
{% if projects|length > 0 %}
|
||||
<section class="projects">
|
||||
<h2>{{ 'projects.header'|trans }}</h2>
|
||||
@@ -6,21 +8,13 @@
|
||||
{% for project in projects %}
|
||||
<article class="project">
|
||||
<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>
|
||||
{% if project.repository %}
|
||||
<p><a href="{{ project.repository }}" target="_blank">{{ project.repository }}</a></p>
|
||||
{% endif %}
|
||||
{{ project.content|raw }}
|
||||
{% if project.hasUrls() %}
|
||||
<ul>
|
||||
{{ macros.list_link_array(project.urls) }}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -69,16 +69,6 @@ class Intro extends BaseModel implements PhotoInterface, AnalyzableInterface
|
||||
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
|
||||
*
|
||||
|
||||
@@ -30,25 +30,39 @@
|
||||
|
||||
namespace Magdev\Dossier\Model;
|
||||
|
||||
|
||||
use Magdev\Dossier\Model\Base\BaseModel;
|
||||
use Mni\FrontYAML\Document;
|
||||
|
||||
/**
|
||||
* Model for projects page
|
||||
*
|
||||
* @author magdev
|
||||
*/
|
||||
class Project extends BaseModel
|
||||
{
|
||||
/**
|
||||
* Project name
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '';
|
||||
protected $status = '';
|
||||
protected $url = '';
|
||||
|
||||
/**
|
||||
* Public URLs
|
||||
* @var array
|
||||
*/
|
||||
protected $urls = array();
|
||||
|
||||
/**
|
||||
* Short Description
|
||||
* @var string
|
||||
*/
|
||||
protected $shortDescription = '';
|
||||
|
||||
/**
|
||||
* Project stack
|
||||
* @var string
|
||||
*/
|
||||
protected $stack = '';
|
||||
protected $role = '';
|
||||
|
||||
|
||||
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getStack(): string
|
||||
@@ -57,35 +71,26 @@ class Project extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getStatus(): string
|
||||
public function hasUrls(): bool
|
||||
{
|
||||
return $this->status;
|
||||
return sizeof($this->urls) > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getUrl(): string
|
||||
public function getUrls(): array
|
||||
{
|
||||
return $this->url;
|
||||
return $this->urls;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getShortDescription(): string
|
||||
{
|
||||
return $this->shortDescription;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ class TemplateService
|
||||
{
|
||||
$theme = !$theme ? $this->theme : $theme;
|
||||
|
||||
if (getenv('APP_ENV') == 'prod') {
|
||||
if (getenv('DOSSIER_THEME_DIR')) {
|
||||
if (is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme) && file_exists(getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file)) {
|
||||
return getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file;
|
||||
@@ -128,6 +129,7 @@ class TemplateService
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -143,16 +145,23 @@ class TemplateService
|
||||
$this->theme = $theme;
|
||||
|
||||
$loaders = array();
|
||||
if (getenv('APP_ENV') == 'prod') {
|
||||
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);
|
||||
}
|
||||
}
|
||||
$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(
|
||||
'cache' => new \Twig_Cache_Filesystem(DOSSIER_CACHE, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION),
|
||||
'cache' => $cache,
|
||||
'debug' => getenv('APP_DEBUG'),
|
||||
));
|
||||
$this->addTwigExtensions($this->translator->getTranslator(), $this->config);
|
||||
@@ -290,7 +299,7 @@ class TemplateService
|
||||
}, array('is_safe' => array('html'))));
|
||||
|
||||
$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'))));
|
||||
|
||||
$this->twig->addFunction(new \Twig_Function('is_today', function (\DateTime $checkDate) {
|
||||
|
||||
Reference in New Issue
Block a user