From 54cdbd738cbc2f37ee2521732f3aeddb119b17e9 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 15 Jun 2018 16:04:42 +0100 Subject: [PATCH] If selecting 'output.pdf', set the filename to project-name.pdf --- .../file-tree/controllers/FileTreeController.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee b/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee index 71f3956118..cd3c35b866 100644 --- a/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee +++ b/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee @@ -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