mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 04:02:19 -05:00
add indicator for whether problem resolution is in progress
This commit is contained in:
4 files changed
+34
-12
No files matched your search
@@ -50,16 +50,30 @@ class ResolveButtonComponent < ViewComponent::Base
|
||||
|
||||
def call
|
||||
text = t @options[:i18n_key]
|
||||
link_to(
|
||||
safe_join([helpers.icon(@options[:icon], text), text], " "),
|
||||
resolve_problem_path(@problem),
|
||||
class: "btn btn-#{@options[:button_type]}",
|
||||
data: {
|
||||
confirm: @options[:confirm] ?
|
||||
translate(@options[:confirm] % {type: @problem.problematic_type.underscore}) :
|
||||
nil
|
||||
},
|
||||
method: :post
|
||||
)
|
||||
if @problem.in_progress
|
||||
link_to(
|
||||
safe_join(
|
||||
[
|
||||
content_tag(:span, helpers.icon("", ""), class: "spinner-border spinner-border-sm"),
|
||||
content_tag(:span, text)
|
||||
],
|
||||
" "
|
||||
),
|
||||
"#",
|
||||
class: "btn btn-#{@options[:button_type]} disabled"
|
||||
)
|
||||
else
|
||||
link_to(
|
||||
safe_join([helpers.icon(@options[:icon], text), text], " "),
|
||||
resolve_problem_path(@problem),
|
||||
class: "btn btn-#{@options[:button_type]}",
|
||||
data: {
|
||||
confirm: @options[:confirm] ?
|
||||
translate(@options[:confirm] % {type: @problem.problematic_type.underscore}) :
|
||||
nil
|
||||
},
|
||||
method: :post
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -110,6 +110,7 @@ class ProblemsController < ApplicationController
|
||||
def resolve_by_merging(problem)
|
||||
case problem.problematic_type
|
||||
when "Model"
|
||||
problem.update(in_progress: true)
|
||||
problem.problematic.merge_all_children!
|
||||
else
|
||||
raise NotImplementedError
|
||||
@@ -128,6 +129,7 @@ class ProblemsController < ApplicationController
|
||||
def resolve_by_converting(problem)
|
||||
case problem.problematic_type
|
||||
when "ModelFile"
|
||||
problem.update(in_progress: true)
|
||||
problem.problematic.convert_to! :threemf
|
||||
else
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddInProgressToProblems < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :problems, :in_progress, :boolean, default: false, null: false
|
||||
end
|
||||
end
|
||||
Generated
+2
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_10_25_110218) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_11_05_121830) do
|
||||
create_table "caber_relations", force: :cascade do |t|
|
||||
t.string "subject_type"
|
||||
t.integer "subject_id"
|
||||
@@ -240,6 +240,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_10_25_110218) do
|
||||
t.string "note"
|
||||
t.boolean "ignored", default: false, null: false
|
||||
t.string "public_id"
|
||||
t.boolean "in_progress", default: false, null: false
|
||||
t.index ["category", "problematic_id", "problematic_type"], name: "index_problems_on_category_and_problematic_id_and_type", unique: true
|
||||
t.index ["problematic_type", "problematic_id"], name: "index_problems_on_problematic"
|
||||
t.index ["public_id"], name: "index_problems_on_public_id"
|
||||
|
||||
Reference in new issue
Block a user