diff options
author | Juha Sippola <juhasippola@outlook.com> | 2015-07-01 15:43:17 +0300 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@theqtcompany.com> | 2015-09-16 07:31:58 +0000 |
commit | 5a2c85839bfb064c7d8faa79ee2d00bb51458e87 (patch) | |
tree | 1faf9323a3e5e684e2f099e781c8326b64967acd /non-puppet/qtmetrics2/index.php | |
parent | 29dc3651a96dfeecc7e356aa642dc76684b481f2 (diff) |
Qt Metrics 2 (v0.5): Twig template engine
Applied Twig template engine.
The php files in templates replaced with html files
with Twig syntax (no content changes).
Change-Id: I7582f0bb8e55a203f6fe3a5ab200ffb7aec789ec
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
Diffstat (limited to 'non-puppet/qtmetrics2/index.php')
-rw-r--r-- | non-puppet/qtmetrics2/index.php | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php index 8d77195..c17924b 100644 --- a/non-puppet/qtmetrics2/index.php +++ b/non-puppet/qtmetrics2/index.php @@ -34,20 +34,25 @@ /** * Qt Metrics API - * @version 0.3 - * @since 16-06-2015 + * @version 0.4 + * @since 18-06-2015 * @author Juha Sippola */ -require 'src/Factory.php'; -require 'lib/Slim/Slim/Slim.php'; +require_once 'src/Factory.php'; +require_once 'lib/Slim/Slim/Slim.php'; +require_once 'lib/Slim/Slim/View.php'; +require_once 'lib/Slim/Slim/Views/Twig.php'; +require_once 'lib/Twig/lib/Twig/Autoloader.php'; \Slim\Slim::registerAutoloader(); -$app = new \Slim\Slim(array( +Twig_Autoloader::register(); + +$app = new Slim\Slim(array( + 'view' => new Slim\Views\Twig(), 'templates.path' => 'templates' )); - /** * UI route: / (GET) */ @@ -55,7 +60,8 @@ $app = new \Slim\Slim(array( $app->get('/', function() use($app) { $ini = Factory::conf(); - $app->render('home.php', array( + $app->render('home.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'overviewRoute' => Slim\Slim::getInstance()->urlFor('root') . 'overview', 'branchRoute' => Slim\Slim::getInstance()->urlFor('root') . 'branch', 'platformRoute' => Slim\Slim::getInstance()->urlFor('root') . 'platform', @@ -82,7 +88,8 @@ $app->get('/test/top', function() use($app) $breadcrumb = array( array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); - $app->render('testsets_top.php', array( + $app->render('testsets_top.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset', 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', @@ -110,7 +117,8 @@ $app->get('/test/flaky', function() use($app) $breadcrumb = array( array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); - $app->render('testsets_flaky.php', array( + $app->render('testsets_flaky.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset', 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', @@ -136,20 +144,22 @@ $app->get('/testset/:testset', function($testset) use($app) array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); if (Factory::checkTestset($testset)) { - $app->render('testset.php', array( + $app->render('testset.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', 'lastDaysFailures' => $ini['top_failures_last_days'], 'lastDaysFlaky' => $ini['flaky_testsets_last_days'], 'masterProject' => $ini['master_build_project'], 'masterState' => $ini['master_build_state'], - 'testset' => Factory::createTestset( + 'testsets' => Factory::createTestset( $testset, $ini['master_build_project'], $ini['master_build_state']) // managed as objects )); } else { - $app->render('empty.php', array( + $app->render('empty.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'message' => '404 Not Found' )); $app->response()->status(404); |