Skip to content

Commit

Permalink
Merge pull request #1 from QuintinAdam/master
Browse files Browse the repository at this point in the history
Only fields with errors are highlighted instead of highlighting all the fields when there is an error.
  • Loading branch information
beneggett committed Nov 29, 2013
2 parents ee16c4b + 9ce356e commit 9e3ac4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/views/simple_contact/contact/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@
<% end %>
<%# Message fields below %>
<div class="form-group <%= 'has-error' if @message.errors.present? %>">
<div class="form-group <%= 'has-error' if @message.errors.include?(:name) %>">
<%= f.label :name, t(:email_name_label).html_safe, class: "col-xs-2 control-label" %>
<div class="col-xs-10">
<%= f.text_field :name, placeholder: t(:email_name_placeholder).html_safe, class: "form-control" %>
</div>
</div>

<div class="form-group <%= 'has-error' if @message.errors.present? %>">
<div class="form-group <%= 'has-error' if @message.errors.include?(:email) %>">
<%= f.label :email, t(:email_address_label).html_safe, class: "col-xs-2 control-label" %>
<div class="col-xs-10">
<%= f.email_field :email, placeholder: t(:email_address_placeholder).html_safe, class: "form-control" %>
</div>
</div>


<div class="form-group <%= 'has-error' if @message.errors.present? %>">
<div class="form-group <%= 'has-error' if @message.errors.include?(:subject) %>">
<%= f.label :subject, t(:email_subject_label).html_safe, class: "col-xs-2 control-label" %>
<div class="col-xs-10">
<%= f.text_field :subject, placeholder: t(:email_subject_placeholder).html_safe, class: "form-control" %>
</div>
</div>

<div class="form-group <%= 'has-error' if @message.errors.present? %>">
<div class="form-group <%= 'has-error' if @message.errors.include?(:body) %>">
<%= f.label :body, t(:email_body_label).html_safe, class: "col-xs-2 control-label" %>
<div class="col-xs-10">
<%= f.text_area :body, placeholder: t(:email_body_placeholder).html_safe, as: :text, rows: 10, class: "form-control" %>
Expand Down

0 comments on commit 9e3ac4e

Please sign in to comment.