summaryrefslogtreecommitdiffstats
path: root/apps/dashboard/src
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2020-10-20 12:36:41 +0200
committernpmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>2020-11-13 06:51:26 +0000
commitf5ef2d7d5897bb490f2a10792760f809a68e4c00 (patch)
tree04dcf6c646b10405a799e6d793137052fd848e02 /apps/dashboard/src
parent35be4fdb019da658a824f41dc4bf0f415c032cb8 (diff)
downloadnextcloud-server-f5ef2d7d5897bb490f2a10792760f809a68e4c00.tar.gz
nextcloud-server-f5ef2d7d5897bb490f2a10792760f809a68e4c00.zip
override default dashboard background with theming one
fix getAppValue default value in theming app fix cacheBuster value injection Signed-off-by: Julien Veyssier <eneiluj@posteo.net> Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/dashboard/src')
-rw-r--r--apps/dashboard/src/App.vue13
-rw-r--r--apps/dashboard/src/components/BackgroundSettings.vue8
-rw-r--r--apps/dashboard/src/helpers/getBackgroundUrl.js5
3 files changed, 18 insertions, 8 deletions
diff --git a/apps/dashboard/src/App.vue b/apps/dashboard/src/App.vue
index 0d09bcc4537..c5eed836faa 100644
--- a/apps/dashboard/src/App.vue
+++ b/apps/dashboard/src/App.vue
@@ -68,7 +68,9 @@
<a v-if="isAdmin" :href="appStoreUrl" class="button">{{ t('dashboard', 'Get more widgets from the app store') }}</a>
<h3>{{ t('dashboard', 'Change background image') }}</h3>
- <BackgroundSettings :background="background" @update:background="updateBackground" />
+ <BackgroundSettings :background="background"
+ :theming-default-background="themingDefaultBackground"
+ @update:background="updateBackground" />
<h3>{{ t('dashboard', 'Weather service') }}</h3>
<p>
@@ -95,11 +97,11 @@ import { generateUrl } from '@nextcloud/router'
import isMobile from './mixins/isMobile'
import BackgroundSettings from './components/BackgroundSettings'
import getBackgroundUrl from './helpers/getBackgroundUrl'
-import prefixWithBaseUrl from './helpers/prefixWithBaseUrl'
const panels = loadState('dashboard', 'panels')
const firstRun = loadState('dashboard', 'firstRun')
const background = loadState('dashboard', 'background')
+const themingDefaultBackground = loadState('dashboard', 'themingDefaultBackground')
const version = loadState('dashboard', 'version')
const shippedBackgroundList = loadState('dashboard', 'shippedBackgrounds')
const statusInfo = {
@@ -142,16 +144,17 @@ export default {
appStoreUrl: generateUrl('/settings/apps/dashboard'),
statuses: {},
background,
+ themingDefaultBackground,
version,
- defaultBackground: window.OCA.Accessibility?.theme === 'dark' ? prefixWithBaseUrl('flickr-148302424@N05-36591009215.jpg?v=1') : prefixWithBaseUrl('flickr-paszczak000-8715851521.jpg?v=1'),
}
},
computed: {
backgroundImage() {
- return getBackgroundUrl(this.background, this.version)
+ return getBackgroundUrl(this.background, this.version, this.themingDefaultBackground)
},
backgroundStyle() {
- if (this.background.match(/#[0-9A-Fa-f]{6}/g)) {
+ if ((this.background === 'default' && this.themingDefaultBackground === 'backgroundColor')
+ || this.background.match(/#[0-9A-Fa-f]{6}/g)) {
return null
}
return {
diff --git a/apps/dashboard/src/components/BackgroundSettings.vue b/apps/dashboard/src/components/BackgroundSettings.vue
index be94737fdad..936cfdef486 100644
--- a/apps/dashboard/src/components/BackgroundSettings.vue
+++ b/apps/dashboard/src/components/BackgroundSettings.vue
@@ -66,6 +66,10 @@ export default {
type: String,
default: 'default',
},
+ themingDefaultBackground: {
+ type: String,
+ default: '',
+ },
},
data() {
return {
@@ -88,8 +92,8 @@ export default {
methods: {
async update(data) {
const background = data.type === 'custom' || data.type === 'default' ? data.type : data.value
- this.backgroundImage = getBackgroundUrl(background, data.version)
- if (data.type === 'color') {
+ this.backgroundImage = getBackgroundUrl(background, data.version, this.themingDefaultBackground)
+ if (data.type === 'color' || (data.type === 'default' && this.themingDefaultBackground === 'backgroundColor')) {
this.$emit('update:background', data)
this.loading = false
return
diff --git a/apps/dashboard/src/helpers/getBackgroundUrl.js b/apps/dashboard/src/helpers/getBackgroundUrl.js
index 6090786884c..3af48030534 100644
--- a/apps/dashboard/src/helpers/getBackgroundUrl.js
+++ b/apps/dashboard/src/helpers/getBackgroundUrl.js
@@ -23,8 +23,11 @@
import { generateUrl } from '@nextcloud/router'
import prefixWithBaseUrl from './prefixWithBaseUrl'
-export default (background, time = 0) => {
+export default (background, time = 0, themingDefaultBackground = '') => {
if (background === 'default') {
+ if (themingDefaultBackground && themingDefaultBackground !== 'backgroundColor') {
+ return generateUrl('/apps/theming/image/background') + '?v=' + window.OCA.Theming.cacheBuster
+ }
if (window.OCA.Accessibility.theme === 'dark') {
return prefixWithBaseUrl('eduardo-neves-pedra-azul.jpg')
}