trim project and entiry names/renames

This commit is contained in:
Henry Oswald 2014-04-02 15:35:05 +01:00
parent f3ad7e10cd
commit b7b307e82b
3 changed files with 7 additions and 3 deletions

View file

@ -159,6 +159,7 @@ define [
renameEntity: (entity, name) ->
name = name?.trim()
@ide.socket.emit 'renameEntity', entity.id, entity.get("type"), name
entity.set("name", name)
@ -197,7 +198,7 @@ define [
el = $($("#newEntityModalTemplate").html())
input = el.find("input")
create = _.once () =>
name = input.val()
name = input.val()?.trim()
if name != ""
callback(name)
modal = new Modal

View file

@ -144,7 +144,7 @@ require [
$confirm.click (e) =>
$confirm.attr("disabled", true)
$confirm.text("Creating...")
projectName = $modal.find('input').val()
projectName = $modal.find('input').val()?.trim()
$.ajax
url: '/project/new'
type:'POST'

View file

@ -126,7 +126,10 @@ define [
# http://stackoverflow.com/questions/6692031/check-if-event-is-triggered-by-a-human
if e.originalEvent?
if @ide.isAllowedToDoIt "readAndWrite"
@project.set("name", e.target.value)
newName = e.target.value?.trim()
$("input.projectName").val(newName)
@project.set("name", newName)
bindToCompiler: ->
$('select#compilers').val(@project.get("compiler"))