mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +08:00
Merge pull request #5280 from sboursen-scinote/sb_SCI-8237-alternative-solution
Title for publishing template protocol draft must include next version value (Alt) [SCI-8237]
This commit is contained in:
commit
134e7373c7
|
@ -5,7 +5,7 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">
|
||||
{{ i18n.t('protocols.publish_modal.title')}}
|
||||
{{ i18n.t('protocols.publish_modal.title', { nr: protocol.attributes.version })}}
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<div class="protocol-metadata">
|
||||
<p class="data-block">
|
||||
<span>{{ i18n.t("protocols.header.version") }}</span>
|
||||
<b>{{ protocol.attributes.version }}</b>
|
||||
<b>{{ titleVersion }}</b>
|
||||
</p>
|
||||
<p class="data-block" v-if="protocol.attributes.published">
|
||||
<span>{{ i18n.t("protocols.header.published_on") }}</span>
|
||||
|
@ -101,6 +101,21 @@
|
|||
required: true
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
titleVersion() {
|
||||
const createdFromVersion = this.protocol.attributes.created_from_version;
|
||||
|
||||
if (this.protocol.attributes.published) {
|
||||
return this.protocol.attributes.version;
|
||||
}
|
||||
|
||||
if (!createdFromVersion) {
|
||||
return this.i18n.t('protocols.draft');
|
||||
}
|
||||
|
||||
return this.i18n.t('protocols.header.draft_with_from_version', {nr: createdFromVersion});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
saveAsdraft() {
|
||||
$.post(this.protocol.attributes.urls.save_as_draft_url)
|
||||
|
|
|
@ -10,14 +10,18 @@ class ProtocolSerializer < ActiveModel::Serializer
|
|||
attributes :name, :id, :urls, :description, :description_view, :updated_at, :in_repository,
|
||||
:created_at_formatted, :updated_at_formatted, :added_by, :authors, :keywords, :version,
|
||||
:code, :published, :version_comment, :archived, :linked, :has_draft,
|
||||
:published_on_formatted, :published_by
|
||||
:published_on_formatted, :published_by, :created_from_version
|
||||
|
||||
def updated_at
|
||||
object.updated_at.to_i
|
||||
end
|
||||
|
||||
def version
|
||||
object.in_repository_draft? ? I18n.t('protocols.draft') : object.version_number
|
||||
object.version_number
|
||||
end
|
||||
|
||||
def created_from_version
|
||||
object.previous_version&.version_number
|
||||
end
|
||||
|
||||
def published
|
||||
|
|
|
@ -2696,7 +2696,7 @@ en:
|
|||
description_2: "Are you sure?"
|
||||
confirm: "Yes, delete"
|
||||
publish_modal:
|
||||
title: "Publish protocol template"
|
||||
title: "Publish version %{nr} of the protocol template"
|
||||
name: "Protocol template name"
|
||||
comment: "Revision notes"
|
||||
comment_placeholder: "What's new in this version?"
|
||||
|
@ -2714,6 +2714,7 @@ en:
|
|||
header:
|
||||
details: 'Details'
|
||||
versions: 'Versions'
|
||||
draft_with_from_version: 'Draft (from Version %{nr})'
|
||||
protocol_description: 'Protocol description'
|
||||
protocol_steps: 'Protocol steps'
|
||||
publish: 'Publish'
|
||||
|
|
Loading…
Reference in a new issue