it/itf/static/js/itf/app.js
2011-10-08 03:03:05 -04:00

54 lines
1.4 KiB
JavaScript
Executable File

var app = new Ox.App({
apiURL: '/api/',
init: 'init',
config: 'site.json' //FIXME: shouldn't need this, get data with 'hello' or 'init'.
});
app.launch(function(data) {
Ox.theme("classic");
Ox.print(data);
/*
app.user = data.user;
app.config = data.config;
*/
/*
//FIXME: should this be a nested structure as their representation on the page?
app.constructors = ['wrapper', 'headerPanel', 'mainPanel', 'leftPanel', 'cityPicker', 'calendarBox', 'currentEventsList', 'middlePanel', 'middleTopPanel', 'newsfeedBox', 'aboutBox', 'itfBox', 'middleBottomPanel', 'erangBox', 'scriptArchiveBox', 'bestPracticesBox', 'biblioBox', 'offersNeedsBox', 'surveysBox', 'rightPanel', 'searchBox', 'loginBox', 'previewBox', 'footerPanel']
*/
app.$ui = {};
app.$body = $('body');
app.$document = $(document);
app.$window = $(window);
/*
Ox.each(app.constructors, function(i, v) {
app.$ui[v] = app.construct[v]();
});
*/
// Ox.print("BOO", data);
app.api.getPage({}, function(data) {
var wrapper = app.construct.wrapper(data.data);
app.$body.css({'opacity': 0});
//FIXME: user handling should be cleaner?
wrapper.appendTo(app.$body);
/*
if (data.user.level != 'guest') {
ITF.login(data);
}
*/
/*
app.$window.resize(function() {
ITF.setSizes();
});
ITF.setSizes();
*/
app.$body.animate({
'opacity': 1
}, 2000);
});
});