lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb in humdrum-rails-0.1.2 vs lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb in humdrum-rails-0.1.3

- old
+ new

@@ -4,11 +4,11 @@ end unless defined?(place_holder) place_holder = "" end inp_id = "inp_#{display_name.underscore.split(" ").join("_")}" - error_class = object.errors[field_name.to_s].any? ? "has-errors" : "" + error_class = object.errors[field_name.to_s].any? ? "has-error" : "" %> <div class="form-group <%%= error_class %>"> <%% if ["text", "email", "search", "password", "date", "time", "tel", "url", "month", "file", "image", ""].include?(input_type) %> @@ -17,29 +17,38 @@ <%%= display_name %> <span class="text-color-red ml-10 mr--5 pull-right"><%%= required ? "*" : raw("&nbsp;&nbsp;") %></span> </label> <div class="col-md-8"> <input name="<%%= object_name %>[<%%= field_name %>]" id="inp_<%%= display_name.underscore.split(" ").join("_") %>" class="text input form-control" type="<%%= input_type %>" placeholder="<%%= place_holder %>" value="<%%= object.send(field_name.to_s) %>" /> + <% if object.errors[field_name.to_s].any? %> + <span for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="help-block"><%= object.errors[field_name.to_s].first %></span> + <% end %> </div> <%% elsif input_type == "checkbox" %> <label for="inp_<%%= display_name.underscore.split(" ").join("_") %>" class="col-md-4 control-label"> <%%= display_name %> <span class="text-color-red ml-10 mr--5 pull-right"><%%= required ? "*" : raw("&nbsp;&nbsp;") %></span> </label> <div class="col-md-8"> <input name="<%%= object_name %>[<%%= field_name %>]" id="inp_<%%= display_name.underscore.split(" ").join("_") %>" type="<%%= input_type %>" class="checkbox input form-control" <%%= object.send(field_name.to_s) ? "checked='checked'" : "" %> /> + <% if object.errors[field_name.to_s].any? %> + <span for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="help-block"><%= object.errors[field_name.to_s].first %></span> + <% end %> </div> <%% elsif input_type == "textarea" %> <label for="inp_<%%= display_name.underscore.split(" ").join("_") %>" class="col-md-4 control-label"> <%%= display_name %> <span class="text-color-red ml-10 mr--5 pull-right"><%%= required ? "*" : raw("&nbsp;&nbsp;") %></span> </label> <div class="col-md-8"> <textarea name="<%%= object_name %>[<%%= field_name %>]" style="height:200px;" class="textarea input form-control" id="inp_<%%= display_name.underscore.split(" ").join("_") %> placeholder="<%%= place_holder %>" "><%%= object.send(field_name.to_s) %></textarea> + <% if object.errors[field_name.to_s].any? %> + <span for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="help-block"><%= object.errors[field_name.to_s].first %></span> + <% end %> </div> <%% end %> </div> \ No newline at end of file