it/itf/static/js/itf/app.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

var app = new Ox.App({
apiURL: '/api/',
2011-02-01 15:13:30 +00:00
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);
2011-02-01 15:13:30 +00:00
/*
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']
*/
2011-04-10 02:00:43 +00:00
app.$ui = {};
2011-04-10 02:00:43 +00:00
app.$body = $('body');
app.$document = $(document);
app.$window = $(window);
/*
Ox.each(app.constructors, function(i, v) {
app.$ui[v] = app.construct[v]();
});
*/
2011-04-10 02:00:43 +00:00
// 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);
});
});