mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 17:24:51 +08:00
Make file versioning disclaimer overridable [SCI-11040]
This commit is contained in:
parent
2a12ed129e
commit
1a99350611
3 changed files with 15 additions and 6 deletions
|
@ -407,7 +407,8 @@ class AssetsController < ApplicationController
|
|||
user: current_user
|
||||
).as_json.merge(
|
||||
enabled: VersionedAttachments.enabled?,
|
||||
enable_url: ENV.fetch('SCINOTE_FILE_VERSIONING_ENABLE_URL', nil)
|
||||
enable_url: ENV.fetch('SCINOTE_FILE_VERSIONING_ENABLE_URL', nil),
|
||||
disabled_disclaimer: VersionedAttachments.disabled_disclaimer
|
||||
)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<h3 class="mt-1 mb-2">{{ i18n.t('assets.file_versions_modal.title') }}</h3>
|
||||
{{ i18n.t('assets.file_versions_modal.disabled_disclaimer') }}
|
||||
{{ disabledDisclaimer.text }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,7 +76,7 @@
|
|||
{{ i18n.t('general.cancel') }}
|
||||
</button>
|
||||
<a v-if="fileVersions && !enabled" :href="enableUrl" class='btn btn-primary' target="_blank">
|
||||
{{ i18n.t('assets.file_versions_modal.enable_button') }}
|
||||
{{ disabledDisclaimer.button }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,8 +96,7 @@ export default {
|
|||
required: true
|
||||
},
|
||||
restoreVersionUrl: {
|
||||
type: String,
|
||||
required: true
|
||||
type: String
|
||||
}
|
||||
},
|
||||
mixins: [modalMixin],
|
||||
|
@ -105,7 +104,8 @@ export default {
|
|||
return {
|
||||
fileVersions: null,
|
||||
enabled: null,
|
||||
enableUrl: null
|
||||
enableUrl: null,
|
||||
disabledDisclaimer: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -122,6 +122,7 @@ export default {
|
|||
this.fileVersions = response.data.data;
|
||||
this.enabled = response.data.enabled;
|
||||
this.enableUrl = response.data.enable_url;
|
||||
this.disabledDisclaimer = response.data.disabled_disclaimer;
|
||||
this.$nextTick(() => {
|
||||
document.querySelectorAll('[data-render-tooltip]').forEach((e) => {
|
||||
window.initTooltip(e);
|
||||
|
|
|
@ -51,4 +51,11 @@ module VersionedAttachments
|
|||
def enabled?
|
||||
ApplicationSettings.instance.values['versioned_attachments_enabled']
|
||||
end
|
||||
|
||||
def disabled_disclaimer
|
||||
{
|
||||
text: I18n.t('assets.file_versions_modal.disabled_disclaimer'),
|
||||
button: I18n.t('assets.file_versions_modal.enable_button')
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue