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

View file

@ -0,0 +1,22 @@
<div id="<%= dom_id check %>">
<p>
<strong><%= Check.human_attribute_name(:position) %>:</strong>
<%= check.position %>
</p>
<p>
<strong><%= Check.human_attribute_name(:name) %>:</strong>
<%= check.name %>
</p>
<p>
<strong><%= Check.human_attribute_name(:success_criterion) %>:</strong>
<%= check.success_criterion %>
</p>
<p>
<strong><%= Check.human_attribute_name(:level) %>:</strong>
<%= check.level %>
</p>
</div>

View file

@ -0,0 +1,2 @@
json.extract! check, :id, :position, :name, :success_criterion, :level, :created_at, :updated_at
json.url check_url(check, format: :json)

View file

@ -0,0 +1,7 @@
<%= bootstrap_form_with(model: check, remote: true) do |form| %>
<%= form.text_field :position %>
<%= form.text_field :name %>
<%= form.text_area :success_criterion %>
<%= form.select :level, Check.levels.keys, add_blank: !form.object.level.present? %>
<%= form.submit %>
<% end %>

View file

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

View file

@ -0,0 +1,25 @@
<h1><%= t("scaffold.pagetitle_index", model: Check.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= Check.human_attribute_name(:id) %></th>
<th><%= Check.human_attribute_name(:level) %></th>
<th><%= Check.human_attribute_name(:name) %></th>
<th><%= Check.human_attribute_name(:success_criterion) %></th>
</thead>
<tbody>
<% @checks.each do |check| %>
<tr>
<td><%= check.id %></td>
<td><%= check.level %></td>
<td><%= link_to(check.name, url_for(check)) %></td>
<td><%= link_to(truncate(check.success_criterion), url_for(check)) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: Check.model_name.human), new_check_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @checks, partial: "checks/check", as: :check

View file

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

View file

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

View file

@ -0,0 +1 @@
json.partial! "checks/check", check: @check

View file

@ -0,0 +1,12 @@
<div id="<%= dom_id element %>" class="mt-3">
<h2><i class="bi bi-card-checklist me-2"></i>
<%= element.title %></h2>
<p>
<strong>Path:</strong>
<%= element.path %>
</p>
<% element.success_criteria.each do |sc| %>
<%= render sc %>
<% end %>
</div>

View file

@ -0,0 +1,2 @@
json.extract! element, :id, :report_id, :path, :title, :description, :created_at, :updated_at
json.url element_url(element, format: :json)

View file

@ -0,0 +1,7 @@
<%= bootstrap_form_with(model: element) do |form| %>
<%= form.text_field :report_id %>
<%= form.text_field :path %>
<%= form.text_field :title %>
<%= form.text_area :description %>
<%= form.submit %>
<% end %>

View file

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

View file

@ -0,0 +1,37 @@
<h1><%= t("scaffold.pagetitle_index", model: Element.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= Element.human_attribute_name(:id) %></th>
<th><%= Element.human_attribute_name(:report_id) %></th>
<th><%= Element.human_attribute_name(:path) %></th>
<th><%= Element.human_attribute_name(:title) %></th>
<th><%= Element.human_attribute_name(:description) %></th>
</thead>
<tbody>
<% @elements.each do |element| %>
<tr>
<td><%= link_to(element.id, url_for(element)) %></td>
<td><%= link_to(element.report_id, url_for(element)) %></td>
<td><%= link_to(element.path, url_for(element)) %></td>
<td><%= link_to(element.title, url_for(element)) %></td>
<td><%= link_to(element.description, url_for(element)) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: Element.model_name.human), new_element_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @elements, partial: "elements/element", as: :element

View file

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

View file

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

View file

@ -0,0 +1 @@
json.partial! "elements/element", element: @element

View file

@ -1,3 +1,17 @@
<h1>Welcome</h1>
<p>Find me in app/views/home/show.html.erb</p>
<button class="btn btn-primary">Test</button>
<h1>Dashboard</h1>
<h2>Data</h2>
<p>
<i class="bi bi-journal-text"></i>
<%= Report.count %>
<%= link_to Report.model_name.human(count: Report.count), :reports %>
</p>
<p>
<i class="bi bi-list-check"></i>
<%= Checklist.count %>
<%= link_to Checklist.model_name.human(count: Checklist.count), :checklists %>
</p>
<p>
<i class="bi bi-check"></i>
<%= Check.count %>
<%= link_to Check.model_name.human(count: Check.count), :checks %>
</p>

View file

@ -0,0 +1,16 @@
<% if flash[:alert] || flash[:notice] %>
<div class="container mt-3 mb-3">
<% if flash[:alert] %>
<div class="alert alert-danger" role="alert">
<%= flash[:alert] %><% flash.delete(:alert) %>
</div>
<% end %>
<% if flash[:notice] %>
<div class="alert alert-info" role="alert">
<%= flash[:notice] %>
<% flash.delete(:notice) %>
</div>
<% end %>
</div>
<% end %>

