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({
|
var that = Ox.Dialog({
|
||||||
buttons: [
|
buttons: [
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'cancel',
|
id: 'stay',
|
||||||
title: 'Cancel'
|
title: 'Stay Signed In'
|
||||||
}).bindEvent('click', function() {
|
}).bindEvent('click', function() {
|
||||||
that.close().remove();
|
that.close().remove();
|
||||||
pandora.URL.update();
|
pandora.URL.update();
|
||||||
|
@ -348,7 +348,7 @@ pandora.ui.accountSignoutDialog = function() {
|
||||||
),
|
),
|
||||||
fixedSize: true,
|
fixedSize: true,
|
||||||
height: 128,
|
height: 128,
|
||||||
keys: {enter: 'signout', escape: 'cancel'},
|
keys: {enter: 'signout', escape: 'stay'},
|
||||||
title: 'Sign Out',
|
title: 'Sign Out',
|
||||||
width: 304
|
width: 304
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,8 +9,8 @@ pandora.ui.deleteListDialog = function() {
|
||||||
that = Ox.Dialog({
|
that = Ox.Dialog({
|
||||||
buttons: [
|
buttons: [
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'cancel',
|
id: 'keep',
|
||||||
title: 'Cancel'
|
title: 'Keep List'
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
that.close();
|
that.close();
|
||||||
|
@ -18,7 +18,7 @@ pandora.ui.deleteListDialog = function() {
|
||||||
}),
|
}),
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'delete',
|
id: 'delete',
|
||||||
title: 'Delete'
|
title: 'Delete List'
|
||||||
}).bindEvent({
|
}).bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
that.close();
|
that.close();
|
||||||
|
@ -42,11 +42,19 @@ pandora.ui.deleteListDialog = function() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
content: $('<div>')
|
content: Ox.Element()
|
||||||
.css({margin: '16px'})
|
.append(
|
||||||
.html('Do you want to delete the list "' + listData.id + '"?'),
|
$('<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,
|
height: 128,
|
||||||
keys: {enter: 'delete', escape: 'cancel'},
|
keys: {enter: 'delete', escape: 'keep'},
|
||||||
title: 'Delete List',
|
title: 'Delete List',
|
||||||
width: 304
|
width: 304
|
||||||
});
|
});
|
||||||
|
|
|
@ -299,10 +299,8 @@ pandora.ui.folderList = function(id) {
|
||||||
pandora.$ui.listDialog = pandora.ui.listDialog('query').open();
|
pandora.$ui.listDialog = pandora.ui.listDialog('query').open();
|
||||||
}
|
}
|
||||||
} else if (data.key == 'status') {
|
} else if (data.key == 'status') {
|
||||||
pandora.api.editList({
|
var status = that.value(data.id, data.key) == 'private' ? 'public' : 'private';
|
||||||
id: data.id,
|
pandora.changeListStatus(data.id, status, function(result) {
|
||||||
status: that.value(data.id, data.key) == 'private' ? 'public' : 'private'
|
|
||||||
}, function(result) {
|
|
||||||
that.value(result.data.id, 'status', result.data.status);
|
that.value(result.data.id, 'status', result.data.status);
|
||||||
});
|
});
|
||||||
} else if (data.key == 'path') {
|
} else if (data.key == 'path') {
|
||||||
|
|
|
@ -244,10 +244,7 @@ pandora.ui.listGeneralPanel = function(listData) {
|
||||||
}
|
}
|
||||||
function editStatus(data) {
|
function editStatus(data) {
|
||||||
var status = data.selected[0].id;
|
var status = data.selected[0].id;
|
||||||
pandora.api.editList({
|
pandora.changeListStatus(listData.id, status, function(result) {
|
||||||
id: listData.id,
|
|
||||||
status: status
|
|
||||||
}, function(result) {
|
|
||||||
listData.status = result.data.status;
|
listData.status = result.data.status;
|
||||||
$subscribersInput[getSubscribersAction()]();
|
$subscribersInput[getSubscribersAction()]();
|
||||||
$descriptionInput
|
$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) {
|
pandora.clickLink = function(e) {
|
||||||
if (e.target.hostname == document.location.hostname) {
|
if (e.target.hostname == document.location.hostname) {
|
||||||
pandora.URL.push(e.target.pathname);
|
pandora.URL.push(e.target.pathname);
|
||||||
|
|
Loading…
Reference in a new issue