Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% elsif attribute.field_type == :check_box -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input id="<%= attribute.column_name %>" class="form-check-input" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
</div>
<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
Expand All @@ -41,15 +41,15 @@
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% else -%>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control"<% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" <% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
Expand All @@ -61,7 +61,7 @@
<% end -%>

<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Create <%= singular_table_name.humanize.downcase %>
</button>
</form>
14 changes: 7 additions & 7 deletions lib/generators/draft/resource/templates/views/edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
<!-- Label and input for <%= attribute.column_name %> start -->
<% end -%>
<% if attribute.field_type == :check_box -%>
<div class="form-check">
<div>
<input type="hidden" value="0" name="<%= attribute.column_name %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input id="<%= attribute.column_name %>" class="form-check-input" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<label for="<%= attribute.column_name %>" class="form-check-label">
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
</div>
<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
Expand All @@ -40,15 +40,15 @@
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% else -%>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
Expand All @@ -60,7 +60,7 @@
<% end -%>

<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Update <%= singular_table_name.humanize.downcase %>
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% end -%>
<%% if @<%= singular_table_name %>.errors.any? %>
<%% @<%= singular_table_name %>.errors.full_messages.each do |message| %>
<div class="alert">
<div>
<%%= message %>
</div>
<%% end %>
Expand All @@ -30,21 +30,21 @@
<!-- Label and input for <%= attribute.column_name %> start -->
<% end -%>
<% if attribute.field_type == :check_box -%>
<div class="form-check">
<div>
<input type="hidden" value="0" name="<%= attribute.column_name %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input id="<%= attribute.column_name %>" class="form-check-input" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<label for="<%= attribute.column_name %>" class="form-check-label">
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
</div>
<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
Expand All @@ -53,15 +53,15 @@
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% else -%>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
Expand All @@ -73,7 +73,7 @@
<% end -%>

<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Update <%= singular_table_name.humanize.downcase %>
</button>
</form>
Expand Down
36 changes: 18 additions & 18 deletions lib/generators/draft/resource/templates/views/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="row mb-3">
<div class="col-md-12">
<div>
<div>
<h1>
List of all <%= plural_table_name.humanize.downcase %>
</h1>
Expand All @@ -8,45 +8,45 @@

<hr>

<div class="row mb-3">
<div class="col-md-8 offset-md-2">
<div>
<div>
<h2>
Add a new <%= singular_table_name.humanize.downcase %>
</h2>

<form action="/insert_<%= singular_table_name %>"<% unless skip_post? -%> method="post"<% end -%>>
<% attributes.each do |attribute| -%>
<% if attribute.field_type == :check_box -%>
<div class="custom-control custom-checkbox mb-3">
<input type="checkbox" class="custom-control-input" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="1">
<div>
<input type="checkbox" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="1">

<label class="custom-control-label" for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
<label for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
</div>

<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>_box">
<%= attribute.column_name.humanize %>
</label>

<% if attribute.field_type == :text_area -%>
<textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control" rows="3"></textarea>
<textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" rows="3"></textarea>
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
<input type="datetime-local" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control">
<input type="datetime-local" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
<input type="date" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control">
<input type="date" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
<input type="time" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control">
<input type="time" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :integer -%>
<input type="number" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control">
<input type="number" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
<% else -%>
<input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" class="form-control">
<input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
<% end -%>
</div>

<% end -%>
<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Create <%= singular_table_name.humanize.downcase %>
</button>
</form>
Expand All @@ -66,9 +66,9 @@
<hr>

<% end -%>
<div class="row mb-3">
<div class="col-md-12">
<table class="table">
<div>
<div>
<table>
<tr>
<th>
ID
Expand Down
14 changes: 7 additions & 7 deletions lib/generators/draft/resource/templates/views/new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
<!-- Label and input for <%= attribute.column_name %> start -->
<% end -%>
<% if attribute.field_type == :check_box -%>
<div class="form-check">
<div>
<input type="hidden" value="0" name="<%= attribute.column_name %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input id="<%= attribute.column_name %>" class="form-check-input" name="<%= attribute.column_name %>" type="checkbox">
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<label for="<%= attribute.column_name %>" class="form-check-label">
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
</div>
<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
Expand All @@ -41,15 +41,15 @@
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" rows="3"></textarea>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"></textarea>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% else -%>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control">
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
Expand All @@ -61,7 +61,7 @@
<% end -%>

<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Create <%= singular_table_name.humanize.downcase %>
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%% if @<%= singular_table_name %>.present? %>
<%% if @<%= singular_table_name %>.errors.any? %>
<%% @<%= singular_table_name %>.errors.full_messages.each do |message| %>
<div class="alert alert-danger">
<div>
<%%= message %>
</div>
<%% end %>
Expand Down Expand Up @@ -31,21 +31,21 @@
<!-- Label and input for <%= attribute.column_name %> start -->
<% end -%>
<% if attribute.field_type == :check_box -%>
<div class="form-check">
<div>
<input type="hidden" value="0" name="<%= attribute.column_name %>">
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input id="<%= attribute.column_name %>" class="form-check-input" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<label for="<%= attribute.column_name %>" class="form-check-label">
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
</div>
<% else -%>
<div class="form-group">
<div>
<label for="<%= attribute.column_name %>">
<%= attribute.column_name.humanize %>
</label>
Expand All @@ -54,15 +54,15 @@
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
<% else -%>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> start -->
<% end -%>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" class="form-control"<% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" <% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
<% if with_sentinels? -%>
<!-- Input for <%= attribute.column_name %> end -->
<% end -%>
Expand All @@ -74,7 +74,7 @@
<% end -%>

<% end -%>
<button class="btn btn-block btn-outline-secondary">
<button>
Create <%= singular_table_name.humanize.downcase %>
</button>
</form>
Expand Down
Loading