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,5 @@
<%= bootstrap_form_with(model: report) do |form| %>
<%= form.text_field :name %>
<%= form.text_area :comment %>
<%= form.submit %>
<% end %>

View file

@ -0,0 +1,12 @@
<div id="<%= dom_id report %>">
<p>
<strong>Name:</strong>
<%= report.name %>
</p>
<p>
<strong>Comment:</strong>
<%= report.comment %>
</p>
</div>

View file

@ -0,0 +1,2 @@
json.extract! report, :id, :name, :comment, :created_at, :updated_at
json.url report_url(report, format: :json)

View file

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

View file

@ -0,0 +1,29 @@
<h1><%= t("scaffold.pagetitle_index", model: Report.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= Report.human_attribute_name(:id) %></th>
<th><%= Report.human_attribute_name(:name) %></th>
<th><%= Report.human_attribute_name(:comment) %></th>
</thead>
<tbody>
<% @reports.each do |report| %>
<tr>
<td><%= link_to(report.id, url_for([:work, report])) %></td>
<td><%= link_to(report.name, url_for([:work, report])) %></td>
<td><%= link_to(report.comment, url_for([:work, report])) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: Report.model_name.human), new_report_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @reports, partial: "reports/report", as: :report

View file

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

View file

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

View file

@ -0,0 +1 @@
json.partial! "reports/report", report: @report

View file

@ -0,0 +1,21 @@
<div class="container">
<h1><i class="bi bi-journal-text me-2"></i><%= @report.name %></h1>
<% @report.elements.each do |element| %>
<%= render element %>
<% end %>
<hr>
<h2><i class="bi bi-plus"></i>Element hinzufügen</h2>
<%= bootstrap_form_with(model: @report.elements.build, layout: :horizontal) do |form| %>
<%= form.collection_select(:checklist_id, Checklist.all, :id, :name) %>
<%= form.hidden_field :report_id %>
<%= form.text_field :path %>
<%= form.submit %>
<% end %>
<div class="action-row">
<%= link_to t("scaffold.link_edit", model: @report.model_name.human), edit_report_path(@report) %>
<%= link_to t("scaffold.link_index", model: @report.model_name.human(count: 2)), reports_path %>
<%= button_to t("scaffold.link_destroy", model: @report.model_name.human), @report, method: :delete, class: "btn btn-warning" %>
</div>
</div>