Skip to content

Commit

Permalink
Refresh the page after uploading a video - Feature Request #263
Browse files Browse the repository at this point in the history
fixed file list in movie / video
  • Loading branch information
dularion committed Jan 19, 2017
1 parent 561dccd commit 0b4ca6c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Expand Up @@ -57,7 +57,9 @@ angular.module('streama').controller('adminMovieCtrl', [
};

$scope.manageFiles = function(movie){
modalService.fileManagerModal(movie);
modalService.fileManagerModal(movie, function (data) {
movie.hasFiles = !!movie.files.length;
});
};


Expand Down
Expand Up @@ -45,6 +45,7 @@ angular.module('streama').controller('modalFileCtrl', [
}else{
$scope.video.files = $scope.video.files || [];
$scope.video.files.push(data);
$scope.video.hasFiles = true;
}
});
};
Expand All @@ -59,6 +60,7 @@ angular.module('streama').controller('modalFileCtrl', [
}else{
$scope.video.files = $scope.video.files || [];
$scope.video.files.push(data);
$scope.video.hasFiles = true;
}
}).error(function(data) {
alertify.error(data.message);
Expand Down Expand Up @@ -94,10 +96,12 @@ angular.module('streama').controller('modalFileCtrl', [
if(data.extension == '.srt' || data.extension == '.vtt'){
$scope.video.subtitles = $scope.video.subtitles || [];
$scope.video.subtitles.push(data);
$scope.video.hasFiles = true;
alertify.success('Subtitles uploaded successfully.');
}else{
$scope.video.files = $scope.video.files || [];
$scope.video.files.push(data);
$scope.video.hasFiles = true;
alertify.success('Video uploaded successfully.');
}

Expand Down
9 changes: 9 additions & 0 deletions grails-app/domain/streama/File.groovy
Expand Up @@ -76,4 +76,13 @@ class File {
return true
}
}

def getSimpleInstance(){
return [
id: this.id,
src: this.getSrc(),
originalFilename: this.originalFilename,
contentType: this.contentType
]
}
}
1 change: 1 addition & 0 deletions grails-app/views/movie/_movie.gson
Expand Up @@ -6,4 +6,5 @@ model {

json g.render(movie, [deep:true]){
hasFiles movie.files ? true : false
foo "bar"
}
2 changes: 1 addition & 1 deletion grails-app/views/movie/show.gson
Expand Up @@ -6,6 +6,6 @@ model {

json g.render(movie, [deep: true, excludes: ['files']]){
hasFiles movie.files ? true : false
files movie.files.findAll{}
files movie.files.collect{it.simpleInstance}
subtitles movie.files.findAll{it.extension == '.srt' || it.extension == '.vtt'}
}

0 comments on commit 0b4ca6c

Please sign in to comment.