Skip to content

Commit

Permalink
Force to select type
Browse files Browse the repository at this point in the history
  • Loading branch information
veelenga committed Jul 15, 2017
1 parent 0afdfde commit e347973
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/announcement.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Announcement < Granite::ORM
validate :title, "is too long",
->(this : Announcement) { this.title.to_s.size <= 100 }

validate :type, "is not valid",
validate :type, "is not selected",
->(this : Announcement) { TYPES.keys.includes? this.type }

validate :description, "is too short",
Expand Down
1 change: 1 addition & 0 deletions src/views/announcement/_form.slang
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ form action="#{ action }" method="post"
textarea rows="10" name="description" placeholder="Describe your announcement here and include links..." = announcement.description

select name="type"
option value="-1" selected="selected" = "-- select type --"
- Announcement::TYPES.each do |type, name|
- if type == announcement.type
option value="#{ type }" selected="selected" = name
Expand Down

0 comments on commit e347973

Please sign in to comment.