From 08f7b1856cfab44015b90a5eaba41a814fa433e2 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 20 Nov 2014 13:37:02 +0000 Subject: [PATCH] update pandora.getPart --- static/js/utils.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/static/js/utils.js b/static/js/utils.js index 8665720a0..f3e3a0b3e 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1472,8 +1472,7 @@ pandora.getPart = function(state, str, callback) { callback(); } } else if (state.page == 'documents') { - var split = str.split('/')[0], - id = split; + var id = str.split('/')[0]; if (id) { pandora.api.findDocuments({ query: { @@ -1493,6 +1492,26 @@ pandora.getPart = function(state, str, callback) { state.page = ''; callback(); } + } else if (state.page == 'entities') { + var id = str; + if (id) { + pandora.api.findEntities({ + query: { + conditions: [{key: 'id', value: id, operator: '=='}], + operator: '&' + } + }, function(result) { + if (result.data.items) { + state.part = str; + } else { + state.page = ''; + } + callback(); + }); + } else { + state.page = ''; + callback(); + } } else { callback(); }