forked from 0x2620/pandora
add page titles; various bugfixes related to urls
This commit is contained in:
parent
f031041dcf
commit
c14effdf9c
5 changed files with 27 additions and 23 deletions
|
@ -34,7 +34,7 @@ pandora.UI = (function() {
|
||||||
Ox.print('UI SET', args)
|
Ox.print('UI SET', args)
|
||||||
self.previousUI = Ox.clone(pandora.user.ui, true);
|
self.previousUI = Ox.clone(pandora.user.ui, true);
|
||||||
Ox.forEach(args, function(val, key) {
|
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,
|
// the challenge here is that find may change list,
|
||||||
// and list may then change listSort and listView,
|
// and list may then change listSort and listView,
|
||||||
// which we don't want to trigger, since find triggers
|
// which we don't want to trigger, since find triggers
|
||||||
|
|
|
@ -326,6 +326,7 @@ pandora.URL = (function() {
|
||||||
self.isPopState = true;
|
self.isPopState = true;
|
||||||
if (!Ox.isEmpty(e.state)) {
|
if (!Ox.isEmpty(e.state)) {
|
||||||
Ox.print('E.STATE', e.state)
|
Ox.print('E.STATE', e.state)
|
||||||
|
document.title = e.state.title;
|
||||||
setState(e.state);
|
setState(e.state);
|
||||||
} else {
|
} else {
|
||||||
that.parse();
|
that.parse();
|
||||||
|
@ -357,7 +358,7 @@ pandora.URL = (function() {
|
||||||
// pushes a new URL (as string or from state)
|
// pushes a new URL (as string or from state)
|
||||||
that.push = function(url) {
|
that.push = function(url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
self.URL.push(null, '', url, setState);
|
self.URL.push(null, pandora.getPageTitle(), url, setState);
|
||||||
} else {
|
} else {
|
||||||
// fixme
|
// fixme
|
||||||
//alert('DO YOU REALLY WANT TO CALL PUSH WITHOUT URL?')
|
//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)
|
// replaces the current URL (as string or from state)
|
||||||
that.replace = function(url) {
|
that.replace = function(url) {
|
||||||
if (url) {
|
if (url) {
|
||||||
self.URL.replace(null, '', url, setState)
|
self.URL.replace(null, pandora.getPageTitle(), url, setState)
|
||||||
} else {
|
} else {
|
||||||
self.URL.replace(getState());
|
self.URL.replace(getState());
|
||||||
}
|
}
|
||||||
|
@ -396,11 +397,11 @@ pandora.URL = (function() {
|
||||||
return /^videoPoints/.test(key);
|
return /^videoPoints/.test(key);
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
action = 'replace'
|
action = 'replace';
|
||||||
} else {
|
} else {
|
||||||
action = 'push'
|
action = 'push';
|
||||||
}
|
}
|
||||||
self.URL[action](getState(), 'title', getState(keys));
|
self.URL[action](getState(), pandora.getPageTitle(), getState(keys));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ pandora.ui.item = function() {
|
||||||
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
|
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
|
||||||
|
|
||||||
if (result.status.code == 200) {
|
if (result.status.code == 200) {
|
||||||
// fixme: probably does not belong here
|
document.title = pandora.getPageTitle(result.data.title);
|
||||||
document.title = '0xDB - ' + Ox.stripTags(result.data.title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (result.status.code != 200) {
|
/*if (result.status.code != 200) {
|
||||||
|
|
|
@ -2,21 +2,7 @@
|
||||||
|
|
||||||
pandora.ui.rightPanel = function() {
|
pandora.ui.rightPanel = function() {
|
||||||
var that;
|
var that;
|
||||||
if (pandora.user.ui.section == 'site') {
|
if (pandora.user.ui.section == 'items') {
|
||||||
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') {
|
|
||||||
that = Ox.SplitPanel({
|
that = Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -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) {
|
pandora._getSortOperator = function(type) {
|
||||||
return ['hue', 'string', 'text'].indexOf(
|
return ['hue', 'string', 'text'].indexOf(
|
||||||
Ox.isArray(type) ? type[0] : type
|
Ox.isArray(type) ? type[0] : type
|
||||||
|
|
Loading…
Reference in a new issue