Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show problem details on model/file pages #1791

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/views/model_files/_problem.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%= card(problem_severity(problem), t("problems.model_file_#{problem.category}.title")) do %>
<%= t("problems.model_file_#{problem.category}.description", note: problem.note ) %>

<% unless @duplicates.empty? %>
<ul>
<% @duplicates.each do |file| %>
<li><%= link_to "#{file.model.name}/#{file.filename}", [file.model.library, file.model, file]%></li>
<% end %>
</ul>
<% end %>
<% end %>
13 changes: 1 addition & 12 deletions app/views/model_files/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,7 @@
<%= render 'form' %>
<% end %>

<% unless @duplicates.empty? %>
<%= card :warning, t('.duplicate_card.title') do %>
<p>
<%= t('.duplicate_card.message') %>
</p>
<ul>
<% @duplicates.each do |file| %>
<li><%= link_to "#{file.model.name}/#{file.filename}", [file.model.library, file.model, file]%></li>
<% end %>
</ul>
<% end %>
<% end %>
<%= render partial: "problem", collection: @file.problems %>

<%= card :secondary, "Actions" do %>
<%= link_to "#{icon('cloud-download', 'Download')} Download".html_safe, library_model_model_file_path(@library, @model, @file, @file.extension.to_sym), {class: "btn btn-secondary"} %>
Expand Down
16 changes: 16 additions & 0 deletions app/views/models/_problem.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%= card(problem_severity(problem), t("problems.model_#{problem.category}.title")) do %>
<%= t("problems.model_#{problem.category}.description", note: problem.note ) %>

<% if @model.contains_other_models? %>
<ul>
<% @model.contained_models.each do |target| %>
<li><%= link_to target.name, library_model_path(@library, target)%></li>
<% end %>
</ul>
<p>
<%= t("problems.model_nesting.warning") %>
</p>
<%= link_to "Merge all", merge_library_model_path(@library, @model, all: true), class: "btn btn-danger", method: :post %>
<% end %>

<% end %>
17 changes: 1 addition & 16 deletions app/views/models/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,7 @@
<% end %>
<% end %>

<% if @model.contains_other_models? %>
<%= card :warning, "Contained Models" do %>
<p>
The model folder on disk contains other models. You may wish to merge them into this one, or move them out.
</p>
<ul>
<% @model.contained_models.each do |target| %>
<li><%= link_to target.name, library_model_path(@library, target)%></li>
<% end %>
</ul>
<p>
Bulk merging moves all files from the models above into this one, and removes them. File metadata is preserved, but any model metadata will be lost!
</p>
<%= link_to "Merge all", merge_library_model_path(@library, @model, all: true), class: "btn btn-danger", method: :post %>
<% end %>
<% end %>
<%= render partial: "problem", collection: @model.problems %>

<%= card(:secondary, 'Notes') do %>
<p class="card-text"><%= sanitize @model.notes %></p>
Expand Down
4 changes: 2 additions & 2 deletions app/views/problems/_library_missing.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("boxes", "Missing library") %></td>
<td><%= icon("boxes", t(".title")) %></td>
<td><%= link_to problem.problematic.name, problem.problematic %></td>
<td><%= t "problems.library.missing" %></td>
<td><%= t ".title" %></td>
<td></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_empty.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("folder-x", "Empty model") %></td>
<td><%= icon("folder-x", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.library, problem.problematic] %></td>
<td><%= t "problems.model.empty" %></td>
<td><%= t ".title" %></td>
<td><%= link_to "Purge", [problem.problematic.library, problem.problematic], method: :delete, class: "btn btn-danger" %></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_file_duplicate.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("files", t(".description")) %></td>
<td><%= icon("files", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.model.library, problem.problematic.model, problem.problematic] %></td>
<td><%= t ".description" %></td>
<td><%= t ".title" %></td>
<td><%= link_to "Open", [problem.problematic.model.library, problem.problematic.model, problem.problematic], class: "btn btn-primary" %></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_file_inefficient.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("fire", t(".description")) %></td>
<td><%= icon("fire", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.model.library, problem.problematic.model, problem.problematic] %></td>
<td><%= t ".description" %>: <%= problem.note %></td>
<td><%= t ".title" %>: <%= problem.note %></td>
<td><%= link_to "Open", [problem.problematic.model.library, problem.problematic.model, problem.problematic], class: "btn btn-primary" %></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_file_missing.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("file-x", "Missing file") %></td>
<td><%= icon("file-x", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.model.library, problem.problematic.model, problem.problematic] %></td>
<td><%= t "problems.model_file.missing" %></td>
<td><%= t ".title" %></td>
<td><%= link_to "Purge", [problem.problematic.model.library, problem.problematic.model, problem.problematic], method: :delete, class: "btn btn-danger" %></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_missing.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("folder-x", "Missing model") %></td>
<td><%= icon("folder-x", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.library, problem.problematic] %></td>
<td><%= t "problems.model.missing" %></td>
<td><%= t ".title" %></td>
<td><%= link_to "Purge", [problem.problematic.library, problem.problematic], method: :delete, class: "btn btn-danger" %></td>
4 changes: 2 additions & 2 deletions app/views/problems/_model_nesting.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<td><%= icon("files-alt", "Nested model") %></td>
<td><%= icon("files-alt", t(".title")) %></td>
<td><%= link_to problem.problematic.name, [problem.problematic.library, problem.problematic] %></td>
<td><%= t "problems.model.nesting" %></td>
<td><%= t ".title" %></td>
<td><%= link_to "Open", [problem.problematic.library, problem.problematic], class: "btn btn-primary" %></td>
34 changes: 19 additions & 15 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,34 @@ en:
CC0-10: Creative Commons Zero
LicenseRef-Commercial: Commercial; private use only
MIT: MIT
model_files:
show:
duplicate_card:
message: This file is duplicated in other models. You may wish to remove some.
title: Duplicated files
problems:
categories:
duplicate: Duplicate files
empty: Model has no files
inefficient: Inefficient formats
missing: Missing files or folders
nesting: Model contains other models
library:
missing: Library folder not found
model:
empty: Model has no files
missing: Model folder not found
nesting: Model contains other models
model_file:
missing: File not found
library_missing:
title: Folder not found
model_empty:
description: This model contains no files. Either delete it, or find where its files went!
title: No files
model_file_duplicate:
description: Duplicated file
description: This file is duplicated in other models. You may wish to remove some.
title: Duplicated file
model_file_inefficient:
description: Inefficient file format
description: This file is in %{note}, an inefficient file format. Consider converting it to a binary format such as 3MF to save disk space.
title: Inefficient format
model_file_missing:
description: This file is missing on disk; either delete it, or find where it went!
title: File not found
model_missing:
description: The folder for this model is missing on disk; either delete it, or find where it went!
title: Folder not found
model_nesting:
description: The model folder on disk contains other models. You may wish to merge them into this one, or move them out.
title: Contains other models
warning: Bulk merging moves all files from the models above into this one, and removes them. File metadata is preserved, but any model metadata will be lost!
severities:
danger: Danger
info: Info
Expand Down
Loading