Some UX improvements

This commit is contained in:
David Schärer 2024-07-19 02:29:18 +02:00
parent 48c0067076
commit 8c81237501
81 changed files with 791 additions and 151 deletions

View file

@ -1,5 +1,5 @@
<%= bootstrap_form_with(model: report) do |form| %>
<%= form.text_field :name %>
<%= form.text_area :comment %>
<%= form.submit %>
<%= form.text_field :name %>
<%= form.rich_text_area :comment_html %>
<%= form.submit %>
<% end %>

View file

@ -6,7 +6,7 @@
<p>
<strong>Comment:</strong>
<%= report.comment %>
<%= report.comment_html %>
</p>
</div>

View file

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

View file

@ -7,17 +7,17 @@
<th><%= Report.human_attribute_name(:name) %></th>
<th><%= Report.human_attribute_name(:comment) %></th>
<th><%= Report.human_attribute_name(:comment_html) %></th>
</thead>
<tbody>
<% @reports.each do |report| %>
<tr>
<td><%= link_to(report.id, url_for([:work, report])) %></td>
<td><%= link_to(report.id, url_for(report)) %></td>
<td><%= link_to(report.name, url_for([:work, report])) %></td>
<td><%= link_to(report.name, url_for(report)) %></td>
<td><%= link_to(report.comment, url_for([:work, report])) %></td>
<td><%= link_to(truncate(strip_tags(report.comment)), url_for(report)) if report.comment %></td>
</tr>
<% end %>

View file

@ -1,9 +1,24 @@
<h1><%= t("scaffold.pagetitle_show", model: @report.class.model_name.human) %></h1>
<div class="container">
<h1><i class="bi bi-journal-text me-2"></i><%= @report.name %></h1>
<%= render @report %>
<%= @report.comment_html %>
<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 class="my-5">
<%= turbo_frame_tag "new_element_frame" do %>
<%= link_to "#{tag.i(class: "bi bi-plus-lg")} Element".html_safe, new_element_path(report_id: @report.id), class: "btn btn-primary" %>
<% end %>
</div>
<% @report.elements.each do |element| %>
<%= turbo_frame_tag dom_id(element, :frame) do %>
<%= render element %>
<% end %>
<% 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-outline-danger" %>
</div>
</div>

View file

@ -0,0 +1,14 @@
prawn_document do |pdf|
pdf.text @report.name
@report.elements.each do |element|
pdf.text element.title
pdf.text element.path
pdf.text element.description_html, inline_format: true
element.success_criteria.each do |success_criterion|
pdf.text success_criterion.title
pdf.text success_criterion.description_html, inline_format: true
pdf.text success_criterion.comment_html, inline_format: true
end
end
end

View file

@ -1,21 +0,0 @@
<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>