diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 47d00c3a..b96e91e8 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -34,7 +34,7 @@ pandora.UI = (function() { Ox.print('UI SET', args) self.previousUI = Ox.clone(pandora.user.ui, true); Ox.forEach(args, function(val, key) { - if (key == 'find') { + if (key == 'find' && !Ox.isEqual(val, pandora.user.ui.find)) { // the challenge here is that find may change list, // and list may then change listSort and listView, // which we don't want to trigger, since find triggers diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index f7043b40..3e40923e 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -326,6 +326,7 @@ pandora.URL = (function() { self.isPopState = true; if (!Ox.isEmpty(e.state)) { Ox.print('E.STATE', e.state) + document.title = e.state.title; setState(e.state); } else { that.parse(); @@ -357,7 +358,7 @@ pandora.URL = (function() { // pushes a new URL (as string or from state) that.push = function(url) { if (url) { - self.URL.push(null, '', url, setState); + self.URL.push(null, pandora.getPageTitle(), url, setState); } else { // fixme //alert('DO YOU REALLY WANT TO CALL PUSH WITHOUT URL?') @@ -369,7 +370,7 @@ pandora.URL = (function() { // replaces the current URL (as string or from state) that.replace = function(url) { if (url) { - self.URL.replace(null, '', url, setState) + self.URL.replace(null, pandora.getPageTitle(), url, setState) } else { self.URL.replace(getState()); } @@ -396,11 +397,11 @@ pandora.URL = (function() { return /^videoPoints/.test(key); }) ) { - action = 'replace' + action = 'replace'; } else { - action = 'push' + action = 'push'; } - self.URL[action](getState(), 'title', getState(keys)); + self.URL[action](getState(), pandora.getPageTitle(), getState(keys)); } }; diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index fbba0ce8..9bd8a271 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -10,8 +10,7 @@ pandora.ui.item = function() { }, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) { if (result.status.code == 200) { - // fixme: probably does not belong here - document.title = '0xDB - ' + Ox.stripTags(result.data.title); + document.title = pandora.getPageTitle(result.data.title); } /*if (result.status.code != 200) { diff --git a/static/js/pandora/ui/rightPanel.js b/static/js/pandora/ui/rightPanel.js index fea39f55..347c2192 100644 --- a/static/js/pandora/ui/rightPanel.js +++ b/static/js/pandora/ui/rightPanel.js @@ -2,21 +2,7 @@ pandora.ui.rightPanel = function() { var that; - if (pandora.user.ui.section == 'site') { - if (pandora.user.ui.sitePage == 'home') { - that = pandora.ui.homePage() - .bindEvent({ - resize: function(data) { - that.resize(); - } - }); - } else { - that = Ox.Element().css({padding: '8px'}); - pandora.api.getPage(pandora.user.ui.sitePage, function(result) { - that.html(result.data.body).css({overflowY: 'auto'}); - }); - } - } else if (pandora.user.ui.section == 'items') { + if (pandora.user.ui.section == 'items') { that = Ox.SplitPanel({ elements: [ { diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 859decdf..89b655b9 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -562,6 +562,24 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) { } }; +(function() { + var itemTitles = {}; + pandora.getPageTitle = function(itemTitle) { + if (itemTitle) { + itemTitles[pandora.user.ui.item] = itemTitle + } + var parts = [pandora.site.site.name]; + if (!pandora.user.ui.item) { + pandora.user.ui._list && parts.push('List ' + pandora.user.ui._list); + parts.push(Ox.toTitleCase(pandora.user.ui.listView) + ' View'); + } else { + parts.push(itemTitles[pandora.user.ui.item] || pandora.user.ui.item); + parts.push(Ox.toTitleCase(pandora.user.ui.itemView) + ' View'); + } + return parts.join(' - '); + }; +}()); + pandora._getSortOperator = function(type) { return ['hue', 'string', 'text'].indexOf( Ox.isArray(type) ? type[0] : type