fix bugs with dialogs that represent multiple URLs, and history
This commit is contained in:
parent
9752b2e332
commit
f93fd49bd7
6 changed files with 58 additions and 60 deletions
|
@ -75,7 +75,7 @@ pandora.URL = (function() {
|
||||||
Ox.getPositionById(pandora.site.sitePages, state.page) > -1
|
Ox.getPositionById(pandora.site.sitePages, state.page) > -1
|
||||||
|| state.page == 'software'
|
|| state.page == 'software'
|
||||||
) {
|
) {
|
||||||
if (pandora.$ui.siteDialog) {
|
if (pandora.$ui.siteDialog && pandora.$ui.siteDialog.is(':visible')) {
|
||||||
pandora.$ui.siteDialog.select(state.page);
|
pandora.$ui.siteDialog.select(state.page);
|
||||||
} else {
|
} else {
|
||||||
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
|
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
|
||||||
|
@ -84,7 +84,11 @@ pandora.URL = (function() {
|
||||||
pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
|
pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
|
||||||
} else if (['signup', 'signin'].indexOf(state.page) > -1) {
|
} else if (['signup', 'signin'].indexOf(state.page) > -1) {
|
||||||
if (pandora.user.level == 'guest') {
|
if (pandora.user.level == 'guest') {
|
||||||
|
if (pandora.$ui.accountDialog && pandora.$ui.accountDialog.is(':visible')) {
|
||||||
|
pandora.$ui.accountDialog.options(pandora.ui.accountDialogOptions(state.page));
|
||||||
|
} else {
|
||||||
pandora.$ui.accountDialog = pandora.ui.accountDialog(state.page).open();
|
pandora.$ui.accountDialog = pandora.ui.accountDialog(state.page).open();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pandora.URL.replace('/');
|
pandora.URL.replace('/');
|
||||||
}
|
}
|
||||||
|
@ -270,15 +274,17 @@ pandora.URL = (function() {
|
||||||
Ox.Request.cancel();
|
Ox.Request.cancel();
|
||||||
self.isPopState = true;
|
self.isPopState = true;
|
||||||
$('.OxDialog:visible').each(function() {
|
$('.OxDialog:visible').each(function() {
|
||||||
Ox.UI.elements[$(this).data('oxid')].close().remove();
|
Ox.UI.elements[$(this).data('oxid')].close();
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
pandora.user.ui.item
|
pandora.user.ui.item
|
||||||
&& pandora.user.ui.itemView == 'video'
|
&& pandora.user.ui.itemView == 'video'
|
||||||
|
&& pandora.$ui.player
|
||||||
&& pandora.$ui.player.options('fullscreen')
|
&& pandora.$ui.player.options('fullscreen')
|
||||||
) {
|
) {
|
||||||
|
pandora.$ui.player.remove();
|
||||||
//pandora.$ui.player.options({fullscreen: false});
|
//pandora.$ui.player.options({fullscreen: false});
|
||||||
$('body > .OxVideoPlayer').remove();
|
//$('body > .OxVideoPlayer').remove();
|
||||||
}
|
}
|
||||||
if (!Ox.isEmpty(e.state)) {
|
if (!Ox.isEmpty(e.state)) {
|
||||||
Ox.Log('', 'E.STATE', e.state)
|
Ox.Log('', 'E.STATE', e.state)
|
||||||
|
@ -311,24 +317,26 @@ 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(stateOrURL) {
|
||||||
if (url) {
|
var state, title = pandora.getPageTitle(), url;
|
||||||
self.URL.push(null, pandora.getPageTitle(), url, setState);
|
if (Ox.isObject(stateOrURL)) {
|
||||||
|
state = stateOrURL;
|
||||||
} else {
|
} else {
|
||||||
// fixme
|
url = stateOrURL;
|
||||||
//alert('DO YOU REALLY WANT TO CALL PUSH WITHOUT URL?')
|
|
||||||
//self.URL.push(getState());
|
|
||||||
}
|
}
|
||||||
|
self.URL.push(state, title, url, setState);
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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(stateOrURL) {
|
||||||
if (url) {
|
var state, title = pandora.getPageTitle(), url;
|
||||||
self.URL.replace(null, pandora.getPageTitle(), url, setState)
|
if (Ox.isObject(stateOrURL)) {
|
||||||
|
state = stateOrURL;
|
||||||
} else {
|
} else {
|
||||||
self.URL.replace(getState());
|
url = stateOrURL;
|
||||||
}
|
}
|
||||||
|
self.URL.replace(state, title, url, setState);
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -360,7 +368,7 @@ pandora.URL = (function() {
|
||||||
action = 'push';
|
action = 'push';
|
||||||
}
|
}
|
||||||
state = getState();
|
state = getState();
|
||||||
self.URL[action](state, pandora.getPageTitle(), state);
|
self.URL[action](state, pandora.getPageTitle(), '');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ pandora.ui.accountDialog = function(action) {
|
||||||
fixedSize: true,
|
fixedSize: true,
|
||||||
height: 192,
|
height: 192,
|
||||||
id: 'accountDialog',
|
id: 'accountDialog',
|
||||||
|
removeOnClose: true,
|
||||||
width: 432
|
width: 432
|
||||||
}, pandora.ui.accountDialogOptions(action)))
|
}, pandora.ui.accountDialogOptions(action)))
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
@ -56,7 +57,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
||||||
id: 'cancel' + Ox.toTitleCase(action),
|
id: 'cancel' + Ox.toTitleCase(action),
|
||||||
title: 'Cancel'
|
title: 'Cancel'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
pandora.$ui.accountDialog.close().remove();
|
pandora.$ui.accountDialog.close();
|
||||||
pandora.URL.update();
|
pandora.URL.update();
|
||||||
});
|
});
|
||||||
} else if (type == 'submit') {
|
} else if (type == 'submit') {
|
||||||
|
@ -72,13 +73,12 @@ pandora.ui.accountDialogOptions = function(action, value) {
|
||||||
id: type,
|
id: type,
|
||||||
title: buttonTitle[type] + '...'
|
title: buttonTitle[type] + '...'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
pandora.$ui.accountDialog.options(pandora.ui.accountDialogOptions(type));
|
|
||||||
pandora.$ui.accountForm.find('input')[0].focus();
|
|
||||||
if (['signin', 'signup'].indexOf(type) > -1) {
|
if (['signin', 'signup'].indexOf(type) > -1) {
|
||||||
// fixme: similar problem as in siteDialog,
|
pandora.URL.replace({page: type});
|
||||||
// the URL controller should handle this
|
} else {
|
||||||
history.replaceState({}, '', '/' + type);
|
pandora.$ui.accountDialog.options(pandora.ui.accountDialogOptions(type));
|
||||||
}
|
}
|
||||||
|
pandora.$ui.accountForm.find('input.OxInput')[0].focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ pandora.ui.accountForm = function(action, value) {
|
||||||
if (action == 'signin') {
|
if (action == 'signin') {
|
||||||
pandora.api.signin(data, function(result) {
|
pandora.api.signin(data, function(result) {
|
||||||
if (!result.data.errors) {
|
if (!result.data.errors) {
|
||||||
pandora.$ui.accountDialog.close().remove();
|
pandora.$ui.accountDialog.close();
|
||||||
pandora.signin(result.data);
|
pandora.signin(result.data);
|
||||||
} else {
|
} else {
|
||||||
pandora.$ui.accountDialog.enableButtons();
|
pandora.$ui.accountDialog.enableButtons();
|
||||||
|
@ -157,7 +157,7 @@ pandora.ui.accountForm = function(action, value) {
|
||||||
} else if (action == 'signup') {
|
} else if (action == 'signup') {
|
||||||
pandora.api.signup(data, function(result) {
|
pandora.api.signup(data, function(result) {
|
||||||
if (!result.data.errors) {
|
if (!result.data.errors) {
|
||||||
pandora.$ui.accountDialog.close().remove();
|
pandora.$ui.accountDialog.close();
|
||||||
pandora.signin(result.data);
|
pandora.signin(result.data);
|
||||||
pandora.ui.accountWelcomeDialog().open();
|
pandora.ui.accountWelcomeDialog().open();
|
||||||
} else {
|
} else {
|
||||||
|
@ -181,7 +181,7 @@ pandora.ui.accountForm = function(action, value) {
|
||||||
} else if (action == 'resetAndSignin') {
|
} else if (action == 'resetAndSignin') {
|
||||||
pandora.api.resetPassword(data, function(result) {
|
pandora.api.resetPassword(data, function(result) {
|
||||||
if (!result.data.errors) {
|
if (!result.data.errors) {
|
||||||
pandora.$ui.accountDialog.close().remove();
|
pandora.$ui.accountDialog.close();
|
||||||
pandora.signin(result.data);
|
pandora.signin(result.data);
|
||||||
} else {
|
} else {
|
||||||
pandora.$ui.accountDialog.enableButtons();
|
pandora.$ui.accountDialog.enableButtons();
|
||||||
|
@ -318,14 +318,14 @@ pandora.ui.accountSignoutDialog = function() {
|
||||||
id: 'stay',
|
id: 'stay',
|
||||||
title: 'Stay Signed In'
|
title: 'Stay Signed In'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
that.close().remove();
|
that.close();
|
||||||
pandora.URL.update();
|
pandora.URL.update();
|
||||||
}),
|
}),
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'signout',
|
id: 'signout',
|
||||||
title: 'Sign Out'
|
title: 'Sign Out'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
that.close().remove();
|
that.close();
|
||||||
pandora.api.signout({}, function(result) {
|
pandora.api.signout({}, function(result) {
|
||||||
pandora.signout(result.data);
|
pandora.signout(result.data);
|
||||||
});
|
});
|
||||||
|
@ -345,6 +345,7 @@ pandora.ui.accountSignoutDialog = function() {
|
||||||
fixedSize: true,
|
fixedSize: true,
|
||||||
height: 128,
|
height: 128,
|
||||||
keys: {enter: 'signout', escape: 'stay'},
|
keys: {enter: 'signout', escape: 'stay'},
|
||||||
|
removeOnClose: true,
|
||||||
title: 'Sign Out',
|
title: 'Sign Out',
|
||||||
width: 304
|
width: 304
|
||||||
});
|
});
|
||||||
|
@ -358,7 +359,7 @@ pandora.ui.accountWelcomeDialog = function() {
|
||||||
id: 'preferences',
|
id: 'preferences',
|
||||||
title: 'Preferences...'
|
title: 'Preferences...'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
that.close().remove();
|
that.close();
|
||||||
pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open();
|
pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open();
|
||||||
}),
|
}),
|
||||||
{},
|
{},
|
||||||
|
@ -366,7 +367,7 @@ pandora.ui.accountWelcomeDialog = function() {
|
||||||
id: 'close',
|
id: 'close',
|
||||||
title: 'Close'
|
title: 'Close'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
that.close().remove();
|
that.close();
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
content: Ox.Element()
|
content: Ox.Element()
|
||||||
|
@ -383,6 +384,7 @@ pandora.ui.accountWelcomeDialog = function() {
|
||||||
fixedSize: true,
|
fixedSize: true,
|
||||||
height: 128,
|
height: 128,
|
||||||
keys: {enter: 'close', escape: 'close'},
|
keys: {enter: 'close', escape: 'close'},
|
||||||
|
removeOnClose: true,
|
||||||
title: 'Welcome to ' + pandora.site.site.name,
|
title: 'Welcome to ' + pandora.site.site.name,
|
||||||
width: 304
|
width: 304
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,10 +9,8 @@ pandora.ui.helpDialog = function() {
|
||||||
title: 'Close'
|
title: 'Close'
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
that.close().remove();
|
that.close();
|
||||||
//fixme: this should be using URL.push / UI.set
|
pandora.URL.update();
|
||||||
//but that currenlty causes a reload
|
|
||||||
history.pushState({}, '', '/');
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|
|
@ -94,7 +94,7 @@ pandora.ui.listDialog = function(section) {
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
$dialog.close().remove();
|
$dialog.close();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@ -104,6 +104,7 @@ pandora.ui.listDialog = function(section) {
|
||||||
minWidth: width,
|
minWidth: width,
|
||||||
height: 312,
|
height: 312,
|
||||||
// keys: {enter: 'save', escape: 'cancel'},
|
// keys: {enter: 'save', escape: 'cancel'},
|
||||||
|
removeOnClose: true,
|
||||||
title: 'List - ' + listData.name,
|
title: 'List - ' + listData.name,
|
||||||
width: width
|
width: width
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
pandora.ui.siteDialog = function(section) {
|
pandora.ui.siteDialog = function(section) {
|
||||||
|
|
||||||
var tabs = Ox.merge(
|
var tabs = Ox.merge(
|
||||||
Ox.clone(pandora.site.sitePages),
|
Ox.clone(pandora.site.sitePages, true),
|
||||||
[{id: 'software', title: 'Software'}]
|
[{id: 'software', title: 'Software'}]
|
||||||
);
|
);
|
||||||
//Ox.getObjectById(tabs, section).selected = true;
|
Ox.getObjectById(tabs, section).selected = true;
|
||||||
tabs[Ox.getPositionById(tabs, section)].selected = true;
|
|
||||||
//Ox.print('SITE DIALOG', section, Ox.getObjectById(tabs, section), Ox.getObjectById(tabs, section).selected)
|
|
||||||
var $tabPanel = Ox.TabPanel({
|
var $tabPanel = Ox.TabPanel({
|
||||||
content: function(id) {
|
content: function(id) {
|
||||||
var $content = Ox.Element().css({padding: '16px', overflowY: 'auto'});
|
var $content = Ox.Element().css({padding: '16px', overflowY: 'auto'});
|
||||||
|
@ -82,8 +80,6 @@ pandora.ui.siteDialog = function(section) {
|
||||||
+ 'Legal Action</div>'
|
+ 'Legal Action</div>'
|
||||||
)
|
)
|
||||||
.appendTo($column);
|
.appendTo($column);
|
||||||
})
|
|
||||||
pandora.site.rightsLevels.forEach(function(rightsLevel) {
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -113,34 +109,34 @@ pandora.ui.siteDialog = function(section) {
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
$dialog.options({
|
that.options({
|
||||||
title: Ox.getObjectById(tabs, data.selected).title
|
title: Ox.getObjectById(tabs, data.selected).title
|
||||||
});
|
});
|
||||||
//pandora.URL.replace('/' + data.selected);
|
pandora.URL.push({page: data.selected});
|
||||||
//fixme: this should be using URL.push / UI.set
|
//history.pushState({page: data.selected}, '', '/' + data.selected);
|
||||||
//but that currenlty causes another dialog to be opened
|
|
||||||
history.pushState({/*page: data.selected*/}, '', '/' + data.selected);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var $dialog = Ox.Dialog({
|
|
||||||
|
var that = Ox.Dialog({
|
||||||
buttons: [
|
buttons: [
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'close',
|
id: 'close',
|
||||||
title: 'Close'
|
title: 'Close'
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
$dialog.close().remove();
|
that.close();
|
||||||
pandora.URL.update();
|
pandora.URL.update();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
//closeButton: true,
|
closeButton: true,
|
||||||
content: $tabPanel,
|
content: $tabPanel,
|
||||||
height: Math.round((window.innerHeight - 24) * 0.75),
|
height: Math.round((window.innerHeight - 24) * 0.75),
|
||||||
//maximizeButton: true,
|
maximizeButton: true,
|
||||||
minHeight: 256,
|
minHeight: 256,
|
||||||
minWidth: 688, // 16 + 256 + 16 + 384 + 16
|
minWidth: 688, // 16 + 256 + 16 + 384 + 16
|
||||||
title: 'About',
|
removeOnClose: true,
|
||||||
|
title: Ox.getObjectById(tabs, section).title,
|
||||||
width: Math.round(window.innerWidth * 0.75),
|
width: Math.round(window.innerWidth * 0.75),
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
@ -151,11 +147,11 @@ pandora.ui.siteDialog = function(section) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$dialog.select = function(id) {
|
that.select = function(id) {
|
||||||
$tabPanel.select(id);
|
$tabPanel.select(id);
|
||||||
return $dialog;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
return $dialog;
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -856,15 +856,9 @@ pandora.resizeFolders = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.resizeWindow = function() {
|
pandora.resizeWindow = function() {
|
||||||
|
// FIXME: a lot of this throws errors on load
|
||||||
pandora.$ui.leftPanel.size(2, pandora.getInfoHeight(true));
|
pandora.$ui.leftPanel.size(2, pandora.getInfoHeight(true));
|
||||||
pandora.resizeFolders();
|
pandora.resizeFolders();
|
||||||
/*
|
|
||||||
var infoHeight = pandora.getInfoHeight(true);
|
|
||||||
pandora.$ui.leftPanel.size(2, infoHeight);
|
|
||||||
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
|
|
||||||
pandora.resizeFolders();
|
|
||||||
pandora.$ui.info.resizeInfo();
|
|
||||||
*/
|
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
pandora.resizeFilters(pandora.$ui.rightPanel.width());
|
pandora.resizeFilters(pandora.$ui.rightPanel.width());
|
||||||
if (pandora.user.ui.listView == 'clips') {
|
if (pandora.user.ui.listView == 'clips') {
|
||||||
|
@ -893,7 +887,6 @@ pandora.resizeWindow = function() {
|
||||||
pandora.$ui.list.size();
|
pandora.$ui.list.size();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Ox.Log('', 'pandora.$ui.window.resize');
|
|
||||||
pandora.$ui.browser.scrollToSelection();
|
pandora.$ui.browser.scrollToSelection();
|
||||||
if (pandora.user.ui.itemView == 'info') {
|
if (pandora.user.ui.itemView == 'info') {
|
||||||
pandora.$ui.item.resize();
|
pandora.$ui.item.resize();
|
||||||
|
|
Loading…
Reference in a new issue