Small fixes to cleanup code

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/22307/head
Julius Härtl 4 years ago committed by Julien Veyssier
parent 077e2fec74
commit 8a3016565f
No known key found for this signature in database
GPG Key ID: 4141FEE162030638

@ -20,7 +20,7 @@
$has-custom-logo: variable_exists('theming-logo-mime') and $theming-logo-mime != '';
body.dashboard-inverted:not(.dashboard-dark) {
body.dashboard--inverted:not(.dashboard--dark) {
// Do not invert the default logo
@if ($has-custom-logo == false) {
$image-logo: url(icon-color-path('logo', 'logo', #ffffff, 1, true));
@ -45,7 +45,7 @@ body.dashboard-inverted:not(.dashboard-dark) {
}
}
body.dashboard-dark:not(.dashboard-inverted) {
body.dashboard--dark:not(.dashboard--inverted) {
// invert the default logo
@if ($has-custom-logo == false) {
$image-logo: url(icon-color-path('logo', 'logo', #000000, 1, true));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -134,8 +134,8 @@ class DashboardController extends Controller {
/**
* @NoAdminRequired
*/
public function setBackground(string $type, string $value): JSONResponse {
$currentVersion = (int)$this->config->getUserValue($this->userId, 'dashboard', 'backgroundVersion', 0);
public function setBackground(string $type = 'default', string $value = ''): JSONResponse {
$currentVersion = (int)$this->config->getUserValue($this->userId, 'dashboard', 'backgroundVersion', '0');
try {
switch ($type) {
case 'shipped':

@ -58,7 +58,7 @@
<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" @updateBackground="updateBackground" />
<BackgroundSettings :background="background" @update:background="updateBackground" />
</div>
</Modal>
</div>
@ -275,14 +275,14 @@ export default {
updateGlobalStyles() {
document.body.setAttribute('data-dashboard-background', this.background)
if (window.OCA.Theming.inverted) {
document.body.classList.add('dashboard-inverted')
document.body.classList.add('dashboard--inverted')
}
const shippedBackgroundTheme = shippedBackgroundList[this.background] ? shippedBackgroundList[this.background].theming : 'light'
if (shippedBackgroundTheme === 'dark') {
document.body.classList.add('dashboard-dark')
document.body.classList.add('dashboard--dark')
} else {
document.body.classList.remove('dashboard-dark')
document.body.classList.remove('dashboard--dark')
}
},
},

@ -22,40 +22,32 @@
<template>
<div class="background-selector">
<a class="background filepicker"
<button class="background filepicker"
:class="{ active: background === 'custom' }"
tabindex="0"
@click="pickFile"
@keyup.enter="pickFile"
@keyup.space="pickFile">
@click="pickFile">
{{ t('dashboard', 'Pick from files') }}
</a>
<a class="background default"
</button>
<button class="background default"
tabindex="0"
:class="{ 'icon-loading': loading === 'default', active: background === 'default' }"
@click="setDefault"
@keyup.enter="setDefault"
@keyup.space="setDefault">
@click="setDefault">
{{ t('dashboard', 'Default images') }}
</a>
<a class="background color"
</button>
<button class="background color"
:class="{ active: background === 'custom' }"
tabindex="0"
@click="pickColor"
@keyup.enter="pickColor"
@keyup.space="pickColor">
@click="pickColor">
{{ t('dashboard', 'Plain background') }}
</a>
<a v-for="shippedBackground in shippedBackgrounds"
</button>
<button v-for="shippedBackground in shippedBackgrounds"
:key="shippedBackground.name"
v-tooltip="shippedBackground.details.attribution"
:class="{ 'icon-loading': loading === shippedBackground.name, active: background === shippedBackground.name }"
tabindex="0"
class="background"
:style="{ 'background-image': 'url(' + shippedBackground.preview + ')' }"
@click="setShipped(shippedBackground.name)"
@keyup.enter="setShipped(shippedBackground.name)"
@keyup.space="setShipped(shippedBackground.name)" />
@click="setShipped(shippedBackground.name)" />
</div>
</template>
@ -98,13 +90,13 @@ export default {
const background = data.type === 'custom' || data.type === 'default' ? data.type : data.value
this.backgroundImage = getBackgroundUrl(background, data.version)
if (data.type === 'color') {
this.$emit('updateBackground', data)
this.$emit('update:background', data)
this.loading = false
return
}
const image = new Image()
image.onload = () => {
this.$emit('updateBackground', data)
this.$emit('update:background', data)
this.loading = false
}
image.src = this.backgroundImage

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save