1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

use common sharing manager

This commit is contained in:
Luke Pulverenti 2016-04-27 22:46:41 -04:00
parent 190f70bb71
commit 3657bdf7b7
10 changed files with 80 additions and 79 deletions

View file

@ -16,12 +16,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.2.50",
"_release": "1.2.50",
"version": "1.2.51",
"_release": "1.2.51",
"_resolution": {
"type": "version",
"tag": "1.2.50",
"commit": "b58b3517bb892e0cde54a8a5f5bf318248f0eb13"
"tag": "1.2.51",
"commit": "0de31178ecd029314513167a880a1cf645140917"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View file

@ -378,7 +378,7 @@
.guideChannelName {
margin-left: auto;
margin-right: 1em;
max-width: 50%;
max-width: 40%;
text-overflow: ellipsis;
overflow: hidden;
}

View file

@ -0,0 +1,60 @@
define(['connectionManager', 'sharingMenu', 'loading'], function (connectionManager, sharingMenu, loading) {
function onSharingSuccess(options) {
console.log('share success. shareId: ' + options.share.Id);
}
function onSharingCancel(options, apiClient) {
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(apiClient, itemId) {
loading.show();
var userId = apiClient.getCurrentUserId();
return apiClient.getItem(userId, itemId).then(function () {
return apiClient.ajax({
type: 'POST',
url: apiClient.getUrl('Social/Shares', {
ItemId: itemId,
UserId: userId
}),
dataType: "json"
}).then(function (share) {
var options = {
share: share
};
loading.hide();
sharingMenu.showMenu(options, onSharingSuccess, function (options) {
onSharingCancel(options, apiClient);
});
}, function () {
loading.hide();
});
});
}
return {
showMenu: showMenu
};
});