use Ox.load()
This commit is contained in:
parent
3b7b1deb32
commit
660acc06ea
2 changed files with 80 additions and 71 deletions
|
@ -10,10 +10,10 @@ if(typeof(console)=='undefined') {
|
|||
console.log = function() {};
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/js/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="/static/js/jquery/jquery.tmpl.min.js"></script>
|
||||
<script type="text/javascript" src="/static/js/jquery/jquery.videosupport.js"></script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/js/OxUI.js"></script>
|
||||
<script type="text/javascript" src="/static/oxjs/build/js/Ox.js"></script>
|
||||
<script type="text/javascript" src="/static/js/pandora.js"></script>
|
||||
<!--
|
||||
<script type="text/javascript" src="/static/js/pandora.local.js"></script> -->
|
||||
|
|
|
@ -6,80 +6,89 @@
|
|||
// fixme: sort=-director doesn't work
|
||||
// fixme: don't reload full right panel on sortSelect
|
||||
// fixme: clear items cache after login/logout
|
||||
// fixme: rename config to site (site/user is better than config/user)
|
||||
|
||||
Ox.UI(function() {
|
||||
Ox.load('UI', {
|
||||
hideScreen: false,
|
||||
showScreen: true,
|
||||
theme: 'modern'
|
||||
}, function() {
|
||||
|
||||
window.pandora = new Ox.App({url: '/api/'}).launch(function(data) {
|
||||
window.pandora = new Ox.App({url: '/api/'}).bindEvent({
|
||||
|
||||
Ox.print('Ox.App launch', data);
|
||||
load: function(event, data) {
|
||||
|
||||
$.extend(app, {
|
||||
$ui: {
|
||||
body: $('body'),
|
||||
document: $(document),
|
||||
window: $(window)
|
||||
.resize(resizeWindow)
|
||||
.unload(unloadWindow)
|
||||
},
|
||||
config: data.config,
|
||||
ui: {
|
||||
findKeys: $.map(data.config.itemKeys, function(key, i) {
|
||||
return key.find ? key : null;
|
||||
}),
|
||||
infoRatio: 16 / 9,
|
||||
sectionElement: 'buttons',
|
||||
sectionFolders: {
|
||||
site: $.merge([
|
||||
{id: 'site', title: 'Site', items: $.merge([
|
||||
{id: 'home', title: 'Home'}
|
||||
], $.merge(data.config.sitePages, [
|
||||
{id: 'software', title: 'Software'},
|
||||
{id: 'help', title: 'Help'}
|
||||
]))},
|
||||
{id: 'user', title: 'User', items: [
|
||||
{id: 'preferences', title: 'Preferences'},
|
||||
{id: 'archives', title: 'Archives'}
|
||||
]}
|
||||
], data.user.level == 'admin' ? [
|
||||
{id: 'admin', title: 'Admin', items: [
|
||||
{id: 'statistics', title: 'Statistics'},
|
||||
{id: 'users', title: 'Users'}
|
||||
]}
|
||||
] : []),
|
||||
items: [
|
||||
{id: 'personal', title: 'Personal Lists'},
|
||||
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
|
||||
{id: 'featured', title: 'Featured Lists', showBrowser: false}
|
||||
],
|
||||
},
|
||||
selectedMovies: [],
|
||||
sortKeys: $.map(data.config.itemKeys, function(key, i) {
|
||||
return key.columnWidth ? key : null;
|
||||
})
|
||||
},
|
||||
user: data.user.level == 'guest' ? $.extend({}, data.config.user) : data.user
|
||||
});
|
||||
Ox.print('Ox.App load', data);
|
||||
|
||||
$.extend(app, {
|
||||
$ui: {
|
||||
body: $('body'),
|
||||
document: $(document),
|
||||
window: $(window)
|
||||
.resize(resizeWindow)
|
||||
.unload(unloadWindow)
|
||||
},
|
||||
config: data.config,
|
||||
ui: {
|
||||
findKeys: $.map(data.config.itemKeys, function(key, i) {
|
||||
return key.find ? key : null;
|
||||
}),
|
||||
infoRatio: 16 / 9,
|
||||
sectionElement: 'buttons',
|
||||
sectionFolders: {
|
||||
site: $.merge([
|
||||
{id: 'site', title: 'Site', items: $.merge([
|
||||
{id: 'home', title: 'Home'}
|
||||
], $.merge(data.config.sitePages, [
|
||||
{id: 'software', title: 'Software'},
|
||||
{id: 'help', title: 'Help'}
|
||||
]))},
|
||||
{id: 'user', title: 'User', items: [
|
||||
{id: 'preferences', title: 'Preferences'},
|
||||
{id: 'archives', title: 'Archives'}
|
||||
]}
|
||||
], data.user.level == 'admin' ? [
|
||||
{id: 'admin', title: 'Admin', items: [
|
||||
{id: 'statistics', title: 'Statistics'},
|
||||
{id: 'users', title: 'Users'}
|
||||
]}
|
||||
] : []),
|
||||
items: [
|
||||
{id: 'personal', title: 'Personal Lists'},
|
||||
{id: 'favorite', title: 'Favorite Lists', showBrowser: false},
|
||||
{id: 'featured', title: 'Featured Lists', showBrowser: false}
|
||||
],
|
||||
},
|
||||
selectedMovies: [],
|
||||
sortKeys: $.map(data.config.itemKeys, function(key, i) {
|
||||
return key.columnWidth ? key : null;
|
||||
})
|
||||
},
|
||||
user: data.user.level == 'guest' ? $.extend({}, data.config.user) : data.user
|
||||
});
|
||||
|
||||
if (data.user.level == 'guest' && $.browser.mozilla) {
|
||||
app.user.ui.theme = 'classic'
|
||||
}
|
||||
|
||||
URL.parse();
|
||||
window.onpopstate = function() {
|
||||
URL.update();
|
||||
};
|
||||
|
||||
Ox.Theme(app.user.ui.theme);
|
||||
app.$ui.appPanel = ui.appPanel().display();
|
||||
|
||||
Ox.Request.requests() && app.$ui.loadingIcon.start();
|
||||
app.$ui.body.ajaxStart(app.$ui.loadingIcon.start);
|
||||
app.$ui.body.ajaxStop(app.$ui.loadingIcon.stop);
|
||||
|
||||
app.ui.sectionButtonsWidth = app.$ui.sectionButtons.width() + 8;
|
||||
|
||||
window.pandora.app = app;
|
||||
|
||||
if (data.user.level == 'guest' && $.browser.mozilla) {
|
||||
app.user.ui.theme = 'classic'
|
||||
}
|
||||
|
||||
URL.parse();
|
||||
window.onpopstate = function() {
|
||||
URL.update();
|
||||
};
|
||||
|
||||
Ox.theme(app.user.ui.theme);
|
||||
app.$ui.appPanel = ui.appPanel().display();
|
||||
|
||||
Ox.Request.requests() && app.$ui.loadingIcon.start();
|
||||
app.$ui.body.ajaxStart(app.$ui.loadingIcon.start);
|
||||
app.$ui.body.ajaxStop(app.$ui.loadingIcon.stop);
|
||||
|
||||
app.ui.sectionButtonsWidth = app.$ui.sectionButtons.width() + 8;
|
||||
|
||||
window.pandora.app = app;
|
||||
|
||||
});
|
||||
|
||||
var app = {
|
||||
|
@ -3430,13 +3439,13 @@ Ox.UI(function() {
|
|||
|
||||
function login(data) {
|
||||
app.user = data.user;
|
||||
Ox.theme(app.user.ui.theme);
|
||||
Ox.Theme(app.user.ui.theme);
|
||||
app.$ui.appPanel.reload();
|
||||
}
|
||||
|
||||
function logout(data) {
|
||||
app.user = data.user;
|
||||
Ox.theme(app.config.user.ui.theme);
|
||||
Ox.Theme(app.config.user.ui.theme);
|
||||
app.$ui.appPanel.reload();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue