Limit notes sizes to 2000 characters
This commit is contained in:
parent
766b53c397
commit
d9a48d66f9
3 changed files with 4 additions and 3 deletions
|
@ -33,7 +33,8 @@ class NoteComment < ActiveRecord::Base
|
|||
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
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<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>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
<% 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') %>">
|
||||
|
|
Loading…
Add table
Reference in a new issue