Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.

Commit f55e9e3

Browse files
committed
add changelog in download page
1 parent d4cecc2 commit f55e9e3

4 files changed

Lines changed: 54 additions & 4 deletions

File tree

src/Gitonomy/ChangeLog/ChangeLog.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Gitonomy\ChangeLog\Node\Version;
66

7-
class ChangeLog
7+
class ChangeLog implements \IteratorAggregate
88
{
99
protected $versions;
1010

@@ -53,4 +53,9 @@ static public function fromArray(array $array)
5353

5454
return $changelog;
5555
}
56+
57+
public function getIterator()
58+
{
59+
return new \ArrayIterator($this->versions);
60+
}
5661
}

src/Gitonomy/ChangeLog/Node/Version.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Gitonomy\ChangeLog\Node;
44

5-
class Version
5+
class Version implements \IteratorAggregate
66
{
77
protected $version;
88
protected $date;
@@ -62,4 +62,9 @@ static public function fromArray(array $array)
6262

6363
return $version;
6464
}
65+
66+
public function getIterator()
67+
{
68+
return new \ArrayIterator($this->features);
69+
}
6570
}

views/pages/download.html.twig

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="span4">
1111
<h3>Stable release</h3>
1212
<p>
13-
<a class="btn btn-large btn-success" href="/downloads/v0.2.tar.gz"><i class="icon-file icon-white"></i> Download stable version (v0.2)</a>
13+
<a class="btn btn-large btn-success" href="/downloads/v0.3.tar.gz"><i class="icon-file icon-white"></i> Download stable version (v0.3)</a>
1414
</p>
1515
</div>
1616
<div class="span4">
@@ -20,4 +20,39 @@
2020
</p>
2121
</div>
2222
</div>
23+
<h2>Changelog</h2>
24+
25+
{% for version in changeLog %}
26+
<legend>
27+
{% if version.date == '' %}
28+
master
29+
{% else %}
30+
v{{ version.version }} ({{ version.date }})
31+
{% endif %}
32+
</legend>
33+
<table class="table">
34+
<thead>
35+
<tr>
36+
<th>level</th>
37+
<th>feature</th>
38+
</tr>
39+
</thead>
40+
<tbody>
41+
{% for feature in version.features %}
42+
<tr>
43+
<td>
44+
{% if feature.level is sameas ('security') %}
45+
<i class="icon-bullhorn"></i>
46+
{% elseif feature.level is sameas ('new') %}
47+
<i class="icon-gift"></i>
48+
{% elseif feature.level is sameas ('fix') %}
49+
<i class="icon-ban-circle"></i>
50+
{% endif %}
51+
</td>
52+
<td>{{ feature.feature }}</td>
53+
</tr>
54+
{% endfor %}
55+
</tbody>
56+
</table>
57+
{% endfor %}
2358
{% endblock %}

web/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
->bind('demo');
3131

3232
$app->get('/download', function() use($app) {
33-
return $app['twig']->render('pages/download.html.twig');
33+
$changeLog = $app['gitonomy.changelog'];
34+
$currentVersion = $changeLog->getLastStableVersion();
35+
36+
return $app['twig']->render('pages/download.html.twig', array(
37+
'changeLog' => $changeLog,
38+
));
3439
})
3540
->bind('download');
3641

0 commit comments

Comments
 (0)