Adds max lengths in views

This commit is contained in:
kikito
2015-09-09 18:34:26 +02:00
parent 5e7a5b57de
commit ada03c8474
5 changed files with 7 additions and 7 deletions

View File

@@ -32,12 +32,12 @@
<div class="small-12 medium-4">
<% if @account.organization? %>
<%= f.fields_for :organization do |fo| %>
<%= fo.text_field :name, autofocus: true, placeholder: t("account.show.organization_name_label") %>
<%= fo.text_field :name, autofocus: true, maxlength: Organization::NAME_LENGTH[:maximum], placeholder: t("account.show.organization_name_label") %>
<% end %>
<%= f.text_field :phone_number, placeholder: t("account.show.phone_number_label") %>
<% else %>
<%= f.text_field :username, placeholder: t("account.show.username_label") %>
<%= f.text_field :username, maxlength: User::USERNAME_LENGTH[:maximum], placeholder: t("account.show.username_label") %>
<% end %>
</div>

View File

@@ -2,7 +2,7 @@
<div id="js-comment-form-<%= css_id %>" <%= "style='display:none'".html_safe if toggeable %>>
<%= form_for [commentable, Comment.new], remote: true do |f| %>
<%= label_tag "comment-body-#{css_id}", t("comments.form.leave_comment") %>
<%= f.text_area :body, id: "comment-body-#{css_id}", label: false %>
<%= f.text_area :body, id: "comment-body-#{css_id}", maxlength: Comment::BODY_LENGTH[:maximum], label: false %>
<%= f.hidden_field :commentable_type, value: commentable.class.name %>
<%= f.hidden_field :commentable_id, value: commentable.id %>
<%= f.hidden_field :parent_id, value: parent_id %>

View File

@@ -4,12 +4,12 @@
<div class="row">
<div class="small-12 column">
<%= f.label :title, t("debates.form.debate_title") %>
<%= f.text_field :title, maxlength: Debate::TITLE_LENGTH, placeholder: t("debates.form.debate_title"), label: false %>
<%= f.text_field :title, maxlength: Debate::TITLE_LENGTH[:maximum], placeholder: t("debates.form.debate_title"), label: false %>
</div>
<div class="ckeditor small-12 column">
<%= f.label :description, t("debates.form.debate_text") %>
<%= f.cktext_area :description, ckeditor: { language: I18n.locale }, label: false %>
<%= f.cktext_area :description, maxlength: Debate::DESCRIPTION_LENGTH[:maximum], ckeditor: { language: I18n.locale }, label: false %>
</div>
<div class="small-12 column">

View File

@@ -6,7 +6,7 @@
<div class="small-12 column">
<%= f.fields_for :organization do |fo| %>
<%= fo.text_field :name, autofocus: true, placeholder: t("devise_views.organizations.registrations.new.organization_name_label") %>
<%= fo.text_field :name, autofocus: true, maxlength: Organization::NAME_LENGTH[:maximum], placeholder: t("devise_views.organizations.registrations.new.organization_name_label") %>
<% end %>
<%= f.email_field :email, placeholder: t("devise_views.organizations.registrations.new.email_label") %>

View File

@@ -15,7 +15,7 @@
<%= f.label t("devise_views.users.registrations.new.username_label") %>
<span class="note"><%= t("devise_views.users.registrations.new.username_note") %></span>
<%= f.text_field :username, placeholder: t("devise_views.users.registrations.new.username_label"), label: false %>
<%= f.text_field :username, maxlength: User::USERNAME_LENGTH[:maximum], placeholder: t("devise_views.users.registrations.new.username_label"), label: false %>
<%= f.email_field :email, placeholder: t("devise_views.users.registrations.new.email_label") %>