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

45 lines
1.3 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.$body = $('body');
app.$document = $(document);
2011-02-01 15:13:30 +00:00
app.$window = $(window);
2011-01-20 08:02:03 +00:00
app.$window.resize(function() {
ITF.setSizes();
});
/*
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 = {};
/*
Ox.each(app.constructors, function(i, v) {
app.$ui[v] = app.construct[v]();
});
*/
2011-04-08 20:15:51 +00:00
var wrapper = app.construct.wrapper(data.page);
app.$body.css({'opacity': 0});
2011-02-01 15:13:30 +00:00
//FIXME: user handling should be cleaner?
if (data.user.level != 'guest') {
ITF.login(data);
}
wrapper.appendTo(app.$body);
2011-01-20 08:02:03 +00:00
ITF.setSizes();
app.$body.animate({
'opacity': 1
}, 2000);
});