From fa7b385892f94ebf317d67c90daa588f9c0f2c27 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 19 Nov 2014 18:31:06 +0000 Subject: [PATCH] update entitiesDialog --- static/js/entitiesDialog.js | 40 ++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/static/js/entitiesDialog.js b/static/js/entitiesDialog.js index 94974c81..c84160ba 100644 --- a/static/js/entitiesDialog.js +++ b/static/js/entitiesDialog.js @@ -79,8 +79,12 @@ pandora.ui.entitiesDialog = function(options) { }) .bindEvent({ init: function(data) { - // FIXME: not localized - $listStatus.html(Ox.formatCount(data.items, 'entity', 'entities')) + var text = Ox.formatCount( + data.items, + Ox._('entity'), + Ox._('entities') + ) + $listStatus.html(text[0].toUpperCase() + text.slice(1)); } }), @@ -117,7 +121,7 @@ pandora.ui.entitiesDialog = function(options) { $itemMenu = Ox.MenuButton({ items: [ {'id': 'add', title: Ox._('Add Entity'), keyboard: 'control n'}, - {'id': 'delete', title: Ox._('Delete Entity'), keyboard: 'delete'} + {'id': 'delete', title: Ox._('Delete Entity...'), keyboard: 'delete'} ], title: 'set', tooltip: Ox._('Options'), @@ -130,15 +134,41 @@ pandora.ui.entitiesDialog = function(options) { .bindEvent({ click: function(data) { if (data.id == 'add') { - // ... + pandora.api.addEntity({}, function(result) { + Ox.print('$$$$', result); + Ox.Request.clearCache('findEntities'); + $list.reloadList().options({ + selected: [result.data.id] + }); + }) } else if (data.id == 'delete') { // ... } } }), + $deselectButton = Ox.Button({ + title: 'close' + tooltip: Ox._('Done'), + type: 'image' + }) + .css({ + float: 'right', + margin: '4px' + }) + .hide() + .bindEvent({ + click: function() { + pandora.UI.set({ + 'entitiesSelection.' + type, + [] + }); + } + }) + $itemBar = Ox.Bar({size: 24}) - .append($itemMenu), + .append($itemMenu) + .append($deselectButton), $itemStatus = Ox.Element() .css({