Skip to content

Commit bf8b84f

Browse files
author
Nikolay Moskvin
committed
Fixed error message for bootstrap 3
1 parent 328ff6d commit bf8b84f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/helpers/rails_admin/form_builder.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ def field_wrapper_for(field, nested_in)
4545
end
4646

4747
def input_for(field)
48-
@template.content_tag(:div, class: 'col-sm-10 controls') do
48+
css = 'col-sm-10 controls'
49+
css += ' has-error' if field.errors.present?
50+
@template.content_tag(:div, class: css) do
4951
field_for(field) +
5052
errors_for(field) +
5153
help_for(field)
5254
end
5355
end
5456

5557
def errors_for(field)
56-
field.errors.present? ? @template.content_tag(:span, field.errors.to_sentence, class: 'help-inline') : ''.html_safe
58+
field.errors.present? ? @template.content_tag(:span, field.errors.to_sentence, class: 'help-inline text-danger') : ''.html_safe
5759
end
5860

5961
def help_for(field)

app/views/layouts/rails_admin/pjax.html.haml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
.page-header
77
%h1= @page_name
88
- flash && flash.each do |key, value|
9+
- key = 'danger' if key == 'error'
910
.alert{class: "alert-#{key}"}
1011
%a.close{href: '#', :'data-dismiss' => "alert"} ×
1112
= value

0 commit comments

Comments
 (0)