mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-18 03:30:55 +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
|
; set the timezone
|
||||||
[date]
|
[date]
|
||||||
; timezone = UTC
|
; timezone = UTC
|
||||||
|
; format = 'd/m/Y H:i:s'
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Application extends SilexApplication
|
|||||||
$this->path = realpath($root);
|
$this->path = realpath($root);
|
||||||
|
|
||||||
$this['debug'] = $config->get('app', 'debug');
|
$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['theme'] = $config->get('app', 'theme') ? $config->get('app', 'theme') : 'default';
|
||||||
$this['filetypes'] = $config->getSection('filetypes');
|
$this['filetypes'] = $config->getSection('filetypes');
|
||||||
$this['cache.archives'] = $this->getCachePath() . 'archives';
|
$this['cache.archives'] = $this->getCachePath() . 'archives';
|
||||||
@@ -59,8 +60,9 @@ class Application extends SilexApplication
|
|||||||
$this->register(new RoutingUtilServiceProvider());
|
$this->register(new RoutingUtilServiceProvider());
|
||||||
|
|
||||||
$this['twig'] = $this->share($this->extend('twig', function ($twig, $app) {
|
$this['twig'] = $this->share($this->extend('twig', function ($twig, $app) {
|
||||||
$twig->addFilter('htmlentities', new \Twig_Filter_Function('htmlentities'));
|
$twig->addFilter(new \Twig_SimpleFilter('htmlentities', 'htmlentities'));
|
||||||
$twig->addFilter('md5', new \Twig_Filter_Function('md5'));
|
$twig->addFilter(new \Twig_SimpleFilter('md5', 'md5'));
|
||||||
|
$twig->addFilter(new \Twig_SimpleFilter('format_date', array($this, 'formatDate')));
|
||||||
|
|
||||||
return $twig;
|
return $twig;
|
||||||
}));
|
}));
|
||||||
@@ -77,6 +79,11 @@ class Application extends SilexApplication
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formatDate($date)
|
||||||
|
{
|
||||||
|
return $date->format($this['date.format']);
|
||||||
|
}
|
||||||
|
|
||||||
public function getPath()
|
public function getPath()
|
||||||
{
|
{
|
||||||
return $this->path . DIRECTORY_SEPARATOR;
|
return $this->path . DIRECTORY_SEPARATOR;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<p>{{ commit.body | nl2br }}</p>
|
<p>{{ commit.body | nl2br }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<img src="https://gravatar.com/avatar/{{ commit.author.email | lower | md5 }}?s=32" class="pull-left space-right" />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<td width="95%">
|
<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>
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<p>{{ commit.body | nl2br }}</p>
|
<p>{{ commit.body | nl2br }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<img src="https://gravatar.com/avatar/{{ commit.author.email | lower | md5 }}?s=32" class="pull-left space-right" />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<td width="95%">
|
<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>
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
{% for commit in commits %}
|
{% for commit in commits %}
|
||||||
<item>
|
<item>
|
||||||
<title>{{ commit.message }}</title>
|
<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>
|
<link>{{ url('commit', {repo: repo, commit: commit.hash}) }}</link>
|
||||||
<pubDate>{{ commit.date | date('r') }}</pubDate>
|
<pubDate>{{ commit.date | date('r') }}</pubDate>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|||||||
Reference in New Issue
Block a user