app/views/admin/resources/_form.html.erb in hyper_admin-0.2.0 vs app/views/admin/resources/_form.html.erb in hyper_admin-0.3.0
- old
+ new
@@ -1,27 +1,35 @@
-<div class="row">
- <div class="col-xs-12">
- <%= form_for [ :admin, resource ], html: { class: 'form-horizontal' } do |form| %>
- <%
- attributes = resource.attributes.delete_if do |k, v|
- k.to_sym.in? [ :id, :created_at, :updated_at ]
- end
- %>
- <% attributes.each do |key, val| %>
- <div class="form-group">
- <%= form.label key, class: "col-sm-2 control-label" %>
- <div class="col-sm-10">
- <%= form.text_field key, class: "form-control",
- placeholder: resource_class.human_attribute_name(key) %>
- </div>
- </div>
- <% end %>
+<script type="text/ng-template" id="date">
+ <input class="form-control" name="{{ name }}" type="date"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+</script>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <button type="submit" class="btn btn-primary">Submit</button>
- <%= link_to "Cancel", [ :admin, resource_class ], class: "btn btn-danger" %>
- </div>
- </div>
- <% end %>
- </div>
-</div>
+<script type="text/ng-template" id="datetime">
+ <input class="form-control" name="{{ name }}" type="datetime-local"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+</script>
+
+<script type="text/ng-template" id="email">
+ <input class="form-control" name="{{ name }}" type="email"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+</script>
+
+<script type="text/ng-template" id="integer">
+ <input class="form-control" name="{{ name }}" type="number"
+ placeholder="{{ placeholder }}" ng-model="resource[name]" step="1">
+</script>
+
+<script type="text/ng-template" id="string">
+ <input class="form-control" name="{{ name }}" type="text"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+</script>
+
+<script type="text/ng-template" id="text">
+ <textarea class="form-control" name="{{ name }}"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+ </textarea>
+</script>
+
+<script type="text/ng-template" id="url">
+ <input class="form-control" name="{{ name }}" type="url"
+ placeholder="{{ placeholder }}" ng-model="resource[name]">
+</script>