Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modifying form builder to use <p> for help on field groups.

  • Loading branch information...
commit d53fc297cb453fc87267a1b34df41d03611d1257 1 parent 21c75cf
@andrewculver andrewculver authored
View
13 app/assets/stylesheets/rails_admin/base/theming.css.scss
@@ -24,21 +24,18 @@ form label.nester {
form {
label { width:130px; }
- legend { padding-left: 150px; }
- .input { margin-left: 150px; }
+ legend, p, .input { padding-left: 150px; }
+ p { margin-top: -10px; }
blockquote {
label { width:120px; }
- legend { padding-left: 140px; }
- .input { margin-left: 140px; }
+ legend, p, .input { padding-left: 140px; }
blockquote {
label { width:110px; }
- legend { padding-left: 130px; }
- .input { margin-left: 130px; }
+ legend, p, .input { padding-left: 130px; }
blockquote {
label { width:100px; }
- legend { padding-left: 120px; }
- .input { margin-left: 120px; }
+ legend, p, .input { padding-left: 120px; }
}
}
}
View
10 app/helpers/rails_admin/form_builder.rb
@@ -20,11 +20,11 @@ def generate(options = {})
def fieldset_for fieldset, nested_in
if (fields = fieldset.with(:form => self, :object => @object, :view => @template).visible_fields).length > 0
@template.content_tag :fieldset do
- @template.content_tag(:legend, fieldset.label.html_safe, :style => "#{fieldset.label == I18n.translate("admin.form.basic_info") ? 'display:none' : ''}") +
- if fieldset.help.present?
- @template.content_tag(:p, fieldset.help)
- end
- fields.map{ |field| field_wrapper_for(field, nested_in) }.join.html_safe
+ contents = []
+ contents << @template.content_tag(:legend, fieldset.label.html_safe, :style => "#{fieldset.label == I18n.translate("admin.form.basic_info") ? 'display:none' : ''}")
+ contents << @template.content_tag(:p, fieldset.help) if fieldset.help.present?
+ contents << fields.map{ |field| field_wrapper_for(field, nested_in) }.join
+ contents.join.html_safe
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.