mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-18 03:30:55 +01:00
fixed URL management
This commit is contained in:
@@ -4,57 +4,54 @@ $app->get('{repo}/', function($repo) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$defaultBranch = $repository->getHead();
|
||||
$tree = $repository->getTree($defaultBranch);
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
|
||||
|
||||
return $app['twig']->render('tree.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'files' => $tree->output(),
|
||||
'repo' => $repo,
|
||||
'branch' => $defaultBranch,
|
||||
'path' => '',
|
||||
'parent' => '',
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'breadcrumbs' => array(),
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'readme' => $app['utils']->getReadme($repo, $defaultBranch),
|
||||
));
|
||||
})->assert('repo', '[\w-._]+');
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->bind('repository');
|
||||
|
||||
$app->get('{repo}/tree/{branch}/', function($repo, $branch) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$tree = $repository->getTree($branch);
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
|
||||
|
||||
return $app['twig']->render('tree.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'files' => $tree->output(),
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'path' => '',
|
||||
'parent' => '',
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'breadcrumbs' => array(),
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'readme' => $app['utils']->getReadme($repo, $branch),
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('tree');
|
||||
|
||||
$app->get('{repo}/tree/{branch}/{tree}/', function($repo, $branch, $tree) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$files = $repository->getTree("$branch:'$tree'/");
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$tree");
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs($tree);
|
||||
|
||||
if (($slash = strrpos($tree, '/')) !== false) {
|
||||
$parent = '/' . substr($tree, 0, $slash);
|
||||
$parent = substr($tree, 0, $slash);
|
||||
} else {
|
||||
$parent = '/';
|
||||
$parent = '';
|
||||
}
|
||||
|
||||
return $app['twig']->render('tree.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'files' => $files->output(),
|
||||
'repo' => $repo,
|
||||
@@ -64,7 +61,9 @@ $app->get('{repo}/tree/{branch}/{tree}/', function($repo, $branch, $tree) use($a
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'readme' => $app['utils']->getReadme($repo, $branch),
|
||||
));
|
||||
})->assert('tree', '.+')
|
||||
->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('tree_dir');
|
||||
|
||||
Reference in New Issue
Block a user