Skip to content

Commit

Permalink
Merge pull request tastejs#1523 from albrow/humble-fix-empty-todos
Browse files Browse the repository at this point in the history
Humble: Don't create new todos with empty titles. Fixes tastejs#1516.
  • Loading branch information
samccone committed Nov 17, 2015
2 parents 28bd694 + 535791f commit 79e3fed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions examples/humble/go/views/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ func (v *App) CreateTodo(ev dom.Event) {
if !ok {
panic("Could not convert event target to dom.HTMLInputElement")
}
v.Todos.AddTodo(strings.TrimSpace(input.Value))
document.QuerySelector(".new-todo").(dom.HTMLElement).Focus()
title := strings.TrimSpace(input.Value)
if title != "" {
v.Todos.AddTodo(title)
document.QuerySelector(".new-todo").(dom.HTMLElement).Focus()
}
}

// ClearCompleted is an event listener which removes all the completed todos
Expand Down
Loading

0 comments on commit 79e3fed

Please sign in to comment.