mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"require": {
|
||||
"silex/silex": "1.0.*",
|
||||
"twig/twig": "1.8.*"
|
||||
},
|
||||
"twig/twig": "1.8.*",
|
||||
"symfony/twig-bridge": "2.1.*"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Application": "lib/",
|
||||
|
||||
22
composer.lock
generated
22
composer.lock
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"hash": "3a86b6a3e837b125e3cebc503fd8cf38",
|
||||
"hash": "8909d5f3ac695303e7845fe5cb0658ad",
|
||||
"packages": [
|
||||
{
|
||||
"package": "pimple/pimple",
|
||||
@@ -22,8 +22,8 @@
|
||||
{
|
||||
"package": "silex/silex",
|
||||
"version": "dev-master",
|
||||
"source-reference": "13eb2ba916e39d5b8b1d054aaa441cf8e1004d85",
|
||||
"commit-date": "1341343086"
|
||||
"source-reference": "23dc19c334e2f74ec4de037568f5426bceaff421",
|
||||
"commit-date": "1341597562"
|
||||
},
|
||||
{
|
||||
"package": "symfony/event-dispatcher",
|
||||
@@ -74,16 +74,20 @@
|
||||
"commit-date": "1341312726"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"package": "symfony/twig-bridge",
|
||||
"version": "dev-master",
|
||||
"alias-pretty-version": "1.8.x-dev",
|
||||
"alias-version": "1.8.9999999.9999999-dev"
|
||||
"alias-pretty-version": "2.1.x-dev",
|
||||
"alias-version": "2.1.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "symfony/twig-bridge",
|
||||
"version": "dev-master",
|
||||
"source-reference": "2a577b6cf0fe32f383acf4a972c1d5d8f48ae1e2",
|
||||
"commit-date": "1340549862"
|
||||
},
|
||||
{
|
||||
"package": "twig/twig",
|
||||
"version": "dev-master",
|
||||
"source-reference": "73da773aaad0f97f2e967ec8241b8adf7b1e03d2",
|
||||
"commit-date": "1340890758"
|
||||
"version": "v1.8.3"
|
||||
}
|
||||
],
|
||||
"packages-dev": null,
|
||||
|
||||
@@ -6,7 +6,6 @@ repositories = '/var/www/projects/' ; Path to your repositories
|
||||
; hidden[] = '/var/www/projects/BetaTest'
|
||||
|
||||
[app]
|
||||
baseurl = 'http://localhost/git' ; Base URL of the application
|
||||
|
||||
; If you need to specify custom filetypes for certain extensions, do this here
|
||||
[filetypes]
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<?php
|
||||
|
||||
$app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($app) {
|
||||
$app->get('{repo}/blob/{branch}/{file}', function($repo, $branch, $file) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$blob = $repository->getBlob("$branch:'$file'");
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/tree/$branch/$file");
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs($file);
|
||||
$fileType = $app['utils']->getFileType($file);
|
||||
|
||||
return $app['twig']->render('file.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'file' => $file,
|
||||
'fileType' => $fileType,
|
||||
'blob' => $blob->output(),
|
||||
@@ -20,7 +18,8 @@ $app->get('{repo}/blob/{branch}/{file}/', function($repo, $branch, $file) use($a
|
||||
));
|
||||
})->assert('file', '.+')
|
||||
->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('blob');
|
||||
|
||||
$app->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
@@ -29,4 +28,5 @@ $app->get('{repo}/raw/{branch}/{file}', function($repo, $branch, $file) use($app
|
||||
return new Symfony\Component\HttpFoundation\Response($blob, 200, array('Content-Type' => 'text/plain'));
|
||||
})->assert('file', '.+')
|
||||
->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('blob_raw');
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
$app->get('{repo}/commits/{branch}', function($repo, $branch) use($app) {
|
||||
$app->get('{repo}/commits/{branch}/{file}', function($repo, $branch, $file) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$pager = $app['utils']->getPager($app['request']->get('page'), $repository->getTotalCommits());
|
||||
$commits = $repository->getCommits($branch, $pager['current']);
|
||||
$type = $file ? "$branch -- $file" : $branch;
|
||||
$pager = $app['utils']->getPager($app['request']->get('page'), $repository->getTotalCommits($type));
|
||||
$commits = $repository->getCommits($type, $pager['current']);
|
||||
|
||||
foreach ($commits as $commit) {
|
||||
$date = $commit->getDate();
|
||||
@@ -12,65 +13,39 @@ $app->get('{repo}/commits/{branch}', function($repo, $branch) use($app) {
|
||||
}
|
||||
|
||||
return $app['twig']->render('commits.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'commits',
|
||||
'pager' => $pager,
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'commits' => $categorized,
|
||||
'file' => $file,
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+')
|
||||
->value('branch', 'master');
|
||||
|
||||
$app->get('{repo}/commits/{branch}/{file}/', function($repo, $branch, $file) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$pager = $app['utils']->getPager($app['request']->get('page'), $repository->getTotalCommits("$branch -- $file"));
|
||||
$commits = $repository->getCommits("$branch -- $file", $pager['current']);
|
||||
|
||||
foreach ($commits as $commit) {
|
||||
$date = $commit->getDate();
|
||||
$date = $date->format('m/d/Y');
|
||||
$categorized[$date][] = $commit;
|
||||
}
|
||||
|
||||
return $app['twig']->render('commits.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'commits',
|
||||
'pager' => $pager,
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'commits' => $categorized,
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('file', '.+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->value('branch', 'master')
|
||||
->value('file', '')
|
||||
->bind('commits');
|
||||
|
||||
$app->get('{repo}/commit/{commit}/', function($repo, $commit) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$commit = $repository->getCommit($commit);
|
||||
|
||||
return $app['twig']->render('commit.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'commits',
|
||||
'branch' => 'master',
|
||||
'repo' => $repo,
|
||||
'commit' => $commit,
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('commit', '[a-f0-9]+');
|
||||
->assert('commit', '[a-f0-9]+')
|
||||
->bind('commit');
|
||||
|
||||
$app->get('{repo}/blame/{branch}/{file}/', function($repo, $branch, $file) use($app) {
|
||||
$app->get('{repo}/blame/{branch}/{file}', function($repo, $branch, $file) use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$blames = $repository->getBlame("$branch -- $file");
|
||||
|
||||
return $app['twig']->render('blame.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'commits',
|
||||
'file' => $file,
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
@@ -80,4 +55,5 @@ $app->get('{repo}/blame/{branch}/{file}/', function($repo, $branch, $file) use($
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('file', '.+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('blame');
|
||||
|
||||
@@ -4,7 +4,6 @@ $app->get('/', function() use($app) {
|
||||
$repositories = $app['git']->getRepositories($app['git.repos']);
|
||||
|
||||
return $app['twig']->render('index.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'repositories' => $repositories,
|
||||
));
|
||||
});
|
||||
})->bind('homepage');
|
||||
|
||||
@@ -5,7 +5,6 @@ $app->get('{repo}/{branch}/rss/', function($repo, $branch) use($app) {
|
||||
$commits = $repository->getCommits($branch);
|
||||
|
||||
$html = $app['twig']->render('rss.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'commits' => $commits,
|
||||
@@ -13,4 +12,5 @@ $app->get('{repo}/{branch}/rss/', function($repo, $branch) use($app) {
|
||||
|
||||
return new Symfony\Component\HttpFoundation\Response($html, 200, array('Content-Type' => 'application/rss+xml'));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('rss');
|
||||
@@ -6,8 +6,6 @@ $app->get('{repo}/stats/{branch}', function($repo, $branch) use($app) {
|
||||
$authors = $repository->getAuthorStatistics();
|
||||
|
||||
return $app['twig']->render('stats.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'stats',
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'branches' => $repository->getBranches(),
|
||||
@@ -17,4 +15,5 @@ $app->get('{repo}/stats/{branch}', function($repo, $branch) use($app) {
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+')
|
||||
->value('branch', 'master');
|
||||
->value('branch', 'master')
|
||||
->bind('stats');
|
||||
|
||||
@@ -1,70 +1,43 @@
|
||||
<?php
|
||||
|
||||
$app->get('{repo}/', function($repo) use($app) {
|
||||
$app->get('{repo}/tree/{branch}/{tree}/', $treeController = function($repo, $branch = '', $tree = '') use($app) {
|
||||
$repository = $app['git']->getRepository($app['git.repos'] . $repo);
|
||||
$defaultBranch = $repository->getHead();
|
||||
$tree = $repository->getTree($defaultBranch);
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs("$repo/");
|
||||
if (!$branch) {
|
||||
$branch = $repository->getHead();
|
||||
}
|
||||
$files = $repository->getTree($tree ? "$branch:'$tree'/" : $branch);
|
||||
$breadcrumbs = $app['utils']->getBreadcrumbs($tree);
|
||||
|
||||
$parent = null;
|
||||
if (($slash = strrpos($tree, '/')) !== false) {
|
||||
$parent = substr($tree, 0, $slash);
|
||||
} elseif (!empty($tree)) {
|
||||
$parent = '';
|
||||
}
|
||||
|
||||
return $app['twig']->render('tree.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'files' => $tree->output(),
|
||||
'repo' => $repo,
|
||||
'branch' => $defaultBranch,
|
||||
'path' => '',
|
||||
'parent' => '',
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'readme' => $app['utils']->getReadme($repo, $defaultBranch),
|
||||
));
|
||||
})->assert('repo', '[\w-._]+');
|
||||
|
||||
$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(),
|
||||
'files' => $files->output(),
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'path' => '',
|
||||
'parent' => '',
|
||||
'path' => $tree ? $tree.'/' : $tree,
|
||||
'parent' => $parent,
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
'readme' => $app['utils']->getReadme($repo, $branch),
|
||||
));
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
->assert('branch', '[\w-._]+')
|
||||
->assert('tree', '.+')
|
||||
->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");
|
||||
$app->get('{repo}/{branch}/', function($repo, $branch) use($app, $treeController) {
|
||||
return $treeController($repo, $branch);
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+')
|
||||
->bind('branch');
|
||||
|
||||
if (($slash = strrpos($tree, '/')) !== false) {
|
||||
$parent = '/' . substr($tree, 0, $slash);
|
||||
} else {
|
||||
$parent = '/';
|
||||
}
|
||||
|
||||
return $app['twig']->render('tree.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'page' => 'files',
|
||||
'files' => $files->output(),
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'path' => "$tree/",
|
||||
'parent' => $parent,
|
||||
'breadcrumbs' => $breadcrumbs,
|
||||
'branches' => $repository->getBranches(),
|
||||
'tags' => $repository->getTags(),
|
||||
));
|
||||
})->assert('tree', '.+')
|
||||
->assert('repo', '[\w-._]+')
|
||||
->assert('branch', '[\w-._]+');
|
||||
$app->get('{repo}/', function($repo) use($app, $treeController) {
|
||||
return $treeController($repo);
|
||||
})->assert('repo', '[\w-._]+')
|
||||
->bind('repository');
|
||||
|
||||
13
index.php
13
index.php
@@ -14,7 +14,6 @@ if (empty($config['git']['repositories']) || !is_dir($config['git']['repositorie
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$app = new Silex\Application();
|
||||
$app['baseurl'] = rtrim($config['app']['baseurl'], '/');
|
||||
$app['filetypes'] = $config['filetypes'];
|
||||
$app['hidden'] = isset($config['git']['hidden']) ? $config['git']['hidden'] : array();
|
||||
$config['git']['repositories'] = rtrim($config['git']['repositories'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
|
||||
@@ -29,9 +28,14 @@ $app->register(new Git\GitServiceProvider(), array(
|
||||
'git.repos' => $config['git']['repositories'],
|
||||
));
|
||||
$app->register(new Application\UtilsServiceProvider());
|
||||
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
|
||||
|
||||
// Add the md5() function to Twig scope
|
||||
$app['twig']->addFilter('md5', new Twig_Filter_Function('md5'));
|
||||
$app['twig'] = $app->share($app->extend('twig', function($twig, $app) {
|
||||
// Add the md5() function to Twig scope
|
||||
$twig->addFilter('md5', new Twig_Filter_Function('md5'));
|
||||
|
||||
return $twig;
|
||||
}));
|
||||
|
||||
// Load controllers
|
||||
include 'controllers/indexController.php';
|
||||
@@ -44,8 +48,7 @@ include 'controllers/rssController.php';
|
||||
// Error handling
|
||||
$app->error(function (\Exception $e, $code) use ($app) {
|
||||
return $app['twig']->render('error.twig', array(
|
||||
'baseurl' => $app['baseurl'],
|
||||
'message' => $e->getMessage(),
|
||||
'message' => $e->getMessage(),
|
||||
));
|
||||
});
|
||||
|
||||
|
||||
@@ -24,21 +24,19 @@ class Utils
|
||||
*/
|
||||
public function getBreadcrumbs($spec)
|
||||
{
|
||||
if (!$spec) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$paths = explode('/', $spec);
|
||||
$last = '';
|
||||
|
||||
foreach ($paths as $path) {
|
||||
$dir['dir'] = $path;
|
||||
$dir['path'] = "$last/$path";
|
||||
$breadcrumbs[] = $dir;
|
||||
$last .= '/' . $path;
|
||||
foreach ($paths as $i => $path) {
|
||||
$breadcrumbs[] = array(
|
||||
'dir' => $path,
|
||||
'path' => implode('/', array_slice($paths, 0, $i + 1)),
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($paths[2])) {
|
||||
$breadcrumbs[0]['path'] .= '/' . $paths[1] . '/' . $paths[2];
|
||||
}
|
||||
|
||||
unset($breadcrumbs[1], $breadcrumbs[2]);
|
||||
return $breadcrumbs;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,12 @@ class UtilsServiceProvider implements ServiceProviderInterface
|
||||
* Register the Utils class on the Application ServiceProvider
|
||||
*
|
||||
* @param Application $app Silex Application
|
||||
* @return Utils Instance of the Utils class
|
||||
*/
|
||||
public function register(Application $app)
|
||||
{
|
||||
$app['utils'] = function () use ($app) {
|
||||
$app['utils'] = $app->share(function () use ($app) {
|
||||
return new Utils($app);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(Application $app)
|
||||
|
||||
@@ -515,7 +515,7 @@ class Repository
|
||||
continue;
|
||||
}
|
||||
|
||||
preg_match_all("/([a-zA-Z0-9^]{8})[\s]+([0-9]+)\)(.+)/", $log, $match);
|
||||
preg_match_all("/([a-zA-Z0-9^]{8})\s+.*?([0-9]+)\)(.+)/", $log, $match);
|
||||
|
||||
$current_commit = $match[1][0];
|
||||
if ($current_commit != $previous_commit) {
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'commits' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{{ baseurl }}/{{ repo }}">{{ repo }}</a> <span class="divider">/</span></li>
|
||||
<li>Blame</li>
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Blame', path:''}]} %}
|
||||
|
||||
<div class="source-view">
|
||||
<div class="source-header">
|
||||
@@ -23,7 +14,7 @@
|
||||
<table class="blame-view">
|
||||
{% for blame in blames %}
|
||||
<tr>
|
||||
<td class="commit"><a href="{{ baseurl }}/{{ repo }}/commit/{{ blame.commit }}/">{{ blame.commit }}</a></td>
|
||||
<td class="commit"><a href="{{ path('commit', {repo: repo, commit: blame.commit}) }}">{{ blame.commit }}</a></td>
|
||||
<td><pre>{{ blame.line }}</pre></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -31,7 +22,4 @@
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-header">Branches</li>
|
||||
{% for item in branches %}
|
||||
<li><a href="{{ baseurl }}/{{ repo }}/tree/{{ item }}">{{ item }}</a></li>
|
||||
<li><a href="{{ path('branch', {repo: repo, branch: item}) }}">{{ item }}</a></li>
|
||||
{% endfor %}
|
||||
{% if tags %}
|
||||
<li class="dropdown-header">Tags</li>
|
||||
{% for item in tags %}
|
||||
<li><a href="{{ baseurl }}/{{ repo }}/tree/{{ item }}">{{ item }}</a></li>
|
||||
<li><a href="{{ path('branch', {repo: repo, branch: item}) }}">{{ item }}</a></li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
9
views/breadcrumb.twig
Normal file
9
views/breadcrumb.twig
Normal file
@@ -0,0 +1,9 @@
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{{ path('repository', {repo: repo}) }}">{{ repo }}</a></li>
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<span class="divider">/</span>
|
||||
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ path('tree', {repo: repo, branch: branch, tree: breadcrumb.path}) }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}</li>
|
||||
{% endfor %}
|
||||
|
||||
{% block extra %}{% endblock %}
|
||||
</ul>
|
||||
@@ -1,24 +1,15 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'commits' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{{ baseurl }}/{{ repo }}">{{ repo }}</a> <span class="divider">/</span></li>
|
||||
<li>Commit {{ commit.getHash}} </li>
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: "Commit #{commit.getHash}", path:''}]} %}
|
||||
|
||||
<div class="commit-view">
|
||||
<div class="commit-header">
|
||||
<span class="pull-right"><a class="btn btn-small" href="{{ baseurl }}/{{ repo }}/tree/{{ commit.getHash }}/" title="Browse code at this point in history"><i class="icon-list-alt"></i> Browse code</a></span>
|
||||
<span class="pull-right"><a class="btn btn-small" href="{{ path('branch', {repo: repo, branch: commit.getHash}) }}" title="Browse code at this point in history"><i class="icon-list-alt"></i> Browse code</a></span>
|
||||
<h4>{{ commit.getMessage }}</h4>
|
||||
</div>
|
||||
<div class="commit-body">
|
||||
@@ -39,7 +30,7 @@
|
||||
<div class="meta"><a name="{{ loop.index }}">{{ diff.getFile }}</div>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<a href="{{ baseurl }}/{{ repo }}/blob/{{ commit.getHash }}/{{ diff.getFile }}" class="btn btn-small"><i class="icon-file"></i> View file @ {{ commit.getShortHash }}</a>
|
||||
<a href="{{ path('blob', {repo: repo, branch: commit.getHash, file: diff.getFile}) }}" class="btn btn-small"><i class="icon-file"></i> View file @ {{ commit.getShortHash }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,7 +43,4 @@
|
||||
{% endfor %}
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'commits' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'branch_menu.twig' %}
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{{ baseurl }}/{{ repo }}">{{ repo }}</a> <span class="divider">/</span></li>
|
||||
<li>Commit history</li>
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Commit history', path:''}]} %}
|
||||
|
||||
{% for date, commit in commits %}
|
||||
<table class="table table-striped table-bordered">
|
||||
@@ -29,7 +19,7 @@
|
||||
<tr>
|
||||
<td width="5%"><img src="http://gravatar.com/avatar/{{ item.getAuthor.getEmail | md5 }}?s=40" /></td>
|
||||
<td width="95%">
|
||||
<span class="pull-right"><a class="btn btn-small" href="{{ baseurl }}/{{ repo }}/commit/{{ item.getShortHash }}"><i class="icon-list-alt"></i> View {{ item.getShortHash }}</a></span>
|
||||
<span class="pull-right"><a class="btn btn-small" href="{{ path('commit', {repo: repo, commit: item.getShortHash}) }}"><i class="icon-list-alt"></i> View {{ item.getShortHash }}</a></span>
|
||||
<h4>{{ item.getMessage }}</h4>
|
||||
<span><a href="mailto:{{ item.getAuthor.getEmail }}">{{ item.getAuthor.getName }}</a> authored in {{ item.getDate | date('d/m/Y \\a\\t H:i:s') }}</span>
|
||||
</td>
|
||||
@@ -53,7 +43,4 @@
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,47 +1,28 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'files' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'branch_menu.twig' %}
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ baseurl }}{{ breadcrumb.path }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}
|
||||
{%- if not loop.last -%}
|
||||
<span class="divider">/</span></li>
|
||||
{%- else -%}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}
|
||||
|
||||
<div class="source-view">
|
||||
<div class="source-header">
|
||||
<div class="meta"></div>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<a href="{{ baseurl }}/{{ repo }}/raw/{{ branch }}/{{ file }}" class="btn btn-small"><i class="icon-file"></i> Raw</a>
|
||||
<a href="{{ baseurl }}/{{ repo }}/blame/{{ branch }}/{{ file }}" class="btn btn-small"><i class="icon-bullhorn"></i> Blame</a>
|
||||
<a href="{{ baseurl }}/{{ repo }}/commits/{{ branch }}/{{ file }}" class="btn btn-small"><i class="icon-list-alt"></i> History</a>
|
||||
<a href="{{ path('blob_raw', {repo: repo, branch: branch, file: file}) }}" class="btn btn-small"><i class="icon-file"></i> Raw</a>
|
||||
<a href="{{ path('blame', {repo: repo, branch: branch, file: file}) }}" class="btn btn-small"><i class="icon-bullhorn"></i> Blame</a>
|
||||
<a href="{{ path('commits', {repo: repo, branch: branch, file: file}) }}" class="btn btn-small"><i class="icon-list-alt"></i> History</a>
|
||||
</div>
|
||||
</div>
|
||||
{% if fileType == 'image' %}
|
||||
<center><img src="{{ baseurl }}/{{ repo }}/raw/{{ branch }}/{{ file }}" alt="{{ file }}" class="image-blob" /></center>
|
||||
<center><img src="{{ path('blob_raw', {repo: repo, branch: branch, file: file}) }}" alt="{{ file }}" class="image-blob" /></center>
|
||||
{% else %}
|
||||
<pre id="sourcecode" language="{{ fileType }}">{{ blob }}</pre>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
{% for repository in repositories %}
|
||||
<div class="repository">
|
||||
<div class="repository-header">
|
||||
<i class="icon-folder-open icon-spaced"></i> <a href="{{ baseurl }}/{{ repository.name }}">{{ repository.name }}</a>
|
||||
<a href="{{ baseurl }}/{{ repository.name }}/master/rss/"><i class="rss pull-right"></i></a>
|
||||
<i class="icon-folder-open icon-spaced"></i> <a href="{{ path('repository', {repo: repository.name}) }}">{{ repository.name }}</a>
|
||||
<a href="{{ path('rss', {repo: repository.name, branch: 'master'}) }}"><i class="rss pull-right"></i></a>
|
||||
</div>
|
||||
<div class="repository-body">
|
||||
<p>{{ repository.description }}</p>
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ baseurl }}/web/css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ app.request.basepath }}/web/css/style.css">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{ baseurl }}/web/js/html5.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/html5.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
<script src="{{ baseurl }}/web/js/jquery.js"></script>
|
||||
<script src="{{ baseurl }}/web/js/bootstrap.js"></script>
|
||||
<script src="{{ baseurl }}/web/js/codemirror.js"></script>
|
||||
<script src="{{ baseurl }}/web/js/showdown.js"></script>
|
||||
<script src="{{ baseurl }}/web/js/main.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/jquery.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/bootstrap.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/codemirror.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/showdown.js"></script>
|
||||
<script src="{{ app.request.basepath }}/web/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
22
views/layout_page.twig
Normal file
22
views/layout_page.twig
Normal file
@@ -0,0 +1,22 @@
|
||||
{% extends 'layout.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% if branches is defined %}
|
||||
{% include 'branch_menu.twig' %}
|
||||
{% endif %}
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,5 +1,5 @@
|
||||
<ul class="nav nav-tabs">
|
||||
<li{% if page == 'files' %} class="active"{% endif %}><a href="{{ baseurl }}/{{ repo }}/tree/{{ branch }}">Files</a></li>
|
||||
<li{% if page == 'commits' %} class="active"{% endif %}><a href="{{ baseurl }}/{{ repo }}/commits/{{ branch }}">Commits</a></li>
|
||||
<li{% if page == 'stats' %} class="active"{% endif %}><a href="{{ baseurl }}/{{ repo }}/stats/{{ branch }}">Stats</a></li>
|
||||
</ul>
|
||||
<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 == 'stats' %} class="active"{% endif %}><a href="{{ path('stats', {repo: repo, branch: branch}) }}">Stats</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<a class="brand" href="{{ baseurl }}">GitList</a>
|
||||
<a class="brand" href="{{ path('homepage') }}">GitList</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav pull-right">
|
||||
<li><a href="http://gitlist.org/">About</a></li>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<channel>
|
||||
<title>Latest commits in {{ repo }}:{{ branch }}</title>
|
||||
<description>RSS provided by GitList</description>
|
||||
<link>{{ baseurl }}/</link>
|
||||
<link>{{ path('homepage') }}</link>
|
||||
|
||||
{% for commit in commits %}
|
||||
<item>
|
||||
<title>{{ commit.getMessage }}</title>
|
||||
<description>{{ commit.getAuthor.getName }} authored {{ commit.getShortHash }} in {{ commit.getDate | date('d/m/Y \\a\\t H:i:s') }}</description>
|
||||
<link>{{ baseurl }}/{{ repo }}/commit/{{ commit.getShortHash }}</link>
|
||||
<link>{{ path('commit', {repo: repo, commit: commit.getShortHash}) }}</link>
|
||||
<pubDate>{{ commit.getDate | date('r') }}</pubDate>
|
||||
</item>
|
||||
{% endfor %}
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'stats' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'branch_menu.twig' %}
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{{ baseurl }}/{{ repo }}">{{ repo }}</a> <span class="divider">/</span></li>
|
||||
<li>Statistics</li>
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: 'Statistics', path:''}]} %}
|
||||
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
@@ -55,7 +45,4 @@
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
{% extends 'layout.twig' %}
|
||||
{% extends 'layout_page.twig' %}
|
||||
|
||||
{% set page = 'files' %}
|
||||
|
||||
{% block title %}GitList{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% include 'navigation.twig' %}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% include 'branch_menu.twig' %}
|
||||
{% include 'menu.twig' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li{% if loop.last %} class="active"{% endif %}>{% if not loop.last %}<a href="{{ baseurl }}{{ breadcrumb.path }}">{{ breadcrumb.dir }}</a>{% endif %}{% if loop.last %}{{ breadcrumb.dir }}{% endif %}
|
||||
{%- if not loop.last -%}
|
||||
<span class="divider">/</span></li>
|
||||
{%- else -%}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
<a href="{{ baseurl }}/{{ repo }}/{{ branch }}/rss/"><i class="rss pull-right"></i></a>
|
||||
</ul>
|
||||
{% block content %}
|
||||
{% embed 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}
|
||||
{% block extra %}
|
||||
<a href="{{ path('rss', {repo: repo, branch: branch}) }}"><i class="rss pull-right"></i></a>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
<table class="tree">
|
||||
<thead>
|
||||
@@ -33,16 +20,28 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if parent is not empty %}
|
||||
{% if parent is not null %}
|
||||
<tr>
|
||||
<td><i class="icon-spaced"></i> <a href="{{ baseurl }}/{{ repo }}/tree/{{ branch }}{{ parent }}">..</a></td>
|
||||
<td><i class="icon-spaced"></i>
|
||||
{% if not parent %}
|
||||
<a href="{{ path('branch', {repo: repo, branch: branch}) }}">..</a>
|
||||
{% else %}
|
||||
<a href="{{ path('tree', {repo: repo, branch: branch, tree: parent}) }}">..</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for file in files %}
|
||||
<tr>
|
||||
<td><i class="{{ file.type == "folder" or file.type == "symlink" ? "icon-folder-open" : "icon-file" }} icon-spaced"></i> <a href="{{ baseurl }}/{{ repo }}/{{ file.type == "folder" or file.type == "symlink" ? "tree" : "blob" }}/{{ branch }}/{{ path }}{{ file.type == "symlink" ? file.path : file.name }}">{{ file.name }}</a></td>
|
||||
<td><i class="{{ file.type == "folder" or file.type == "symlink" ? "icon-folder-open" : "icon-file" }} icon-spaced"></i> <a href="
|
||||
{%- if file.type == "folder" or file.type == "symlink" %}
|
||||
{{ path('tree', {repo: repo, branch: branch, tree: path ~ (file.type == "symlink" ? file.path : file.name)}) }}
|
||||
{% else %}
|
||||
{{ path('blob', {repo: repo, branch: branch, file: path ~ (file.type == "symlink" ? file.path : file.name)}) }}
|
||||
{% endif -%}
|
||||
">{{ file.name }}</a></td>
|
||||
<td>{{ file.mode }}</td>
|
||||
<td>{% if file.size %}{{ (file.size / 1024) | number_format }} kb{% endif %}</td>
|
||||
</tr>
|
||||
@@ -57,9 +56,4 @@
|
||||
<div id="readme-content">{{ readme.content }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user