diff --git a/src/Gist/Resources/views/View/view.html.twig b/src/Gist/Resources/views/View/view.html.twig index 96eda55..8e51d6f 100644 --- a/src/Gist/Resources/views/View/view.html.twig +++ b/src/Gist/Resources/views/View/view.html.twig @@ -1,9 +1,9 @@ {% extends 'base.html.twig' %} {% block css %} - {{ parent() }} + - + {{ parent() }} {% endblock %} {% block body %} @@ -70,24 +70,26 @@ {% for commit in history %}

- Commit {{ commit.commit }} - - {% if loop.first %}(init){% endif %} + + {{ commit.commit|slice(0, 10) }} + -
- Date: {{ commit.date|date('date.format'|trans) }} + {% if loop.first %}init{% endif %} + + {% if not loop.first %} + + diff + + {% endif %} +

+

+ {{ commit.date|date('date.format'|trans) }}

- - Afficher - {% if not loop.first %} - - DIFF - -
-
{{ commit.diff }}
+
+ {{ commit.diff|raw }}
{% endif %}
diff --git a/src/Gist/Service/GistService.php b/src/Gist/Service/GistService.php index 62fdbdc..2f48e98 100644 --- a/src/Gist/Service/GistService.php +++ b/src/Gist/Service/GistService.php @@ -45,7 +45,7 @@ class GistService for ($i = count($commits) - 1; $i >= 0; $i--) { $commit = trim($commits[$i][1]); - $command = GitCommand::getInstance('show', $commit); + $command = GitCommand::getInstance('show', '--no-color', $commit); $command->setDirectory($this->gistPath); $command->bypass(false); @@ -55,7 +55,7 @@ class GistService $data = array( 'commit' => trim($commits[$i][1]), 'date' => new \DateTime(trim($dates[$i][1])), - 'diff' => $diff, + 'diff' => $this->highlight('diff', $diff), ); $history[] = $data; diff --git a/web/app/css/app.css b/web/app/css/app.css index 75592eb..c8de003 100644 --- a/web/app/css/app.css +++ b/web/app/css/app.css @@ -30,6 +30,11 @@ pre { background: #222; border: #222; color: #ddd; + white-space: pre-wrap; + white-space: -moz-pre-wrap; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word; } pre ol { @@ -37,13 +42,30 @@ pre ol { } pre li:hover { - background: #222; + background: #444; } .panel-heading .actions { margin-top: -5px; } -.diff { +div.diff { display: none; } + +.de1 { + padding-left: 5px; + padding-right: 5px; +} + +.li1 { + background: #333; +} + +.re8 { + color: #52F700; +} + +.kw3 { + color: #C6C765; +} diff --git a/web/app/js/app.js b/web/app/js/app.js index 509fb8c..a116502 100644 --- a/web/app/js/app.js +++ b/web/app/js/app.js @@ -67,7 +67,7 @@ var editorEvents = function() { }); $('.show-diff').click(function() { - $(this).next().toggle(); + $($(this).data('target')).toggle(); }); }