From fb03698e279e1c330ccaaf84243836b3459f8e4b Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Fri, 19 Apr 2024 14:04:58 +0200 Subject: [PATCH] Fix assignment modal in protocol templates [SCI-10647] --- app/javascript/vue/protocols/table.vue | 2 +- app/serializers/lists/protocol_serializer.rb | 22 +++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/javascript/vue/protocols/table.vue b/app/javascript/vue/protocols/table.vue index 72ef552ad..d7209e57c 100644 --- a/app/javascript/vue/protocols/table.vue +++ b/app/javascript/vue/protocols/table.vue @@ -51,7 +51,7 @@ import VersionsRenderer from './renderers/versions.vue'; import VersionsModal from './modals/versions.vue'; export default { - name: 'LabelTemplatesTable', + name: 'ProtocolTemplatesTable', components: { DataTable, UsersRenderer, diff --git a/app/serializers/lists/protocol_serializer.rb b/app/serializers/lists/protocol_serializer.rb index 4518c0bb6..555fa848c 100644 --- a/app/serializers/lists/protocol_serializer.rb +++ b/app/serializers/lists/protocol_serializer.rb @@ -6,13 +6,25 @@ module Lists include Rails.application.routes.url_helpers attributes :name, :code, :keywords, :linked_tasks, :nr_of_versions, :assigned_users, :published_by, - :published_on, :updated_at, :archived_by, :archived_on, :urls, :default_public_user_role_id, - :hidden, :top_level_assignable, :has_draft, :team, :permissions + :published_on, :updated_at, :archived_by, :archived_on, :urls, + :top_level_assignable, :has_draft, :team, :permissions + attribute :hidden + attribute :default_public_user_role_id def code object.parent&.code || object.code end + def hidden + return object.parent.hidden? if object.parent.present? + + object.hidden? + end + + def default_public_user_role_id + object.parent&.default_public_user_role_id || object.default_public_user_role_id + end + def keywords object.protocol_keywords.map(&:name) end @@ -63,12 +75,6 @@ module Lists I18n.l(object.archived_on, format: :full) if object.archived_on end - delegate :default_public_user_role_id, to: :object - - def hidden - object.hidden? - end - def top_level_assignable true end