View file

@ -9,7 +9,12 @@
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<% @navbar_items.each do |navbar_item| %>
<li class="nav-item">
<a class="nav-link <%= current_page?(navbar_item[:path]) && "active" %>" <%= current_page?(navbar_item[:path]) && "aria-current=\"page\"" %> href="<%= url_for(navbar_item[:path]) %>"><%= navbar_item[:label] %></a>
<a class="nav-link <%= @nav_path.to_s == navbar_item[:path].to_s && "active" %>" <%= @nav_path.to_s == navbar_item[:path].to_s && "aria-current=\"page\"" %> href="<%= url_for(navbar_item[:path]) %>">
<% if navbar_item[:icon] %>
<span aria-hidden="true" class="bi-<%= navbar_item[:icon] %>"></span>
<% end %>
<%= navbar_item[:label] %>
</a>
</li>
<% end %>
<%# <li class="nav-item">
@ -39,6 +44,19 @@
<button class="btn btn-outline-success" type="submit" name="<%= @search_name || "q" %>"><%= @search_placeholder || "Suchen" %></button>
</form>
<% end %>
<ul class="navbar-nav flex-row flex-wrap ms-md-auto">
<li class="nav-item">
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 d-flex align-items-center"
data-controller="theme-switcher"
data-action="theme-switcher#switch"
id="bd-theme"
type="button"
data-bs-display="static"
aria-label="Toggle theme (auto)">
<i class="bi <%= cookies[:modeTheme] == "dark" ? "bi-moon-stars-fill" : "bi-sun-fill" %> my-1"></i>
</button>
</li>
</ul>
</div>
</div>
</nav>

View file

@ -12,13 +12,11 @@
</head>
<body class="">
<%= render partial: "layouts/sidebar" %>
<%= render partial: "layouts/navigation" %>
<main class="">
<%= render partial: "layouts/sidebar" %>
<div class="p-3">
<%= yield %>
</div>
<%= render partial: "layouts/flash" %>
<main class="p-3">
<%= yield %>
</main>
</body>
</html>

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>

View file

@ -0,0 +1,9 @@
<%= bootstrap_form_with(model: success_criterion) do |form| %>
<%= form.text_field :element_id %>
<%= form.text_field :title %>
<%= form.text_area :description %>
<%= form.number_field :level %>
<%= form.number_field :result %>
<%= form.text_area :comment %>
<%= form.submit %>
<% end %>

View file

@ -0,0 +1,15 @@
<div id="<%= dom_id success_criterion %>" class="card mt-3">
<div class="card-header">
<h3><i class="bi bi-check me-2"></i><%= success_criterion.title %></h3>
</div>
<div class="card-body">
<p>
<%= success_criterion.description %>
</p>
<%= bootstrap_form_with(model: success_criterion, layout: :horizontal) do |form| %>
<%= form.select :result, SuccessCriterion.results, include_blank: true %>
<%= form.text_area :comment %>
<%= form.submit(class: "btn btn-secondary") %>
<% end %>
</div>
</div>

View file

@ -0,0 +1,2 @@
json.extract! success_criterion, :id, :element_id, :title, :description, :level, :result, :comment, :created_at, :updated_at
json.url success_criterion_url(success_criterion, format: :json)

View file

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

View file

@ -0,0 +1,45 @@
<h1><%= t("scaffold.pagetitle_index", model: SuccessCriterion.model_name.human(count: 2)) %></h1>
<table class="table table-striped">
<thead>
<tr>
<th><%= SuccessCriterion.human_attribute_name(:id) %></th>
<th><%= SuccessCriterion.human_attribute_name(:element_id) %></th>
<th><%= SuccessCriterion.human_attribute_name(:title) %></th>
<th><%= SuccessCriterion.human_attribute_name(:description) %></th>
<th><%= SuccessCriterion.human_attribute_name(:level) %></th>
<th><%= SuccessCriterion.human_attribute_name(:result) %></th>
<th><%= SuccessCriterion.human_attribute_name(:comment) %></th>
</thead>
<tbody>
<% @success_criteria.each do |success_criterion| %>
<tr>
<td><%= link_to(success_criterion.id, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.element_id, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.title, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.description, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.level, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.result, url_for(success_criterion)) %></td>
<td><%= link_to(success_criterion.comment, url_for(success_criterion)) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="action-row">
<%= link_to t("scaffold.link_new", model: SuccessCriterion.model_name.human), new_success_criterion_path %>
</div>

View file

@ -0,0 +1 @@
json.array! @success_criteria, partial: "success_criteria/success_criterion", as: :success_criterion

View file

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

View file

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

View file

@ -0,0 +1 @@
json.partial! "success_criteria/success_criterion", success_criterion: @success_criterion