-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1035 from streamaserver/1.9.2
1.9.3
- Loading branch information
Showing
39 changed files
with
486 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ buildscript { | |
} | ||
} | ||
|
||
version "1.9.1" | ||
version "1.9.3" | ||
group "streama" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
grails-app/assets/javascripts/streama/directives/streama-dash-media-item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
//= wrapped | ||
|
||
angular.module('streama').directive('streamaDashMediaItem', function () { | ||
return { | ||
restrict: 'E', | ||
templateUrl: '/streama/directive--streama-dash-media-item.htm', | ||
scope: { | ||
entity: '=' | ||
}, | ||
bindToController: true, | ||
controllerAs: 'vm', | ||
controller: controller | ||
} | ||
}); | ||
|
||
function controller(apiService, modalService, $rootScope, $state, $scope) { | ||
var vm = this; | ||
vm.fetchFirstEpisodeAndPlay = fetchFirstEpisodeAndPlay; | ||
vm.showDetails = showDetails; | ||
vm.handleWatchlistUpdate = handleWatchlistUpdate; | ||
vm.markCompleted = markCompleted; | ||
|
||
$scope.$on('video.markAsUnviewed', onVideoMarkAsUnviewed); | ||
|
||
function fetchFirstEpisodeAndPlay(tvShow) { | ||
apiService.dash.firstEpisodeForShow(tvShow.id).then(function (response) { | ||
$state.go('player', {videoId: response.data.id}); | ||
}); | ||
} | ||
|
||
function showDetails(media) { | ||
if(media.mediaType === 'episode'){ | ||
modalService.mediaDetailModal({mediaId: media.tvShowId, mediaType: 'tvShow', isApiMovie: false}); | ||
}else{ | ||
modalService.mediaDetailModal({mediaId: media.id, mediaType: media.mediaType, isApiMovie: false}, function (response) { | ||
$rootScope.$broadcast('video.updateWatchlist', {response: response, media: media}); | ||
}); | ||
} | ||
} | ||
|
||
function handleWatchlistUpdate(action, item){ | ||
switch (action) { | ||
case "added": | ||
addToWatchlist(item); | ||
break; | ||
case "removed": | ||
removeFromWatchlist(item); | ||
break; | ||
} | ||
} | ||
|
||
function addToWatchlist(item) { | ||
apiService.watchlistEntry.create(item).then(function (response) { | ||
$rootScope.$broadcast('video.updateWatchlist', {action: 'added', response: response, media: item}); | ||
}); | ||
} | ||
|
||
function removeFromWatchlist(item) { | ||
alertify.set({buttonReverse: true, labels: {ok: "Yes", cancel: "Cancel"}}); | ||
alertify.confirm("Are you sure you want to remove this video from your watchlist?", function (confirmed) { | ||
if (confirmed) { | ||
apiService.watchlistEntry.delete(item).then(function (response) { | ||
$rootScope.$broadcast('video.updateWatchlist', {action: 'removed', media: item}); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
function markCompleted() { | ||
alertify.set({buttonReverse: true, labels: {ok: "Yes", cancel: "Cancel"}}); | ||
alertify.confirm("Are you sure you want to mark this video as completed?", function (confirmed) { | ||
if (confirmed) { | ||
apiService.video.markCompleted({id: vm.entity.id}).then(function (data) { | ||
vm.entity.deleted = true; | ||
}); | ||
} | ||
}) | ||
} | ||
|
||
function onVideoMarkAsUnviewed(e, data) { | ||
if(data.id === vm.entity.id){ | ||
vm.entity.status = 'unviewed'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.