mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't allow project names to be blank
This commit is contained in:
parent
b504732733
commit
f21aa0dd94
2 changed files with 10 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
MAX_PROJECT_NAME_LENGTH = 150
|
||||
App.controller "ProjectNameController", ["$scope", "settings", "ide", ($scope, settings, ide) ->
|
||||
$scope.state =
|
||||
renaming: false
|
||||
|
@ -12,11 +13,12 @@ define [
|
|||
$scope.$emit "project:rename:start"
|
||||
|
||||
$scope.finishRenaming = () ->
|
||||
$scope.state.renaming = false
|
||||
newName = $scope.inputs.name
|
||||
if newName.length < 150
|
||||
if !newName? or newName.length == 0 or newName.length > MAX_PROJECT_NAME_LENGTH
|
||||
return
|
||||
$scope.project.name = newName
|
||||
settings.saveProjectSettings({name: $scope.project.name})
|
||||
$scope.state.renaming = false
|
||||
|
||||
ide.socket.on "projectNameUpdated", (name) ->
|
||||
$scope.$apply () ->
|
||||
|
|
|
@ -257,8 +257,10 @@ define [
|
|||
modalInstance.result.then (project_id) ->
|
||||
window.location = "/project/#{project_id}"
|
||||
|
||||
MAX_PROJECT_NAME_LENGTH = 150
|
||||
$scope.renameProject = (project, newName) ->
|
||||
if newName.length < 150
|
||||
if !newName? or newName.length == 0 or newName.length > MAX_PROJECT_NAME_LENGTH
|
||||
return
|
||||
project.name = newName
|
||||
queuedHttp.post "/project/#{project.id}/rename", {
|
||||
newProjectName: project.name
|
||||
|
|
Loading…
Reference in a new issue