Refactor.

This commit is contained in:
Lars Jung 2014-06-14 01:12:00 +02:00
parent ca816a5745
commit d6cef5c787
2 changed files with 34 additions and 41 deletions

View File

@ -2,14 +2,15 @@
modulejs.define('info', ['$', 'config'], function ($, config) {
var template = '<li class="test">' +
'<span class="label"></span>' +
'<span class="result"></span>' +
'<div class="info"></div>' +
'</li>',
'<span class="label"></span>' +
'<span class="result"></span>' +
'<div class="info"></div>' +
'</li>',
$tests = $('#tests'),
setup = config.setup,
$tests = $("#tests"),
addTestResult = function (label, info, passed, result) {
addTest = function (label, info, passed, result) {
$(template)
.find('.label')
@ -25,66 +26,58 @@ modulejs.define('info', ['$', 'config'], function ($, config) {
.appendTo($tests);
},
init = function () {
addTests = function () {
var setup = config.setup;
$('.idx-file .value').text(setup.INDEX_HREF);
addTestResult(
'PHP version',
'PHP version &gt;= 5.3.0',
setup.HAS_PHP_VERSION,
setup.PHP_VERSION
addTest(
'PHP version', 'PHP version &gt;= 5.3.0',
setup.HAS_PHP_VERSION, setup.PHP_VERSION
);
addTestResult(
'Cache directory',
'Web server has write access',
addTest(
'Cache directory', 'Web server has write access',
setup.HAS_WRITABLE_CACHE
);
addTestResult(
'Image thumbs',
'PHP GD extension with JPEG support available',
addTest(
'Image thumbs', 'PHP GD extension with JPEG support available',
setup.HAS_PHP_JPG
);
addTestResult(
'Use EXIF thumbs',
'PHP EXIF extension available',
addTest(
'Use EXIF thumbs', 'PHP EXIF extension available',
setup.HAS_PHP_EXIF
);
addTestResult(
'Movie thumbs',
'Command line program <code>ffmpeg</code> or <code>avconv</code> available',
addTest(
'Movie thumbs', 'Command line program <code>ffmpeg</code> or <code>avconv</code> available',
setup.HAS_CMD_FFMPEG || setup.HAS_CMD_AVCONV
);
addTestResult(
'PDF thumbs',
'Command line program <code>convert</code> available',
addTest(
'PDF thumbs', 'Command line program <code>convert</code> available',
setup.HAS_CMD_CONVERT
);
addTestResult(
'Shell tar',
'Command line program <code>tar</code> available',
addTest(
'Shell tar', 'Command line program <code>tar</code> available',
setup.HAS_CMD_TAR
);
addTestResult(
'Shell zip',
'Command line program <code>zip</code> available',
addTest(
'Shell zip', 'Command line program <code>zip</code> available',
setup.HAS_CMD_ZIP
);
addTestResult(
'Folder sizes',
'Command line program <code>du</code> available',
addTest(
'Folder sizes', 'Command line program <code>du</code> available',
setup.HAS_CMD_DU
);
},
init = function () {
$('.idx-file .value').text(setup.INDEX_HREF);
addTests();
};
init();

View File

@ -20,7 +20,7 @@ html.no-js.browser( lang="en" )
body#h5ai-info
h1
a( href="http://larsjung.de/h5ai/" ) {{pkg.name}}
a( href="{{pkg.url}}" ) {{pkg.name}}
span.build-version version {{pkg.version}}
span.build-stamp {{stamp}}
span.idx-file Index: