fix usability mistakes on navigation menu and search input

This commit is contained in:
Marcos Coelho
2012-12-19 23:14:20 -02:00
parent 44ed193402
commit 69e1200b04
3 changed files with 6 additions and 5 deletions

View File

@@ -45,7 +45,7 @@ class CommitController implements ControllerProviderInterface
->value('file', '')
->bind('commits');
$route->post('{repo}/commits/search', function(Request $request, $repo) use ($app) {
$route->post('{repo}/commits/{branch}/search', function(Request $request, $repo, $branch = '') use ($app) {
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
$commits = $repository->searchCommitLog($request->get('query'));
@@ -57,13 +57,14 @@ class CommitController implements ControllerProviderInterface
return $app['twig']->render('searchcommits.twig', array(
'repo' => $repo,
'branch' => 'master',
'branch' => $branch,
'file' => '',
'commits' => $categorized,
'branches' => $repository->getBranches(),
'tags' => $repository->getTags(),
));
})->assert('repo', $app['util.routing']->getRepositoryRegex())
->assert('branch', '[\w-._\/]+')
->bind('searchcommits');
$route->get('{repo}/commit/{commit}/', function($repo, $commit) use ($app) {

View File

@@ -6,8 +6,8 @@
<div class="container">
<div class="row">
<div class="span12">
{% if page == 'commits' %}
<form class="form-search pull-right" action="{{ app.request.basepath }}/{{repo}}/commits/search" method="POST">
{% if page in ['commits', 'searchcommits'] %}
<form class="form-search pull-right" action="{{ app.request.basepath }}/{{repo}}/commits/{{branch}}/search" method="POST">
<input type="text" name="query" class="input-medium search-query" placeholder="Search commits...">
</form>
{% else %}

View File

@@ -1,5 +1,5 @@
<ul class="nav nav-tabs">
<li{% if page == 'files' %} class="active"{% endif %}><a href="{{ path('branch', {repo: repo, branch: branch}) }}">Files</a></li>
<li{% if page == 'commits' %} class="active"{% endif %}><a href="{{ path('commits', {repo: repo, branch: branch}) }}">Commits</a></li>
<li{% if page in ['commits', 'searchcommits'] %} class="active"{% endif %}><a href="{{ path('commits', {repo: repo, branch: branch}) }}">Commits</a></li>
<li{% if page == 'stats' %} class="active"{% endif %}><a href="{{ path('stats', {repo: repo, branch: branch}) }}">Stats</a></li>
</ul>