Basic feature implemented, very basic poc
This commit is contained in:
parent
216089a3e7
commit
48c0067076
118 changed files with 2113 additions and 20 deletions
13
lib/templates/erb/scaffold/_form.html.erb.tt
Normal file
13
lib/templates/erb/scaffold/_form.html.erb.tt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<%%= bootstrap_form_with(model: <%= model_resource_name %>) do |form| %>
|
||||
<% attributes.each do |attribute| -%>
|
||||
<% if attribute.password_digest? -%>
|
||||
<%%= form.password_field :password %>
|
||||
<%%= form.password_field :password_confirmation %>
|
||||
<% elsif attribute.attachments? -%>
|
||||
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
|
||||
<% else -%>
|
||||
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<%%= form.submit %>
|
||||
<%% end %>
|
||||
8
lib/templates/erb/scaffold/edit.html.erb.tt
Normal file
8
lib/templates/erb/scaffold/edit.html.erb.tt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<h1><%%= t("scaffold.pagetitle_edit", model: <%= class_name %>.model_name.human) %></h1>
|
||||
|
||||
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
||||
|
||||
<div class="action-row">
|
||||
<%%= link_to t("scaffold.link_show", model: <%= class_name %>.model_name.human), <%= model_resource_name(prefix: "@") %> %>
|
||||
<%%= link_to t("scaffold.link_index", model: <%= class_name %>.model_name.human(count: 2)), <%= index_helper(type: :path) %> %>
|
||||
</div>
|
||||
25
lib/templates/erb/scaffold/index.html.erb.tt
Normal file
25
lib/templates/erb/scaffold/index.html.erb.tt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<h1><%%= t("scaffold.pagetitle_index", model: <%= class_name %>.model_name.human(count: 2)) %></h1>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%%= <%= class_name %>.human_attribute_name(:id) %></th>
|
||||
<% attributes.each do |attribute| %>
|
||||
<th><%%= <%= class_name %>.human_attribute_name(:<%= attribute.column_name %>) %></th>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
||||
<tr>
|
||||
<td><%%= link_to(<%= singular_table_name %>.id, url_for(<%= singular_table_name %>)) %></td>
|
||||
<% attributes.each do |attribute| %>
|
||||
<td><%%= link_to(<%= singular_table_name %>.<%= attribute.column_name %>, url_for(<%= singular_table_name %>)) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="action-row">
|
||||
<%%= link_to t("scaffold.link_new", model: <%= class_name %>.model_name.human), new_<%= singular_table_name %>_path %>
|
||||
</div>
|
||||
7
lib/templates/erb/scaffold/new.html.erb.tt
Normal file
7
lib/templates/erb/scaffold/new.html.erb.tt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<h1><%%= t("scaffold.pagetitle_new", model: <%= class_name %>.model_name.human) %></h1>
|
||||
|
||||
<%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
|
||||
|
||||
<div class="action-row">
|
||||
<%%= link_to t("scaffold.link_index", model: <%= class_name %>.model_name.human(count: 2)), <%= plural_table_name %>_path %>
|
||||
</div>
|
||||
17
lib/templates/erb/scaffold/partial.html.erb.tt
Normal file
17
lib/templates/erb/scaffold/partial.html.erb.tt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<div id="<%%= dom_id <%= singular_name %> %>">
|
||||
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
||||
<p>
|
||||
<strong><%= attribute.human_name %>:</strong>
|
||||
<% if attribute.attachment? -%>
|
||||
<%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
|
||||
<% elsif attribute.attachments? -%>
|
||||
<%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
|
||||
<div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
|
||||
<%% end %>
|
||||
<% else -%>
|
||||
<%%= <%= singular_name %>.<%= attribute.column_name %> %>
|
||||
<% end -%>
|
||||
</p>
|
||||
|
||||
<% end -%>
|
||||
</div>
|
||||
9
lib/templates/erb/scaffold/show.html.erb.tt
Normal file
9
lib/templates/erb/scaffold/show.html.erb.tt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h1><%%= t("scaffold.pagetitle_show", model: @<%= singular_table_name %>.class.model_name.human) %></h1>
|
||||
|
||||
<%%= render @<%= singular_table_name %> %>
|
||||
|
||||
<div class="action-row">
|
||||
<%%= link_to t("scaffold.link_edit", model: @<%= singular_table_name %>.model_name.human), <%= edit_helper(type: :path) %> %>
|
||||
<%%= link_to t("scaffold.link_index", model: @<%= singular_table_name %>.model_name.human(count: 2)), <%= index_helper(type: :path) %> %>
|
||||
<%%= button_to t("scaffold.link_destroy", model: @<%= singular_table_name %>.model_name.human), <%= model_resource_name(prefix: "@") %>, method: :delete, class: "btn btn-warning" %>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue