add new sharing function
This commit is contained in:
parent
d1842ae4e3
commit
c8eb5f2b0c
14 changed files with 504 additions and 8 deletions
59
dashboard-ui/scripts/sharingmanager.js
Normal file
59
dashboard-ui/scripts/sharingmanager.js
Normal file
|
@ -0,0 +1,59 @@
|
|||
(function () {
|
||||
|
||||
function onSharingSuccess(options) {
|
||||
|
||||
console.log('share success. shareId: ' + options.share.Id);
|
||||
|
||||
}
|
||||
|
||||
function onSharingCancel(options) {
|
||||
|
||||
var shareId = options.share.Id;
|
||||
|
||||
console.log('share cancelled. shareId: ' + shareId);
|
||||
|
||||
// Delete the share since it was cancelled
|
||||
ApiClient.ajax({
|
||||
|
||||
type: 'DELETE',
|
||||
url: ApiClient.getUrl('Social/Shares/' + shareId)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function showMenu(userId, itemId) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
require(['sharingwidget'], function () {
|
||||
|
||||
ApiClient.ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('Social/Shares', {
|
||||
|
||||
ItemId: itemId,
|
||||
UserId: userId
|
||||
}),
|
||||
dataType: "json"
|
||||
|
||||
}).done(function (share) {
|
||||
|
||||
var options = {
|
||||
share: share
|
||||
};
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
SharingWidget.showMenu(options, onSharingSuccess, onSharingCancel);
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
window.SharingManager = {
|
||||
showMenu: showMenu
|
||||
};
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue