diff
This commit is contained in:
parent
c371c56a9a
commit
dfcc4569d0
|
@ -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 %}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue