use Ox.load()
This commit is contained in:
parent
6be17d935d
commit
772774e330
2 changed files with 80 additions and 71 deletions
|
@ -10,10 +10,10 @@ if(typeof(console)=='undefined') {
|
||||||
console.log = function() {};
|
console.log = function() {};
|
||||||
}
|
}
|
||||||
</script>
|
</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.tmpl.min.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/jquery/jquery.videosupport.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.js"></script>
|
||||||
<!--
|
<!--
|
||||||
<script type="text/javascript" src="/static/js/pandora.local.js"></script> -->
|
<script type="text/javascript" src="/static/js/pandora.local.js"></script> -->
|
||||||
|
|
|
@ -6,80 +6,89 @@
|
||||||
// fixme: sort=-director doesn't work
|
// fixme: sort=-director doesn't work
|
||||||
// fixme: don't reload full right panel on sortSelect
|
// fixme: don't reload full right panel on sortSelect
|
||||||
// fixme: clear items cache after login/logout
|
// 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, {
|
Ox.print('Ox.App load', data);
|
||||||
$ui: {
|
|
||||||
body: $('body'),
|
$.extend(app, {
|
||||||
document: $(document),
|
$ui: {
|
||||||
window: $(window)
|
body: $('body'),
|
||||||
.resize(resizeWindow)
|
document: $(document),
|
||||||
.unload(unloadWindow)
|
window: $(window)
|
||||||
},
|
.resize(resizeWindow)
|
||||||
config: data.config,
|
.unload(unloadWindow)
|
||||||
ui: {
|
},
|
||||||
findKeys: $.map(data.config.itemKeys, function(key, i) {
|
config: data.config,
|
||||||
return key.find ? key : null;
|
ui: {
|
||||||
}),
|
findKeys: $.map(data.config.itemKeys, function(key, i) {
|
||||||
infoRatio: 16 / 9,
|
return key.find ? key : null;
|
||||||
sectionElement: 'buttons',
|
}),
|
||||||
sectionFolders: {
|
infoRatio: 16 / 9,
|
||||||
site: $.merge([
|
sectionElement: 'buttons',
|
||||||
{id: 'site', title: 'Site', items: $.merge([
|
sectionFolders: {
|
||||||
{id: 'home', title: 'Home'}
|
site: $.merge([
|
||||||
], $.merge(data.config.sitePages, [
|
{id: 'site', title: 'Site', items: $.merge([
|
||||||
{id: 'software', title: 'Software'},
|
{id: 'home', title: 'Home'}
|
||||||
{id: 'help', title: 'Help'}
|
], $.merge(data.config.sitePages, [
|
||||||
]))},
|
{id: 'software', title: 'Software'},
|
||||||
{id: 'user', title: 'User', items: [
|
{id: 'help', title: 'Help'}
|
||||||
{id: 'preferences', title: 'Preferences'},
|
]))},
|
||||||
{id: 'archives', title: 'Archives'}
|
{id: 'user', title: 'User', items: [
|
||||||
]}
|
{id: 'preferences', title: 'Preferences'},
|
||||||
], data.user.level == 'admin' ? [
|
{id: 'archives', title: 'Archives'}
|
||||||
{id: 'admin', title: 'Admin', items: [
|
]}
|
||||||
{id: 'statistics', title: 'Statistics'},
|
], data.user.level == 'admin' ? [
|
||||||
{id: 'users', title: 'Users'}
|
{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},
|
items: [
|
||||||
{id: 'featured', title: 'Featured Lists', showBrowser: false}
|
{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;
|
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
|
})
|
||||||
});
|
},
|
||||||
|
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 = {
|
var app = {
|
||||||
|
@ -3430,13 +3439,13 @@ Ox.UI(function() {
|
||||||
|
|
||||||
function login(data) {
|
function login(data) {
|
||||||
app.user = data.user;
|
app.user = data.user;
|
||||||
Ox.theme(app.user.ui.theme);
|
Ox.Theme(app.user.ui.theme);
|
||||||
app.$ui.appPanel.reload();
|
app.$ui.appPanel.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout(data) {
|
function logout(data) {
|
||||||
app.user = data.user;
|
app.user = data.user;
|
||||||
Ox.theme(app.config.user.ui.theme);
|
Ox.Theme(app.config.user.ui.theme);
|
||||||
app.$ui.appPanel.reload();
|
app.$ui.appPanel.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue