From 04a2e41bc6b5119de99fe081ab8f79ce522c64d4 Mon Sep 17 00:00:00 2001 From: rlx Date: Wed, 13 Jan 2016 12:16:21 +0530 Subject: [PATCH] update app dialog, remove dead code --- static/js/appDialog.js | 117 +++++++++++------------------------------ 1 file changed, 31 insertions(+), 86 deletions(-) diff --git a/static/js/appDialog.js b/static/js/appDialog.js index ebb311f..0f881ff 100644 --- a/static/js/appDialog.js +++ b/static/js/appDialog.js @@ -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; $('') .attr({ src: '/static/png/oml.png' @@ -34,80 +51,8 @@ oml.ui.appDialog = function() { height: '192px' }) .appendTo($logo); - if (id == 'update') { - var titleHTML = '

' + title + '

' - $content.html(titleHTML); - oml.api.getVersion(function(response) { - if (response.data.update) { - if (response.data.current == 'git') { - $content.html( - titleHTML - + '

' - + Ox._('A newer version of Open Media Library is available in git.') - + '

' - + Ox._('To update run:') - + ' ./ctl update' - ); - } else { - $content.html( - titleHTML - + '

' - + Ox._('You are running Open Media Library version {0}.', [response.data.current]) - + '

' - + Ox._('A newer version is available.') - + '

' - ); - 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 - + '

' - + Ox._('You are up to date.') - + '

' - ); - } else { - $content.html( - titleHTML - + '

' - + Ox._('You are running Open Media Library version {0}.', [response.data.current]) - + '

' - + Ox._('You are up to date.') - + '

' - ); - } - } - }); - } else { - $content.html('

' + title + '

' - + '

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('

' + title + '

' + + '

The lazy brown fox jumped over the lazy black fox, but other than that not really much happened here since you last checked.'); $('

') .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}); } }),