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

Commit 112761c

Browse files
author
alexandresalome
committed
twitter bootstrap + log + status + new layout
1 parent 77818f5 commit 112761c

23 files changed

+9846
-391
lines changed

composer.lock

Lines changed: 187 additions & 344 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gitonomy/Browser/Application.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,22 @@ public function registerRouting()
8181

8282
/** Landing page of a repository. */
8383
$this
84-
->get('/{repository}', 'controller.main:showRepositoryAction')
84+
->get('/{repository}', 'controller.main:repositoryAction')
8585
->bind('repository')
8686
;
8787

88+
/** Status page */
89+
$this
90+
->get('/{repository}/status', 'controller.main:statusAction')
91+
->bind('status')
92+
;
93+
94+
/** Log page */
95+
$this
96+
->get('/{repository}/log', 'controller.main:logAction')
97+
->bind('log')
98+
;
99+
88100
/** Ajax Log entries */
89101
$this
90102
->get('/{repository}/log-ajax', 'controller.main:logAjaxAction')

src/Gitonomy/Browser/Controller/MainController.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Gitonomy\Browser\Controller;
44

55
use Symfony\Component\Routing\Generator\UrlGenerator;
6+
use Symfony\Component\HttpFoundation\Request;
67
use Symfony\Component\HttpFoundation\RedirectResponse;
78
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
89

@@ -28,11 +29,21 @@ public function listAction()
2829
return $this->twig->render('repository_list.html.twig', array('repositories' => $this->repositories));
2930
}
3031

31-
public function showRepositoryAction()
32+
public function repositoryAction()
3233
{
3334
return $this->twig->render('repository.html.twig');
3435
}
3536

37+
public function logAction()
38+
{
39+
return $this->twig->render('log.html.twig');
40+
}
41+
42+
public function statusAction()
43+
{
44+
return $this->twig->render('status.html.twig');
45+
}
46+
3647
public function logAjaxAction(Request $request, $repository)
3748
{
3849
if ($reference = $request->query->get('reference')) {

src/Gitonomy/Browser/Resources/views/browse_blob.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "layout.html.twig" %}
22

3+
{% set menu_active = 'tree' %}
4+
35
{% block content %}
46
<h3>Code</h3>
57
{{ git_blob(element, path) }}

src/Gitonomy/Browser/Resources/views/browse_tree.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "layout.html.twig" %}
22

3+
{% set menu_active = 'tree' %}
4+
35
{% block content %}
46
<h3>Browse</h3>
57
{{ git_tree(element, commit, path, revision)}}

src/Gitonomy/Browser/Resources/views/git/default_theme.html.twig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@
6666
{% endspaceless %}
6767
{% endblock %}
6868

69+
{% block status %}
70+
{% spaceless %}
71+
{% if diff_staged.files|length %}
72+
<p>Staging area</p>
73+
<ul>
74+
{% for file in diff_staged.files %}
75+
<li>{{ file.newName }}</li>
76+
{% endfor %}
77+
</ul>
78+
{% endif %}
79+
{% if diff_pending.files|length %}
80+
<p>Pending modifications</p>
81+
<ul>
82+
{% for file in diff_pending.files %}
83+
<li>{{ file.name }}</li>
84+
{% endfor %}
85+
</ul>
86+
{% endif %}
87+
{% endspaceless %}
88+
{% endblock %}
89+
6990
{% block author %}
7091
{% spaceless %}
7192
<span class="git-author">

src/Gitonomy/Browser/Resources/views/layout.html.twig

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
<link rel="stylesheet" href="{{ app.request.basepath }}/css/git/diff.css" />
66
<link rel="stylesheet" href="{{ app.request.basepath }}/css/git/log.css" />
77
<link rel="stylesheet" href="{{ app.request.basepath }}/css/layout.css" />
8-
</head>
8+
<link rel="stylesheet" href="{{ app.request.basepath }}/vendor/bootstrap/css/bootstrap.min.css" />
99
<body>
1010
<div class="gitonomy-browser-wrapper">
1111
<div class="gitonomy-browser">
12-
<h1>
13-
{% if repository|default(false) %}
14-
<a class="project-name" href="{{ url('repository') }}">{{ repository.name }}</a>
15-
-
16-
{% endif %}
17-
<a href="{{ url('repositories') }}">gitonomy/browser</a>
18-
</h1>
12+
<div class="navbar navbar-static-top">
13+
<div class="navbar-inner">
14+
<ul class="nav">
15+
{% if repository|default(false) %}
16+
<a class="brand" href="{{ url('repositories') }}"><i class="icon-chevron-up"></i></a>
17+
<a class="brand" href="{{ url('repository') }}">{{ repository.name }}</a>
18+
<li {{ menu_active|default(null) == 'log' ? ' class="active"' : '' }}><a href="{{ url('log') }}">Log</a></li>
19+
<li {{ menu_active|default(null) == 'status' ? ' class="active"' : '' }}><a href="{{ url('status') }}">Status</a></li>
20+
<li {{ menu_active|default(null) == 'tree' ? ' class="active"' : '' }}><a href="{{ url('tree') }}">Source</a></li>
21+
{% endif %}
22+
</ul>
23+
</div>
24+
</div>
1925
<div class="gitonomy-browser-content">
2026
{% block content '' %}
2127
</div>
@@ -28,5 +34,7 @@
2834
</div>
2935
<script type="text/javascript" src="{{ app.request.basepath }}/vendor/jquery-1.9.0.min.js"></script>
3036
<script type="text/javascript" src="{{ app.request.basepath }}/js/log.js"></script>
37+
<script type="text/javascript" src="{{ app.request.basepath }}/vendor/bootstrap/js/bootstrap.min.js"></script>
38+
</head>
3139
</body>
3240
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "layout.html.twig" %}
2+
3+
{% set menu_active='log' %}
4+
5+
{% block content %}
6+
{{ git_log(repository.log.setLimit(30), {query_url: url('log_ajax')}) }}
7+
{% endblock %}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% extends "layout.html.twig" %}
22

33
{% block content %}
4+
45
{% if repository.references.branches %}
56
<h3>Branches</h3>
67
{{ git_branches(repository) }}
@@ -11,9 +12,4 @@
1112
{{ git_tags(repository) }}
1213
{% endif %}
1314

14-
<h3>Browse</h3>
15-
<a href="{{ url('tree') }}">Browse the repository</a>
16-
17-
<h3>Logs</h3>
18-
{{ git_log(repository.log.setLimit(30), {query_url: url('log_ajax')}) }}
1915
{% endblock %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends "layout.html.twig" %}
2+
3+
{% set menu_active='status' %}
4+
5+
{% block content %}
6+
7+
{{ git_status(repository) }}
8+
9+
{% endblock %}

0 commit comments

Comments
 (0)