diff
This commit is contained in:
parent
c371c56a9a
commit
dfcc4569d0
|
@ -71,17 +71,26 @@
|
||||||
<div class="commit">
|
<div class="commit">
|
||||||
<p>
|
<p>
|
||||||
Commit <strong class="text-warning">{{ commit.commit }}</strong>
|
Commit <strong class="text-warning">{{ commit.commit }}</strong>
|
||||||
|
|
||||||
|
{% if loop.first %}(init){% endif %}
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
Date: {{ commit.date|date('date.format'|trans) }}
|
Date: {{ commit.date|date('date.format'|trans) }}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<div>
|
||||||
<a href="{{ path('view', {gist: gist.file, commit: commit.commit}) }}" class="btn btn-primary">
|
<a href="{{ path('view', {gist: gist.file, commit: commit.commit}) }}" class="btn btn-primary">
|
||||||
Afficher
|
Afficher
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-default">
|
{% if not loop.first %}
|
||||||
|
<a href="#diff-{{ loop.index }}" id="diff-{{ loop.index }}" class="btn btn-default show-diff">
|
||||||
DIFF
|
DIFF
|
||||||
</a>
|
</a>
|
||||||
</p>
|
|
||||||
|
<div class="diff">
|
||||||
|
<pre>{{ commit.diff }}</pre>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not loop.last %}
|
{% if not loop.last %}
|
||||||
|
|
|
@ -43,10 +43,22 @@ class GistService
|
||||||
$history = [];
|
$history = [];
|
||||||
|
|
||||||
for ($i = count($commits) - 1; $i >= 0; $i--) {
|
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]),
|
'commit' => trim($commits[$i][1]),
|
||||||
'date' => new \DateTime(trim($dates[$i][1])),
|
'date' => new \DateTime(trim($dates[$i][1])),
|
||||||
|
'diff' => $diff,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$history[] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $history;
|
return $history;
|
||||||
|
|
|
@ -26,17 +26,17 @@ body {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewer > pre {
|
pre {
|
||||||
background: #222;
|
background: #222;
|
||||||
border: #222;
|
border: #222;
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewer pre ol {
|
pre ol {
|
||||||
padding-left: 50px;
|
padding-left: 50px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewer li:hover {
|
pre li:hover {
|
||||||
background: #222;
|
background: #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,3 +44,6 @@ body {
|
||||||
margin-top: -5px;
|
margin-top: -5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.diff {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,10 @@ var editorEvents = function() {
|
||||||
$('#options input:checked').each(function() {
|
$('#options input:checked').each(function() {
|
||||||
$(this).trigger('change');
|
$(this).trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.show-diff').click(function() {
|
||||||
|
$(this).next().toggle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainEditorEvents = function() {
|
var mainEditorEvents = function() {
|
||||||
|
|
Loading…
Reference in a new issue