Merge pull request #8027 from artoscinote/ma_SCI_11040

Make file versioning disclaimer overridable [SCI-11040]
This commit is contained in:
Martin Artnik 2024-11-08 14:38:01 +01:00 committed by GitHub
commit 8912bb44b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View file

@ -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

View file

@ -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);

View file

@ -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