diff --git a/src/_h5ai/backend/php/core/class-setup.php b/src/_h5ai/backend/php/core/class-setup.php index 0054930d..e21fcf5e 100644 --- a/src/_h5ai/backend/php/core/class-setup.php +++ b/src/_h5ai/backend/php/core/class-setup.php @@ -147,12 +147,13 @@ class Setup { $keys = [ 'PUBLIC_HREF', - 'ROOT_HREF', - 'VERSION' + 'ROOT_HREF' ]; if ($as_admin) { $keys = array_merge($keys, [ + 'VERSION', + 'PHP_VERSION', 'MIN_PHP_VERSION', 'HAS_PHP_EXIF', diff --git a/src/_h5ai/public/js/inc/core/settings.js b/src/_h5ai/public/js/inc/core/settings.js index b8106b79..2b5aa0f7 100644 --- a/src/_h5ai/public/js/inc/core/settings.js +++ b/src/_h5ai/public/js/inc/core/settings.js @@ -2,7 +2,6 @@ modulejs.define('core/settings', ['_', 'config'], function (_, config) { return _.extend({}, config.options, { publicHref: config.setup.PUBLIC_HREF, - rootHref: config.setup.ROOT_HREF, - version: config.setup.VERSION + rootHref: config.setup.ROOT_HREF }); }); diff --git a/src/_h5ai/public/js/inc/main/info.js b/src/_h5ai/public/js/inc/main/info.js index 506a71ad..b2ee6804 100644 --- a/src/_h5ai/public/js/inc/main/info.js +++ b/src/_h5ai/public/js/inc/main/info.js @@ -44,6 +44,10 @@ modulejs.define('main/info', ['$', 'config', 'core/resource', 'core/server'], fu function addTests() { + if (!setup.AS_ADMIN) { + return; + } + $(tplTests).appendTo('#content'); addTest( @@ -51,13 +55,6 @@ modulejs.define('main/info', ['$', 'config', 'core/resource', 'core/server'], fu /^\d+\.\d+\.\d+$/.test(setup.VERSION), setup.VERSION ); - if (setup.AS_ADMIN) { - addAdminTests(); - } - } - - function addAdminTests() { - addTest( 'Index file found', 'Add ' + setup.INDEX_HREF + ' to your index file list', setup.INDEX_HREF diff --git a/src/_h5ai/public/js/inc/view/topbar.js b/src/_h5ai/public/js/inc/view/topbar.js index f8cb4981..a490decd 100644 --- a/src/_h5ai/public/js/inc/view/topbar.js +++ b/src/_h5ai/public/js/inc/view/topbar.js @@ -1,10 +1,10 @@ -modulejs.define('view/topbar', ['$', 'core/settings', 'view/root'], function ($, settings, root) { +modulejs.define('view/topbar', ['$', 'view/root'], function ($, root) { var tplTopbar = '
' + '
' + '
' + - '' + + '' + '
powered
' + '
by h5ai
' + '
' + diff --git a/test/tests/unit/core/settings.js b/test/tests/unit/core/settings.js index 0e088047..c34a6061 100644 --- a/test/tests/unit/core/settings.js +++ b/test/tests/unit/core/settings.js @@ -18,8 +18,7 @@ describe('module \'' + ID + '\'', function () { }, setup: { PUBLIC_HREF: util.uniqId(), - ROOT_HREF: util.uniqId(), - VERSION: util.uniqId() + ROOT_HREF: util.uniqId() } }; this.applyFn = function () { @@ -79,7 +78,7 @@ describe('module \'' + ID + '\'', function () { assert.strictEqual(instance.someOptions, this.xConfig.options.someOptions); assert.strictEqual(instance.otherOptions, this.xConfig.options.otherOptions); assert.strictEqual(instance.more, this.xConfig.options.more); - assert.strictEqual(_.keys(instance).length, _.keys(this.xConfig.options).length + 3); + assert.strictEqual(_.keys(instance).length, _.keys(this.xConfig.options).length + 2); }); }); @@ -100,15 +99,6 @@ describe('module \'' + ID + '\'', function () { assert.strictEqual(instance.rootHref, this.xConfig.setup.ROOT_HREF); }); }); - - describe('.version', function () { - - it('set correct', function () { - - var instance = this.applyFn(); - assert.strictEqual(instance.version, this.xConfig.setup.VERSION); - }); - }); }); }()); diff --git a/test/tests/unit/main/info.js b/test/tests/unit/main/info.js index be7c83a5..9a9e8bff 100644 --- a/test/tests/unit/main/info.js +++ b/test/tests/unit/main/info.js @@ -2,7 +2,7 @@ 'use strict'; var ID = 'main/info'; -var DEPS = ['$', 'config', 'core/server']; +var DEPS = ['$', 'config', 'core/resource', 'core/server']; describe('module \'' + ID + '\'', function () { @@ -16,6 +16,9 @@ describe('module \'' + ID + '\'', function () { }, options: {} }; + this.xResource = { + image: sinon.stub() + }; this.xServer = { request: sinon.stub() }; @@ -24,7 +27,7 @@ describe('module \'' + ID + '\'', function () { this.xServer.request.reset(); - return this.definition.fn($, this.xConfig, this.xServer); + return this.definition.fn($, this.xConfig, this.xResource, this.xServer); }; }); @@ -80,6 +83,14 @@ describe('module \'' + ID + '\'', function () { assert.isUndefined(instance); }); + it('adds HTML #support to #content', function () { + + this.applyFn(); + assert.lengthOf($('#content > #support'), 1); + assert.lengthOf($('#support > .paypal'), 1); + assert.lengthOf($('.paypal > form'), 1); + }); + it('adds HTML #login-wrapper to #content', function () { this.applyFn(); diff --git a/test/tests/unit/view/topbar.js b/test/tests/unit/view/topbar.js index a673b743..1ece11ef 100644 --- a/test/tests/unit/view/topbar.js +++ b/test/tests/unit/view/topbar.js @@ -2,7 +2,7 @@ 'use strict'; var ID = 'view/topbar'; -var DEPS = ['$', 'core/settings', 'view/root']; +var DEPS = ['$', 'view/root']; describe('module \'' + ID + '\'', function () { @@ -10,11 +10,10 @@ describe('module \'' + ID + '\'', function () { this.definition = modulejs._private.definitions[ID]; - this.xSettings = {version: util.uniqId()}; this.xRoot = {$el: null}; this.applyFn = function () { - return this.definition.fn($, this.xSettings, this.xRoot); + return this.definition.fn($, this.xRoot); }; }); @@ -104,7 +103,7 @@ describe('module \'' + ID + '\'', function () { it('#backlink has correct title', function () { this.applyFn(); - assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai ' + this.xSettings.version); + assert.strictEqual($('#backlink').attr('title'), 'powered by h5ai - http://larsjung.de/h5ai/'); }); it('#backlink has correct text', function () {