From 6dfa62681af03eebfbe64de6ee2681626c074fc1 Mon Sep 17 00:00:00 2001 From: rlx Date: Mon, 18 Jan 2016 16:21:07 +0530 Subject: [PATCH] update info view buttons --- static/js/infoView.js | 62 ++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/static/js/infoView.js b/static/js/infoView.js index 0721cf6..086efd4 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -253,29 +253,59 @@ oml.ui.infoView = function(externalData, isMixed) { ], float: 'right' }) - : Ox.Button({ - style: 'squared', - title: Ox._('Read Book'), - width: 128 - }) - .bindEvent({ - click: function() { - oml.UI.set({itemView: 'book'}); - } + : Ox.FormElementGroup({ + elements: [ + Ox.Button({ + style: 'squared', + title: Ox._('Read Book'), + width: 112 + }) + .bindEvent({ + click: function() { + oml.UI.set({itemView: 'book'}); + } + }), + Ox.MenuButton({ + items: [ + {id: 'read', title: Ox._('Read in Open Media Libary')}, + {id: 'open', title: Ox._('Open in External Reader')}, + {}, + {id: 'show', title: Ox._('Show File')} + ], + overlap: 'left', + style: 'squared', + title: 'select', + tooltip: Ox._('Download Book to a List'), + type: 'image' + }) + .bindEvent({ + click: function(data_) { + if (data_.id == 'read') { + oml.UI.set({itemView: 'book'}); + } else if (data_.id == 'open') { + // ... + } else { + oml.api.openFolder({id: oml.user.ui.item}); + } + } + }) + ], + float: 'right' }); return $element; } - function renderOpenButton() { - return Ox.Button({ + function renderShareButton() { + return Ox.Checkbox({ style: 'squared', - title: Ox._('Open Folder'), - width: 128 + title: Ox._('Share Metadata'), + value: false, + width: 128, }) .css({marginTop: '8px'}) .bindEvent({ - click: function() { - oml.api.openFolder({id: oml.user.ui.item}); + change: function(data) { + // ... } }); } @@ -734,7 +764,7 @@ oml.ui.infoView = function(externalData, isMixed) { }); if (data.mediastate == 'available') { - renderOpenButton().appendTo($data); + renderShareButton().appendTo($data); } $('
').css({height: '16px'}).appendTo($data);