forked from 0x2620/pandora
add dialog when making a list private that has subscribers
This commit is contained in:
parent
f1482834a1
commit
71e0ab278c
5 changed files with 47 additions and 18 deletions
|
@ -319,8 +319,8 @@ pandora.ui.accountSignoutDialog = function() {
|
|||
var that = Ox.Dialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'cancel',
|
||||
title: 'Cancel'
|
||||
id: 'stay',
|
||||
title: 'Stay Signed In'
|
||||
}).bindEvent('click', function() {
|
||||
that.close().remove();
|
||||
pandora.URL.update();
|
||||
|
@ -348,7 +348,7 @@ pandora.ui.accountSignoutDialog = function() {
|
|||
),
|
||||
fixedSize: true,
|
||||
height: 128,
|
||||
keys: {enter: 'signout', escape: 'cancel'},
|
||||
keys: {enter: 'signout', escape: 'stay'},
|
||||
title: 'Sign Out',
|
||||
width: 304
|
||||
});
|
||||
|
|
|
@ -9,8 +9,8 @@ pandora.ui.deleteListDialog = function() {
|
|||
that = Ox.Dialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'cancel',
|
||||
title: 'Cancel'
|
||||
id: 'keep',
|
||||
title: 'Keep List'
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
|
@ -18,7 +18,7 @@ pandora.ui.deleteListDialog = function() {
|
|||
}),
|
||||
Ox.Button({
|
||||
id: 'delete',
|
||||
title: 'Delete'
|
||||
title: 'Delete List'
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
|
@ -42,11 +42,19 @@ pandora.ui.deleteListDialog = function() {
|
|||
}
|
||||
})
|
||||
],
|
||||
content: $('<div>')
|
||||
.css({margin: '16px'})
|
||||
.html('Do you want to delete the list "' + listData.id + '"?'),
|
||||
content: Ox.Element()
|
||||
.append(
|
||||
$('<img>')
|
||||
.attr({src: '/static/png/icon64.png'})
|
||||
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
|
||||
)
|
||||
.append(
|
||||
$('<div>')
|
||||
.css({position: 'absolute', left: '96px', top: '16px', width: '192px'})
|
||||
.html('Are you sure you want to delete the list "' + listData.id + '"?')
|
||||
),
|
||||
height: 128,
|
||||
keys: {enter: 'delete', escape: 'cancel'},
|
||||
keys: {enter: 'delete', escape: 'keep'},
|
||||
title: 'Delete List',
|
||||
width: 304
|
||||
});
|
||||
|
|
|
@ -299,10 +299,8 @@ pandora.ui.folderList = function(id) {
|
|||
pandora.$ui.listDialog = pandora.ui.listDialog('query').open();
|
||||
}
|
||||
} else if (data.key == 'status') {
|
||||
pandora.api.editList({
|
||||
id: data.id,
|
||||
status: that.value(data.id, data.key) == 'private' ? 'public' : 'private'
|
||||
}, function(result) {
|
||||
var status = that.value(data.id, data.key) == 'private' ? 'public' : 'private';
|
||||
pandora.changeListStatus(data.id, status, function(result) {
|
||||
that.value(result.data.id, 'status', result.data.status);
|
||||
});
|
||||
} else if (data.key == 'path') {
|
||||
|
|
|
@ -244,10 +244,7 @@ pandora.ui.listGeneralPanel = function(listData) {
|
|||
}
|
||||
function editStatus(data) {
|
||||
var status = data.selected[0].id;
|
||||
pandora.api.editList({
|
||||
id: listData.id,
|
||||
status: status
|
||||
}, function(result) {
|
||||
pandora.changeListStatus(listData.id, status, function(result) {
|
||||
listData.status = result.data.status;
|
||||
$subscribersInput[getSubscribersAction()]();
|
||||
$descriptionInput
|
||||
|
|
|
@ -136,6 +136,32 @@ pandora.addList = function() {
|
|||
}
|
||||
};
|
||||
|
||||
pandora.changeListStatus = function(id, status, callback) {
|
||||
if (status == 'private') {
|
||||
pandora.api.findLists({
|
||||
query: {conditions: [{key: 'id', value: id, operator: '=='}]},
|
||||
keys: ['subscribers']
|
||||
}, function(result) {
|
||||
var subscribers = result.data.items[0].subscribers;
|
||||
if (subscribers) {
|
||||
pandora.ui.makeListPrivateDialog(subscribers, function(makePrivate) {
|
||||
makePrivate && changeListStatus();
|
||||
}).open();
|
||||
} else {
|
||||
changeListStatus();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
changeListStatus();
|
||||
}
|
||||
function changeListStatus() {
|
||||
pandora.api.editList({
|
||||
id: is,
|
||||
status: status
|
||||
}, callback);
|
||||
}
|
||||
};
|
||||
|
||||
pandora.clickLink = function(e) {
|
||||
if (e.target.hostname == document.location.hostname) {
|
||||
pandora.URL.push(e.target.pathname);
|
||||
|
|
Loading…
Reference in a new issue