Merge pull request #5091 from aignatov-bio/ai-sci-8079-fix-print-button-on-protocol-show-page

Fix print protocol button on protocol show page [SCI-8079]
This commit is contained in:
aignatov-bio 2023-03-07 14:09:08 +01:00 committed by GitHub
commit ff4ef31ebf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -13,7 +13,7 @@
</a>
</div>
<div class="actions-block">
<a class="btn btn-light icon-btn pull-right" data-toggle="modal" data-target="#print-protocol-modal" tabindex="0">
<a class="btn btn-light icon-btn pull-right" :href="protocol.attributes.urls.print_protocol_url" target="_blank">
<span class="fas fa-print" aria-hidden="true"></span>
</a>
<button class="btn btn-light" @click="openVersionsModal">{{ i18n.t("protocols.header.versions") }}</button>

View file

@ -75,7 +75,8 @@ class ProtocolSerializer < ActiveModel::Serializer
delete_steps_url: delete_steps_url,
publish_url: publish_url,
save_as_draft_url: save_as_draft_url,
versions_modal_url: versions_modal_url
versions_modal_url: versions_modal_url,
print_protocol_url: print_protocol_url
}
end
@ -115,6 +116,12 @@ class ProtocolSerializer < ActiveModel::Serializer
versions_modal_protocol_path(object.parent || object)
end
def print_protocol_url
return unless can_read_protocol_in_repository?(object)
print_protocol_path(object)
end
def reorder_steps_url
return unless can_manage_protocol_in_module?(object) || can_manage_protocol_in_repository?(object)