update app dialog, remove dead code
This commit is contained in:
parent
299a63b529
commit
04a2e41bc6
1 changed files with 31 additions and 86 deletions
|
@ -4,13 +4,33 @@ oml.ui.appDialog = function() {
|
|||
|
||||
var ui = oml.user.ui,
|
||||
|
||||
tabs = Ox.getObjectById(oml.config.pages, 'app').parts.map(function(tab) {
|
||||
return {
|
||||
id: tab.id,
|
||||
title: tab.title,
|
||||
selected: tab.id == ui.part.app
|
||||
};
|
||||
}),
|
||||
tabs = [
|
||||
{
|
||||
id: 'about',
|
||||
title: Ox._('About Open Media Library'),
|
||||
selected: ui.page == 'about'
|
||||
},
|
||||
{
|
||||
id: 'faq',
|
||||
title: Ox._('Frequently Asked Questions'),
|
||||
selected: ui.page == 'faq'
|
||||
},
|
||||
{
|
||||
id: 'terms',
|
||||
title: Ox._('Terms and Conditions'),
|
||||
selected: ui.page == 'terms'
|
||||
},
|
||||
{
|
||||
id: 'development',
|
||||
title: Ox._('Software Development'),
|
||||
selected: ui.page == 'development'
|
||||
},
|
||||
{
|
||||
id: 'contact',
|
||||
title: Ox._('Send Feedback'),
|
||||
selected: ui.page == 'contact'
|
||||
}
|
||||
],
|
||||
|
||||
$panel = Ox.TabPanel({
|
||||
content: function(id) {
|
||||
|
@ -18,10 +38,7 @@ oml.ui.appDialog = function() {
|
|||
$logo = Ox.Element(),
|
||||
$text = Ox.Element()
|
||||
.addClass('OxTextPage OxSelectable'),
|
||||
title = Ox._(Ox.getObjectById(
|
||||
Ox.getObjectById(oml.config.pages, 'app').parts,
|
||||
id
|
||||
).title);
|
||||
title = Ox.getObjectById(tabs, id).title;
|
||||
$('<img>')
|
||||
.attr({
|
||||
src: '/static/png/oml.png'
|
||||
|
@ -34,80 +51,8 @@ oml.ui.appDialog = function() {
|
|||
height: '192px'
|
||||
})
|
||||
.appendTo($logo);
|
||||
if (id == 'update') {
|
||||
var titleHTML = '<h1><b>' + title + '</b></h1>'
|
||||
$content.html(titleHTML);
|
||||
oml.api.getVersion(function(response) {
|
||||
if (response.data.update) {
|
||||
if (response.data.current == 'git') {
|
||||
$content.html(
|
||||
titleHTML
|
||||
+ '<p>'
|
||||
+ Ox._('A newer version of Open Media Library is available in git.')
|
||||
+ '</p><p>'
|
||||
+ Ox._('To update run:')
|
||||
+ ' <code>./ctl update</code>'
|
||||
);
|
||||
} else {
|
||||
$content.html(
|
||||
titleHTML
|
||||
+ '<p>'
|
||||
+ Ox._('You are running Open Media Library version {0}.', [response.data.current])
|
||||
+ '</p><p>'
|
||||
+ Ox._('A newer version is available.')
|
||||
+ '</p>'
|
||||
);
|
||||
Ox.Button({
|
||||
id: 'update',
|
||||
title: Ox._('Install Now'),
|
||||
width: 128
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
var _this = this;
|
||||
this.options({
|
||||
disabled: true,
|
||||
title: Ox._('Downloading...')
|
||||
});
|
||||
oml.isRelaunching = true;
|
||||
oml.api.restart({update: true}, function(response) {
|
||||
if (response.status.code == 200) {
|
||||
_this.options({
|
||||
title: Ox._('Installing...')
|
||||
});
|
||||
setTimeout(reload, 500);
|
||||
} else {
|
||||
_this.options({
|
||||
title: Ox._('Download failed...')
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).appendTo($content);
|
||||
}
|
||||
} else {
|
||||
if (response.data.current == 'git') {
|
||||
$content.html(
|
||||
titleHTML
|
||||
+ '<p>'
|
||||
+ Ox._('You are up to date.')
|
||||
+ '</p>'
|
||||
);
|
||||
} else {
|
||||
$content.html(
|
||||
titleHTML
|
||||
+ '<p>'
|
||||
+ Ox._('You are running Open Media Library version {0}.', [response.data.current])
|
||||
+ '</p><p>'
|
||||
+ Ox._('You are up to date.')
|
||||
+ '</p>'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$content.html('<h1><b>' + title + '</b></h1>'
|
||||
+ '<p>The lazy brown fox jumped over the lazy black fox, but other than that not really much happened here since you last checked.');
|
||||
}
|
||||
$content.html('<h1><b>' + title + '</b></h1>'
|
||||
+ '<p>The lazy brown fox jumped over the lazy black fox, but other than that not really much happened here since you last checked.');
|
||||
$('<div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
|
@ -136,7 +81,7 @@ oml.ui.appDialog = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
change: function(data) {
|
||||
oml.UI.set({'part.app': data.selected});
|
||||
oml.UI.set({page: data.selected});
|
||||
}
|
||||
}),
|
||||
|
||||
|
|
Loading…
Reference in a new issue