Remove version from settings.

This commit is contained in:
Lars Jung 2015-05-14 14:50:51 +02:00
parent 95f087cfd6
commit 17b5d4dfaa
7 changed files with 28 additions and 31 deletions

View file

@ -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',

View file

@ -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
});
});

View file

@ -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 <code>' + setup.INDEX_HREF + '</code> to your index file list',
setup.INDEX_HREF

View file

@ -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 =
'<div id="topbar">' +
'<div id="toolbar"/>' +
'<div id="flowbar"/>' +
'<a id="backlink" href="http://larsjung.de/h5ai/" title="powered by h5ai ' + settings.version + '">' +
'<a id="backlink" href="http://larsjung.de/h5ai/" title="powered by h5ai - http://larsjung.de/h5ai/">' +
'<div>powered</div>' +
'<div>by h5ai</div>' +
'</a>' +

View file

@ -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);
});
});
});
}());

View file

@ -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();

View file

@ -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 () {