mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
Added DateTime format configuration to config.ini, fixes #362
This commit is contained in:
@@ -30,3 +30,4 @@ theme = "default"
|
||||
; set the timezone
|
||||
[date]
|
||||
; timezone = UTC
|
||||
; format = 'd/m/Y H:i:s'
|
||||
|
||||
@@ -30,6 +30,7 @@ class Application extends SilexApplication
|
||||
$this->path = realpath($root);
|
||||
|
||||
$this['debug'] = $config->get('app', 'debug');
|
||||
$this['date.format'] = $config->get('date', 'format') ? $config->get('date', 'format') : 'd/m/Y H:i:s';
|
||||
$this['theme'] = $config->get('app', 'theme') ? $config->get('app', 'theme') : 'default';
|
||||
$this['filetypes'] = $config->getSection('filetypes');
|
||||
$this['cache.archives'] = $this->getCachePath() . 'archives';
|
||||
@@ -59,8 +60,9 @@ class Application extends SilexApplication
|
||||
$this->register(new RoutingUtilServiceProvider());
|
||||
|
||||
$this['twig'] = $this->share($this->extend('twig', function ($twig, $app) {
|
||||
$twig->addFilter('htmlentities', new \Twig_Filter_Function('htmlentities'));
|
||||
$twig->addFilter('md5', new \Twig_Filter_Function('md5'));
|
||||
$twig->addFilter(new \Twig_SimpleFilter('htmlentities', 'htmlentities'));
|
||||
$twig->addFilter(new \Twig_SimpleFilter('md5', 'md5'));
|
||||
$twig->addFilter(new \Twig_SimpleFilter('format_date', array($this, 'formatDate')));
|
||||
|
||||
return $twig;
|
||||
}));
|
||||
@@ -77,6 +79,11 @@ class Application extends SilexApplication
|
||||
});
|
||||
}
|
||||
|
||||
public function formatDate($date)
|
||||
{
|
||||
return $date->format($this['date.format']);
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path . DIRECTORY_SEPARATOR;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<p>{{ commit.body | nl2br }}</p>
|
||||
{% endif %}
|
||||
<img src="https://gravatar.com/avatar/{{ commit.author.email | lower | md5 }}?s=32" class="pull-left space-right" />
|
||||
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored on {{ commit.date | date('d/m/Y \\a\\t H:i:s') }}<br />Showing {{ commit.changedFiles }} changed files</span>
|
||||
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored on {{ commit.date | format_date }}<br />Showing {{ commit.changedFiles }} changed files</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<td width="95%">
|
||||
<span class="pull-right"><a class="btn btn-default btn-sm" href="{{ path('commit', {repo: repo, commit: item.hash}) }}"><span class="fa fa-list-alt"></span> View {{ item.shortHash }}</a></span>
|
||||
<h4>{{ item.message }}</h4>
|
||||
<span><a href="mailto:{{ item.author.email }}">{{ item.author.name }}</a> authored on {{ item.date | date('d/m/Y \\a\\t H:i:s') }}</span>
|
||||
<span><a href="mailto:{{ item.author.email }}">{{ item.author.name }}</a> authored on {{ item.date | format_date }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>{{ commit.body | nl2br }}</p>
|
||||
{% endif %}
|
||||
<img src="https://gravatar.com/avatar/{{ commit.author.email | lower | md5 }}?s=32" class="pull-left space-right" />
|
||||
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored on {{ commit.date | date('d/m/Y \\a\\t H:i:s') }}<br />Showing {{ commit.changedFiles }} changed files</span>
|
||||
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored on {{ commit.date | format_date }}<br />Showing {{ commit.changedFiles }} changed files</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<td width="95%">
|
||||
<span class="pull-right"><a class="btn btn-small" href="{{ path('commit', {repo: repo, commit: item.hash}) }}"><i class="icon-list-alt"></i> View {{ item.shortHash }}</a></span>
|
||||
<h4>{{ item.message }}</h4>
|
||||
<span><a href="mailto:{{ item.author.email }}">{{ item.author.name }}</a> authored on {{ item.date | date('d/m/Y \\a\\t H:i:s') }}</span>
|
||||
<span><a href="mailto:{{ item.author.email }}">{{ item.author.name }}</a> authored on {{ item.date | format_date }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% for commit in commits %}
|
||||
<item>
|
||||
<title>{{ commit.message }}</title>
|
||||
<description>{{ commit.author.name }} authored {{ commit.shortHash }} in {{ commit.date | date('d/m/Y \\a\\t H:i:s') }}</description>
|
||||
<description>{{ commit.author.name }} authored {{ commit.shortHash }} in {{ commit.date | format_date }}</description>
|
||||
<link>{{ url('commit', {repo: repo, commit: commit.hash}) }}</link>
|
||||
<pubDate>{{ commit.date | date('r') }}</pubDate>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user