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

This commit is contained in:
Shane Kilkelly 2018-06-15 16:04:42 +01:00
parent 67dcbff450
commit 54cdbd738c

View file

@ -253,9 +253,13 @@ define [
# auto-set filename based on selected file
$scope.$watch 'data.selectedProjectOutputFile', (newVal, oldVal) ->
return if !newVal
fileName = newVal.split('/').reverse()[0]
if fileName
$scope.data.name = fileName
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]
if fileName
$scope.data.name = fileName
_setInFlight = (type) ->
$scope.state.inFlight[type] = true