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

View File

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

View File

@@ -1,5 +1,5 @@
<ul class="nav nav-tabs"> <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 == '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> <li{% if page == 'stats' %} class="active"{% endif %}><a href="{{ path('stats', {repo: repo, branch: branch}) }}">Stats</a></li>
</ul> </ul>