Merge pull request #224 from marcoscoelho/path-to-usability

fix usability mistakes on navigation menu and search input
This commit is contained in:
Klaus Silveira
2012-12-20 09:01:31 -08:00
3 changed files with 6 additions and 5 deletions

View File

@@ -47,7 +47,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);
$query = $request->get('query');
$commits = $repository->searchCommitLog($query);
@@ -61,7 +61,7 @@ class CommitController implements ControllerProviderInterface
return $app['twig']->render('searchcommits.twig', array(
'repo' => $repo,
'branch' => 'master',
'branch' => $branch,
'file' => '',
'commits' => $categorized,
'branches' => $repository->getBranches(),
@@ -69,6 +69,7 @@ class CommitController implements ControllerProviderInterface
'query' => $query
));
})->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>