Merge pull request #22214 from nextcloud/dashboard/design-fixes
Custom dashboard backgroundpull/13712/head
@ -0,0 +1,71 @@
|
||||
// Show Dashboard background image beneath header
|
||||
#body-user #header {
|
||||
background-size: cover !important;
|
||||
background-position: center 50% !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-attachment: fixed !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
|
||||
// Hide triangle indicators from navigation since they are out of place without the header bar
|
||||
#appmenu li a.active::before,
|
||||
#appmenu li:hover a::before,
|
||||
#appmenu li:hover a.active::before,
|
||||
#appmenu li a:focus::before {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
$has-custom-logo: variable_exists('theming-logo-mime') and $theming-logo-mime != '';
|
||||
|
||||
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));
|
||||
#header .logo {
|
||||
background-image: $image-logo !important;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#app-dashboard > h2 {
|
||||
color: #fff;
|
||||
}
|
||||
#appmenu li span {
|
||||
color: #fff;
|
||||
}
|
||||
#appmenu svg image {
|
||||
filter: invert(0);
|
||||
}
|
||||
#appmenu .icon-more-white,
|
||||
.header-right > div:not(#settings) > *:first-child {
|
||||
filter: invert(1) hue-rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
#header .logo {
|
||||
background-image: $image-logo !important;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#app-dashboard > h2 {
|
||||
color: #000;
|
||||
}
|
||||
#appmenu li span {
|
||||
color: #000;
|
||||
}
|
||||
#appmenu svg {
|
||||
filter: invert(1) hue-rotate(180deg) !important;
|
||||
}
|
||||
#appmenu .icon-more-white,
|
||||
.header-right > div:not(#settings) > *:first-child {
|
||||
filter: invert(1) hue-rotate(180deg) !important;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 249 KiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 1.7 MiB |
After Width: | Height: | Size: 523 KiB |
Before Width: | Height: | Size: 627 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 165 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 186 KiB |
After Width: | Height: | Size: 934 KiB |
After Width: | Height: | Size: 279 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 454 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 239 KiB |
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace OCA\Dashboard\Controller;
|
||||
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\AppFramework\OCSController;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
|
||||
class LayoutApiController extends OCSController {
|
||||
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var string */
|
||||
private $userId;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
$userId
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->config = $config;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*
|
||||
* @param string $layout
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function create(string $layout): JSONResponse {
|
||||
$this->config->setUserValue($this->userId, 'dashboard', 'layout', $layout);
|
||||
return new JSONResponse(['layout' => $layout]);
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace OCA\Dashboard\Service;
|
||||
|
||||
use OCP\Files\IAppData;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\SimpleFS\ISimpleFile;
|
||||
use OCP\IConfig;
|
||||
|
||||
class BackgroundService {
|
||||
public const THEMING_MODE_DARK = 'dark';
|
||||
|
||||
public const SHIPPED_BACKGROUNDS = [
|
||||
'anatoly-mikhaltsov-butterfly-wing-scale.jpg' => [
|
||||
'attribution' => 'Butterfly wing scale (Anatoly Mikhaltsov, CC BY-SA)',
|
||||
'attribution_url' => 'https://commons.wikimedia.org/wiki/File:%D0%A7%D0%B5%D1%88%D1%83%D0%B9%D0%BA%D0%B8_%D0%BA%D1%80%D1%8B%D0%BB%D0%B0_%D0%B1%D0%B0%D0%B1%D0%BE%D1%87%D0%BA%D0%B8.jpg',
|
||||
],
|
||||
'bernie-cetonia-aurata-take-off-composition.jpg' => [
|
||||
'attribution' => 'Cetonia aurata take off composition (Bernie, Public Domain)',
|
||||
'attribution_url' => 'https://commons.wikimedia.org/wiki/File:Cetonia_aurata_take_off_composition_05172009.jpg',
|
||||
'theming' => self::THEMING_MODE_DARK,
|
||||
],
|
||||
'dejan-krsmanovic-ribbed-red-metal.jpg' => [
|
||||
'attribution' => 'Ribbed red metal (Dejan Krsmanovic, CC BY)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/dejankrsmanovic/42971456774/',
|
||||
],
|
||||
'eduardo-neves-pedra-azul.jpg' => [
|
||||
'attribution' => 'Pedra azul milky way (Eduardo Neves, CC BY-SA)',
|
||||
'attribution_url' => 'https://commons.wikimedia.org/wiki/File:Pedra_Azul_Milky_Way.jpg',
|
||||
],
|
||||
'european-space-agency-barents-bloom.jpg' => [
|
||||
'attribution' => 'Barents bloom (European Space Agency, CC BY-SA)',
|
||||
'attribution_url' => 'https://www.esa.int/ESA_Multimedia/Images/2016/08/Barents_bloom',
|
||||
],
|
||||
'hannes-fritz-flippity-floppity.jpg' => [
|
||||
'attribution' => 'Flippity floppity (Hannes Fritz, CC BY-SA)',
|
||||
'attribution_url' => 'http://hannes.photos/flippity-floppity',
|
||||
],
|
||||
'hannes-fritz-roulette.jpg' => [
|
||||
'attribution' => 'Roulette (Hannes Fritz, CC BY-SA)',
|
||||
'attribution_url' => 'http://hannes.photos/roulette',
|
||||
],
|
||||
'hannes-fritz-sea-spray.jpg' => [
|
||||
'attribution' => 'Sea spray (Hannes Fritz, CC BY-SA)',
|
||||
'attribution_url' => 'http://hannes.photos/sea-spray',
|
||||
],
|
||||
'kamil-porembinski-clouds.jpg' => [
|
||||
'attribution' => 'Clouds (Kamil Porembiński, CC BY-SA)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/paszczak000/8715851521/',
|
||||
],
|
||||
'bernard-spragg-new-zealand-fern.jpg' => [
|
||||
'attribution' => 'New zealand fern (Bernard Spragg, CC0)',
|
||||
'attribution_url' => 'https://commons.wikimedia.org/wiki/File:NZ_Fern.(Blechnum_chambersii)_(11263534936).jpg',
|
||||
],
|
||||
'rawpixel-pink-tapioca-bubbles.jpg' => [
|
||||
'attribution' => 'Pink tapioca bubbles (Rawpixel, CC BY)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/byrawpixel/27665140298/in/photostream/',
|
||||
'theming' => self::THEMING_MODE_DARK,
|
||||
],
|
||||
'nasa-waxing-crescent-moon.jpg' => [
|
||||
'attribution' => 'Waxing crescent moon (NASA, Public Domain)',
|
||||
'attribution_url' => 'https://www.nasa.gov/image-feature/a-waxing-crescent-moon',
|
||||
],
|
||||
'tommy-chau-already.jpg' => [
|
||||
'attribution' => 'Cityscape (Tommy Chau, CC BY)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/90975693@N05/16910999368',
|
||||
],
|
||||
'tommy-chau-lion-rock-hill.jpg' => [
|
||||
'attribution' => 'Lion rock hill (Tommy Chau, CC BY)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/90975693@N05/17136440246',
|
||||
'theming' => self::THEMING_MODE_DARK,
|
||||
],
|
||||
'lali-masriera-yellow-bricks.jpg' => [
|
||||
'attribution' => 'Yellow bricks (Lali Masriera, CC BY)',
|
||||
'attribution_url' => 'https://www.flickr.com/photos/visualpanic/3982464447',
|
||||
'theming' => self::THEMING_MODE_DARK,
|
||||
]
|
||||
];
|
||||
/**
|
||||
* @var \OCP\Files\Folder
|
||||
*/
|
||||
private $userFolder;
|
||||
/**
|
||||
* @var \OCP\Files\SimpleFS\ISimpleFolder
|
||||
*/
|
||||
private $dashboardUserFolder;
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
private $userId;
|
||||
|
||||
public function __construct(IRootFolder $rootFolder, IAppData $appData, IConfig $config, $userId) {
|
||||
if ($userId === null) {
|
||||
return;
|
||||
}
|
||||
$this->userFolder = $rootFolder->getUserFolder($userId);
|
||||
try {
|
||||
$this->dashboardUserFolder = $appData->getFolder($userId);
|
||||
} catch (NotFoundException $e) {
|
||||
$this->dashboardUserFolder = $appData->newFolder($userId);
|
||||
}
|
||||
$this->config = $config;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function setDefaultBackground(): void {
|
||||
$this->config->deleteUserValue($this->userId, 'dashboard', 'background');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @throws NotFoundException
|
||||
* @throws \OCP\Files\NotPermittedException
|
||||
* @throws \OCP\PreConditionNotMetException
|
||||
*/
|
||||
public function setFileBackground($path): void {
|
||||
$this->config->setUserValue($this->userId, 'dashboard', 'background', 'custom');
|
||||
/** @var \OCP\Files\File $file */
|
||||
$file = $this->userFolder->get($path);
|
||||
$this->dashboardUserFolder->newFile('background.jpg', $file->fopen('r'));
|
||||
}
|
||||
|
||||
public function setShippedBackground($fileName): void {
|
||||
if (!array_key_exists($fileName, self::SHIPPED_BACKGROUNDS)) {
|
||||
throw new \InvalidArgumentException('The given file name is invalid');
|
||||
}
|
||||
$this->config->setUserValue($this->userId, 'dashboard', 'background', $fileName);
|
||||
}
|
||||
|
||||
public function setColorBackground(string $color): void {
|
||||
if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $color)) {
|
||||
throw new \InvalidArgumentException('The given color is invalid');
|
||||
}
|
||||
$this->config->setUserValue($this->userId, 'dashboard', 'background', $color);
|
||||
}
|
||||
|
||||
public function getBackground(): ?ISimpleFile {
|
||||
$background = $this->config->getUserValue($this->userId, 'dashboard', 'background', 'default');
|
||||
if ($background === 'custom') {
|
||||
try {
|
||||
return $this->dashboardUserFolder->getFile('background.jpg');
|
||||
} catch (NotFoundException $e) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
<!--
|
||||
- @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||
-
|
||||
- @author Julius Härtl <jus@bitgrid.net>
|
||||
-
|
||||
- @license GNU AGPL version 3 or any later version
|
||||
-
|
||||
- This program is free software: you can redistribute it and/or modify
|
||||
- it under the terms of the GNU Affero General Public License as
|
||||
- published by the Free Software Foundation, either version 3 of the
|
||||
- License, or (at your option) any later version.
|
||||
-
|
||||
- This program is distributed in the hope that it will be useful,
|
||||
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
- GNU Affero General Public License for more details.
|
||||
-
|
||||
- You should have received a copy of the GNU Affero General Public License
|
||||
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="background-selector">
|
||||
<a class="background filepicker"
|
||||
:class="{ active: background === 'custom' }"
|
||||
tabindex="0"
|
||||
@click="pickFile"
|
||||
@keyup.enter="pickFile"
|
||||
@keyup.space="pickFile">
|
||||
{{ t('dashboard', 'Pick from files') }}
|
||||
</a>
|
||||
<a class="background default"
|
||||
tabindex="0"
|
||||
:class="{ 'icon-loading': loading === 'default', active: background === 'default' }"
|
||||
@click="setDefault"
|
||||
@keyup.enter="setDefault"
|
||||
@keyup.space="setDefault">
|
||||
{{ t('dashboard', 'Default images') }}
|
||||
</a>
|
||||
<a class="background color"
|
||||
:class="{ active: background === 'custom' }"
|
||||
tabindex="0"
|
||||
@click="pickColor"
|
||||
@keyup.enter="pickColor"
|
||||
@keyup.space="pickColor">
|
||||
{{ t('dashboard', 'Plain background') }}
|
||||
</a>
|
||||
<a 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)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import getBackgroundUrl from './../helpers/getBackgroundUrl'
|
||||
import prefixWithBaseUrl from './../helpers/prefixWithBaseUrl'
|
||||
const shippedBackgroundList = loadState('dashboard', 'shippedBackgrounds')
|
||||
|
||||
export default {
|
||||
name: 'BackgroundSettings',
|
||||
props: {
|
||||
background: {
|
||||
type: String,
|
||||
default: 'default',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
backgroundImage: generateUrl('/apps/dashboard/background') + '?v=' + Date.now(),
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
shippedBackgrounds() {
|
||||
return Object.keys(shippedBackgroundList).map((item) => {
|
||||
return {
|
||||
name: item,
|
||||
url: prefixWithBaseUrl(item),
|
||||
preview: prefixWithBaseUrl('previews/' + item),
|
||||
details: shippedBackgroundList[item],
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
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.$emit('updateBackground', data)
|
||||
this.loading = false
|
||||
return
|
||||
}
|
||||
const image = new Image()
|
||||
image.onload = () => {
|
||||
this.$emit('updateBackground', data)
|
||||
this.loading = false
|
||||
}
|
||||
image.src = this.backgroundImage
|
||||
},
|
||||
async setDefault() {
|
||||
this.loading = 'default'
|
||||
const result = await axios.post(generateUrl('/apps/dashboard/background/default'))
|
||||
this.update(result.data)
|
||||
},
|
||||
async setShipped(shipped) {
|
||||
this.loading = shipped
|
||||
const result = await axios.post(generateUrl('/apps/dashboard/background/shipped'), { value: shipped })
|
||||
this.update(result.data)
|
||||
},
|
||||
async setFile(path) {
|
||||
this.loading = 'custom'
|
||||
const result = await axios.post(generateUrl('/apps/dashboard/background/custom'), { value: path })
|
||||
this.update(result.data)
|
||||
},
|
||||
async pickColor() {
|
||||
this.loading = 'color'
|
||||
const color = OCA && OCA.Theming ? OCA.Theming.color : '#0082c9'
|
||||
const result = await axios.post(generateUrl('/apps/dashboard/background/color'), { value: color })
|
||||
this.update(result.data)
|
||||
},
|
||||
pickFile() {
|
||||
window.OC.dialogs.filepicker(t('dashboard', 'Insert from {productName}', { productName: OC.theme.name }), (path, type) => {
|
||||
if (type === OC.dialogs.FILEPICKER_TYPE_CHOOSE) {
|
||||
this.setFile(path)
|
||||
}
|
||||
}, false, ['image/png', 'image/gif', 'image/jpeg', 'image/svg'], true, OC.dialogs.FILEPICKER_TYPE_CHOOSE)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.background-selector {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
.background {
|
||||
width: 176px;
|
||||
height: 96px;
|
||||
margin: 8px;
|
||||
background-size: cover;
|
||||
background-position: center center;
|
||||
text-align: center;
|
||||
border-radius: var(--border-radius-large);
|
||||
border: 2px solid var(--color-main-background);
|
||||
overflow: hidden;
|
||||
|
||||
&.current {
|
||||
background-image: var(--color-background-dark);
|
||||
}
|
||||
|
||||
&.filepicker, &.default, &.color {
|
||||
border-color: var(--color-border);
|
||||
line-height: 96px;
|
||||
}
|
||||
|
||||
&.color {
|
||||
background-color: var(--color-primary);
|
||||
color: var(--color-primary-text);
|
||||
}
|
||||
|
||||
&.active,
|
||||
&:hover,
|
||||
&:focus {
|
||||
border: 2px solid var(--color-primary);
|
||||
}
|
||||
|
||||
&.active:not(.icon-loading):after {
|
||||
background-image: var(--icon-checkmark-fff);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 44px;
|
||||
content: '';
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import prefixWithBaseUrl from './prefixWithBaseUrl'
|
||||
|
||||
export default (background, time = 0) => {
|
||||
if (background === 'default') {
|
||||
if (window.OCA.Accessibility.theme === 'dark') {
|
||||
return prefixWithBaseUrl('eduardo-neves-pedra-azul.jpg')
|
||||
}
|
||||
return prefixWithBaseUrl('kamil-porembinski-clouds.jpg')
|
||||
} else if (background === 'custom') {
|
||||
return generateUrl('/apps/dashboard/background') + '?v=' + time
|
||||
}
|
||||
return prefixWithBaseUrl(background)
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
import { generateFilePath } from '@nextcloud/router'
|
||||
|
||||
export default (url) => generateFilePath('dashboard', '', 'img/') + url
|