diff --git a/app/models/concerns/archivable_model.rb b/app/models/concerns/archivable_model.rb index 355240e05..7e15eeac8 100644 --- a/app/models/concerns/archivable_model.rb +++ b/app/models/concerns/archivable_model.rb @@ -48,6 +48,11 @@ module ArchivableModel save! end + def name_with_label + raise NotImplementedError, "Archivable model must implement the '.archived_branch?' method!" unless respond_to?(:archived_branch?) + I18n.t("labels.archived") if self.archived_branch? + end + protected def set_archive_timestamp diff --git a/app/models/protocol.rb b/app/models/protocol.rb index 1b27b9727..1a3ee2122 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -385,6 +385,10 @@ class Protocol < ApplicationRecord steps.count end + def archived_branch? + archived? || parent&.archived? + end + def completed_steps steps.where(completed: true) end diff --git a/app/views/my_modules/protocols/_protocol_status_bar.html.erb b/app/views/my_modules/protocols/_protocol_status_bar.html.erb index 573223a4e..d2549b317 100644 --- a/app/views/my_modules/protocols/_protocol_status_bar.html.erb +++ b/app/views/my_modules/protocols/_protocol_status_bar.html.erb @@ -18,7 +18,7 @@