This commit is contained in:
Simon Vieille 2015-05-06 22:46:29 +02:00
parent c371c56a9a
commit dfcc4569d0
4 changed files with 38 additions and 10 deletions

View file

@ -71,17 +71,26 @@
<div class="commit">
<p>
Commit <strong class="text-warning">{{ commit.commit }}</strong>
{% if loop.first %}(init){% endif %}
<br/>
Date: {{ commit.date|date('date.format'|trans) }}
</p>
<p>
<div>
<a href="{{ path('view', {gist: gist.file, commit: commit.commit}) }}" class="btn btn-primary">
Afficher
</a>
<a class="btn btn-default">
DIFF
</a>
</p>
{% if not loop.first %}
<a href="#diff-{{ loop.index }}" id="diff-{{ loop.index }}" class="btn btn-default show-diff">
DIFF
</a>
<div class="diff">
<pre>{{ commit.diff }}</pre>
</div>
{% endif %}
</div>
</div>
{% if not loop.last %}

View file

@ -43,10 +43,22 @@ class GistService
$history = [];
for ($i = count($commits) - 1; $i >= 0; $i--) {
$history[] = array(
$commit = trim($commits[$i][1]);
$command = GitCommand::getInstance('show', $commit);
$command->setDirectory($this->gistPath);
$command->bypass(false);
$diff = explode("\n", $this->gitWrapper->run($command));
$diff = implode("\n", array_slice($diff, 11));
$data = array(
'commit' => trim($commits[$i][1]),
'date' => new \DateTime(trim($dates[$i][1])),
'diff' => $diff,
);
$history[] = $data;
}
return $history;

View file

@ -26,17 +26,17 @@ body {
margin-right: 4px;
}
#viewer > pre {
pre {
background: #222;
border: #222;
color: #ddd;
}
#viewer pre ol {
padding-left: 50px;
pre ol {
padding-left: 50px !important;
}
#viewer li:hover {
pre li:hover {
background: #222;
}
@ -44,3 +44,6 @@ body {
margin-top: -5px;
}
.diff {
display: none;
}

View file

@ -65,6 +65,10 @@ var editorEvents = function() {
$('#options input:checked').each(function() {
$(this).trigger('change');
});
$('.show-diff').click(function() {
$(this).next().toggle();
});
}
var mainEditorEvents = function() {