If selecting 'output.pdf', set the filename to project-name.pdf

This commit is contained in:
Shane Kilkelly
2018-06-22 13:09:18 +01:00
parent 67dcbff450
commit 54cdbd738c
@@ -253,6 +253,10 @@ define [
# auto-set filename based on selected file # auto-set filename based on selected file
$scope.$watch 'data.selectedProjectOutputFile', (newVal, oldVal) -> $scope.$watch 'data.selectedProjectOutputFile', (newVal, oldVal) ->
return if !newVal return if !newVal
if newVal == 'output.pdf'
project = _.find($scope.data.projects, (p) -> p._id == $scope.data.selectedProjectId)
$scope.data.name = if project?.name? then "#{project.name}.pdf" else 'output.pdf'
else
fileName = newVal.split('/').reverse()[0] fileName = newVal.split('/').reverse()[0]
if fileName if fileName
$scope.data.name = fileName $scope.data.name = fileName