Basic feature implemented, very basic poc

This commit is contained in:
David Schärer 2024-07-16 20:22:59 +02:00
parent 216089a3e7
commit 48c0067076
118 changed files with 2113 additions and 20 deletions

View file

@ -0,0 +1,28 @@
<div id="<%= dom_id checklist %>">
<p>
<strong>Code:</strong>
<%= checklist.code %>
</p>
<p>
<strong>Name:</strong>
<%= checklist.name %>
</p>
<p>
<strong>Description:</strong>
<%= checklist.description %>
</p>
<p>
<strong>Checks</strong>
<ul>
<% checklist.checklist_entries.each do |entry| %>
<li>
<%= entry.position %> <%= entry.check.name %>
</li>
<% end %>
</ul>
</p>
</div>

View file

@ -0,0 +1,2 @@
json.extract! checklist, :id, :code, :name, :description, :created_at, :updated_at
json.url checklist_url(checklist, format: :json)

View file

@ -0,0 +1,13 @@
<%= bootstrap_form_with(model: checklist) do |form| %>
<%= form.text_field :code %>
<%= form.text_field :name %>
<%= form.text_area :description %>
<h2>Checks</h2>
<% checklist.checklist_entries.each do |entry| %>
<%= form.fields_for(:checklist_entries, entry) do |eform| %>
<%= eform.number_field :position %>
<%= eform.collection_select :check_id, Check.all, :id, :name %>
<% end %>
<% end %>
<%= form.submit %>
<% end %>

View file

@ -0,0 +1,8 @@
<h1><%= t("scaffold.pagetitle_edit", model: Checklist.model_name.human) %></h1>
<%= render "form", checklist: @checklist %>
<div class="action-row">
<%= link_to t("scaffold.link_show", model: Checklist.model_name.human), @checklist %>
<%= link_to t("scaffold.link_index", model: Checklist.model_name.human(count: 2)), checklists_path %>
</div>

View file

@ -0,0 +1,33 @@
<h1><%= t("scaffold.pagetitle_index", model: Checklist.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= Checklist.human_attribute_name(:id) %></th>
<th><%= Checklist.human_attribute_name(:code) %></th>
<th><%= Checklist.human_attribute_name(:name) %></th>
<th><%= Checklist.human_attribute_name(:description) %></th>
</thead>
<tbody>
<% @checklists.each do |checklist| %>
<tr>
<td><%= link_to(checklist.id, url_for(checklist)) %></td>
<td><%= link_to(checklist.code, url_for(checklist)) %></td>
<td><%= link_to(checklist.name, url_for(checklist)) %></td>
<td><%= link_to(checklist.description, url_for(checklist)) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: Checklist.model_name.human), new_checklist_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @checklists, partial: "checklists/checklist", as: :checklist

View file

@ -0,0 +1,7 @@
<h1><%= t("scaffold.pagetitle_new", model: Checklist.model_name.human) %></h1>
<%= render "form", checklist: @checklist %>
<div class="action-row">
<%= link_to t("scaffold.link_index", model: Checklist.model_name.human(count: 2)), checklists_path %>
</div>

View file

@ -0,0 +1,9 @@
<h1><%= t("scaffold.pagetitle_show", model: @checklist.class.model_name.human) %></h1>
<%= render @checklist %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @checklist.model_name.human), edit_checklist_path(@checklist) %>
<%= link_to t("scaffold.link_index", model: @checklist.model_name.human(count: 2)), checklists_path %>
<%= button_to t("scaffold.link_destroy", model: @checklist.model_name.human), @checklist, method: :delete, class: "btn btn-warning" %>
</div>

View file

@ -0,0 +1 @@
json.partial! "checklists/checklist", checklist: @checklist