Skip to content

Commit

Permalink
fix(NcSettingsSection): Force limit width on Nextcloud 30+
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed May 17, 2024
1 parent 7d1ac4f commit 1627a5c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/NcSettingsSection/NcSettingsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ This component is to be used in the settings section of nextcloud.
<NcSettingsSection
name="Two-Factor Authentication"
description="Two-factor authentication can be enforced for all users and specific groups."
doc-url="https://docs.nextcloud.com/server/19/go.php?to=admin-2fa"
:limit-width="true">
doc-url="https://docs.nextcloud.com/server/19/go.php?to=admin-2fa">
<p>Your settings here</p>
</NcSettingsSection>
</template>
```
</docs>

<template>
<div class="settings-section" :class="{'settings-section--limit-width': limitWidth}">
<div class="settings-section" :class="{'settings-section--limit-width': forceLimitWidth}">
<h2 class="settings-section__name">
{{ name }}
<a v-if="hasDocUrl"
Expand Down Expand Up @@ -91,8 +90,9 @@ export default {
/**
* Limit the width of the setting's content
*
* By default only the name and description have a limit, use this
* property to also apply this to the rest of the content.
* Setting this to false allows unrestricted (width) settings content.
* Note that the name and description have always a width limit.
* @deprecated Will be removed with next version and will not be used on Nextcloud 30+ (always forced to true)
*/
limitWidth: {
type: Boolean,
Expand All @@ -109,6 +109,15 @@ export default {
},
computed: {
forceLimitWidth() {
if (this.limitWidth) {
return true
}
// Overwrite this on Nextcloud 30+ to always limit the width
const [major] = window._oc_config?.version.split('.', 2) ?? []
return major && Number.parseInt(major) >= 30
},
hasDescription() {
return this.description.length > 0
},
Expand Down

0 comments on commit 1627a5c

Please sign in to comment.