Commits

Anonymous committed b77cf37

Fixed rendering of icons and error messages. Fixes BS3.

Comments (0)

Files changed (5)

formbar/renderer.py

         # TODO: Split rendering in four parts: label, fieldbody, errors,
         # help. Each in its own template.
         html = []
-        html.append('<div class="form-group">')
+        has_errors = len(self._field.get_errors())
+        html.append('<div class="form-group %s">' % (has_errors and 'has-error'))
         html.append(self._render_label())
         values = self._get_template_values()
         html.append(self.template.render(**values))

formbar/templates/errors.mako

 % for error in field.get_errors():
-  <div class="text-error">
-    <i class="icon-exclamation-sign"></i>
+  <div class="help-block">
+    <span class="glyphicon glyphicon-exclamation-sign"></span>
     ${_(error)}
   </div>
 % endfor

formbar/templates/formbar.css

 /* Helptexts */
 .text-help {
   position: relative;
-  top: -5px;
+  top: 3px;
   font-size: 0.8em;
   color: #707070;
 }

formbar/templates/help.mako

 % if field.help is not None:
-<p class="help-block">
-  <i class="icon-info-sign"></i>
+<p class="text-help">
+  <span class="glyphicon glyphicon-info-sign"></span>
   ${_(field.help)}
 </p>
 % endif

formbar/templates/label.mako

-<label for="${field.name}">
+<label class="control-label" for="${field.name}">
   % if field.number:
     <sup>(${field.number})</sup>
   % endif
     ${_(field.label)}
   % endif
   % if field.is_required():
-    <i data-toggle="tooltip" data-original-title="Required fa_field" class="formbar-tooltip icon-asterisk"></i>
+    <span data-toggle="tooltip" data-original-title="Required fa_field" class="formbar-tooltip glyphicon glyphicon-asterisk"></span>
   % endif
 </label>