Browse Source

Video modal forward and delete

master
Igor Zhukov 11 years ago
parent
commit
950ecd0d1d
  1. 28
      app/js/controllers.js
  2. 5
      app/js/services.js
  3. 4
      app/partials/message.html

28
app/js/controllers.js

@ -990,8 +990,34 @@ angular.module('myApp.controllers', [])
}) })
.controller('VideoModalController', function ($scope, AppVideoManager) { .controller('VideoModalController', function ($scope, $rootScope, $modalInstance, PeersSelectService, AppMessagesManager, AppVideoManager, AppPeersManager, ErrorService) {
$scope.video = AppVideoManager.wrapForFull($scope.videoID); $scope.video = AppVideoManager.wrapForFull($scope.videoID);
$scope.progress = {enabled: false};
$scope.player = {};
$scope.forward = function () {
var messageID = $scope.messageID;
PeersSelectService.selectPeer().then(function (peerString) {
var peerID = AppPeersManager.getPeerID(peerString);
AppMessagesManager.forwardMessages(peerID, [messageID]).then(function () {
$rootScope.$broadcast('history_focus', {peerString: peerString});
});
});
};
$scope.delete = function () {
var messageID = $scope.messageID;
ErrorService.confirm({type: 'MESSAGE_DELETE'}).then(function () {
AppMessagesManager.deleteMessages([messageID]);
});
};
$scope.$on('history_delete', function (e, historyUpdate) {
if (historyUpdate.msgs[$scope.messageID]) {
$modalInstance.dismiss();
}
});
}) })
.controller('UserModalController', function ($scope, $location, $rootScope, $modal, AppUsersManager, NotificationsManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) { .controller('UserModalController', function ($scope, $location, $rootScope, $modal, AppUsersManager, NotificationsManager, AppMessagesManager, AppPeersManager, PeersSelectService, ErrorService) {

5
app/js/services.js

@ -2185,11 +2185,10 @@ angular.module('myApp.services', [])
return video; return video;
} }
function openVideo (videoID, accessHash) { function openVideo (videoID, messageID) {
var scope = $rootScope.$new(true); var scope = $rootScope.$new(true);
scope.videoID = videoID; scope.videoID = videoID;
scope.progress = {enabled: false}; scope.messageID = messageID;
scope.player = {};
var modalInstance = $modal.open({ var modalInstance = $modal.open({
templateUrl: 'partials/video_modal.html', templateUrl: 'partials/video_modal.html',

4
app/partials/message.html

@ -101,7 +101,7 @@
</a> </a>
<div ng-switch-when="messageMediaVideo" class="im_message_video im_message_document_thumbed"> <div ng-switch-when="messageMediaVideo" class="im_message_video im_message_document_thumbed">
<a class="im_message_video_thumb" href="" ng-click="openVideo(historyMessage.media.video.id)" bo-style="{width: historyMessage.media.video.thumb.width + 'px'}"> <a class="im_message_video_thumb" href="" ng-click="openVideo(historyMessage.media.video.id, historyMessage.id)" bo-style="{width: historyMessage.media.video.thumb.width + 'px'}">
<span class="im_message_video_duration" bo-bind="historyMessage.media.video.duration | duration"></span> <span class="im_message_video_duration" bo-bind="historyMessage.media.video.duration | duration"></span>
<i class="icon icon-videoplay"></i> <i class="icon icon-videoplay"></i>
<img <img
@ -119,7 +119,7 @@
</div> </div>
<div class="im_message_document_actions" ng-if="!historyMessage.media.video.progress.enabled"> <div class="im_message_document_actions" ng-if="!historyMessage.media.video.progress.enabled">
<a href="" ng-click="downloadVideo(historyMessage.media.video.id)">Download</a> <a href="" ng-click="downloadVideo(historyMessage.media.video.id)">Download</a>
<a href="" ng-click="openVideo(historyMessage.media.video.id)">Play video</a> <a href="" ng-click="openVideo(historyMessage.media.video.id, historyMessage.id)">Play video</a>
</div> </div>
<div class="clearfix cancelable_progress_wrap" ng-if="historyMessage.media.video.progress.enabled"> <div class="clearfix cancelable_progress_wrap" ng-if="historyMessage.media.video.progress.enabled">
<a class="im_message_media_progress_cancel pull-right" ng-click="historyMessage.media.video.progress.cancel()">Cancel</a> <a class="im_message_media_progress_cancel pull-right" ng-click="historyMessage.media.video.progress.cancel()">Cancel</a>

Loading…
Cancel
Save