validates :visible, :inclusion => [true, false]
validates :author, :associated => true
validates :event, :inclusion => %w[opened closed reopened commented hidden]
- validates :body, :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
+ validates :body, :allow_blank => false, :length => { :maximum => 2000 },
+ :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
# Return the comment text
def body
<form action="#">
<input type="hidden" name="lon">
<input type="hidden" name="lat">
- <textarea class="comment" name="text" cols="40" rows="10" placeholder="<%= t('javascripts.notes.new.advice') %>"></textarea>
+ <textarea class="comment" name="text" cols="40" rows="10" maxlength="2000" placeholder="<%= t('javascripts.notes.new.advice') %>"></textarea>
<div class="buttons clearfix">
<input type="submit" name="add" value="<%= t('javascripts.notes.new.add') %>" disabled="1">
</div>
<% if @note.status == "open" %>
<form action="#">
- <textarea class="comment" name="text" cols="40" rows="5"></textarea>
+ <textarea class="comment" name="text" cols="40" rows="5" maxlength="2000"></textarea>
<div class="buttons clearfix">
<% if current_user and current_user.moderator? -%>
<input type="submit" name="hide" value="<%= t('javascripts.notes.show.hide') %>" class="deemphasize" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, 'json') %>">