Adds ajax abstraction. Refactors global dependencies.

This commit is contained in:
Lars Jung 2012-07-13 17:57:02 +02:00
parent 018a574d5e
commit 64640ada83
31 changed files with 245 additions and 167 deletions

View file

@ -1,5 +1,5 @@
modulejs.define('ext/custom', ['jQuery', 'core/settings'], function ($, allsettings) {
modulejs.define('ext/custom', ['_', '$', 'core/settings', 'core/ajax'], function (_, $, allsettings, ajax) {
var defaults = {
enabled: false,
@ -16,23 +16,19 @@ modulejs.define('ext/custom', ['jQuery', 'core/settings'], function ($, allsetti
}
if (_.isString(settings.header)) {
$.ajax({
url: settings.header,
dataType: 'html',
success: function (data) {
ajax.getHtml(settings.header, function (html) {
$('<div id="content-header">' + data + '</div>').prependTo('#content');
if (html) {
$('<div id="content-header">' + html + '</div>').prependTo('#content');
}
});
}
if (_.isString(settings.footer)) {
$.ajax({
url: settings.footer,
dataType: 'html',
success: function (data) {
ajax.getHtml(settings.footer, function (html) {
$('<div id="content-footer">' + data + '</div>').appendTo('#content');
if (html) {
$('<div id="content-footer">' + html + '</div>').appendTo('#content');
}
});
}