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 user: current_user
).as_json.merge( ).as_json.merge(
enabled: VersionedAttachments.enabled?, 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 end

View file

@ -67,7 +67,7 @@
</div> </div>
<div> <div>
<h3 class="mt-1 mb-2">{{ i18n.t('assets.file_versions_modal.title') }}</h3> <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> </div>
</div> </div>
@ -76,7 +76,7 @@
{{ i18n.t('general.cancel') }} {{ i18n.t('general.cancel') }}
</button> </button>
<a v-if="fileVersions && !enabled" :href="enableUrl" class='btn btn-primary' target="_blank"> <a v-if="fileVersions && !enabled" :href="enableUrl" class='btn btn-primary' target="_blank">
{{ i18n.t('assets.file_versions_modal.enable_button') }} {{ disabledDisclaimer.button }}
</a> </a>
</div> </div>
</div> </div>
@ -96,8 +96,7 @@ export default {
required: true required: true
}, },
restoreVersionUrl: { restoreVersionUrl: {
type: String, type: String
required: true
} }
}, },
mixins: [modalMixin], mixins: [modalMixin],
@ -105,7 +104,8 @@ export default {
return { return {
fileVersions: null, fileVersions: null,
enabled: null, enabled: null,
enableUrl: null enableUrl: null,
disabledDisclaimer: null
}; };
}, },
created() { created() {
@ -122,6 +122,7 @@ export default {
this.fileVersions = response.data.data; this.fileVersions = response.data.data;
this.enabled = response.data.enabled; this.enabled = response.data.enabled;
this.enableUrl = response.data.enable_url; this.enableUrl = response.data.enable_url;
this.disabledDisclaimer = response.data.disabled_disclaimer;
this.$nextTick(() => { this.$nextTick(() => {
document.querySelectorAll('[data-render-tooltip]').forEach((e) => { document.querySelectorAll('[data-render-tooltip]').forEach((e) => {
window.initTooltip(e); window.initTooltip(e);

View file

@ -51,4 +51,11 @@ module VersionedAttachments
def enabled? def enabled?
ApplicationSettings.instance.values['versioned_attachments_enabled'] ApplicationSettings.instance.values['versioned_attachments_enabled']
end end
def disabled_disclaimer
{
text: I18n.t('assets.file_versions_modal.disabled_disclaimer'),
button: I18n.t('assets.file_versions_modal.enable_button')
}
end
end end