зеркало из https://github.com/nextcloud/photos.git
Коммит
502ffb413f
|
@ -33,6 +33,7 @@ use OCP\EventDispatcher\IEventDispatcher;
|
||||||
use OCP\IInitialStateService;
|
use OCP\IInitialStateService;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
use OCP\IConfig;
|
||||||
|
|
||||||
class PageController extends Controller {
|
class PageController extends Controller {
|
||||||
|
|
||||||
|
@ -47,12 +48,14 @@ class PageController extends Controller {
|
||||||
public function __construct($appName,
|
public function __construct($appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
IEventDispatcher $eventDispatcher,
|
IEventDispatcher $eventDispatcher,
|
||||||
|
IConfig $config,
|
||||||
IInitialStateService $initialStateService) {
|
IInitialStateService $initialStateService) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
||||||
$this->appName = $appName;
|
$this->appName = $appName;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->initialStateService = $initialStateService;
|
$this->initialStateService = $initialStateService;
|
||||||
|
$this->config = $config;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +71,7 @@ class PageController extends Controller {
|
||||||
$this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());
|
$this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());
|
||||||
|
|
||||||
$this->initialStateService->provideInitialState($this->appName, 'mimes', Application::MIMES);
|
$this->initialStateService->provideInitialState($this->appName, 'mimes', Application::MIMES);
|
||||||
|
$this->initialStateService->provideInitialState($this->appName, 'maps', $this->config->getAppValue('maps', 'enabled', 'no') === 'yes');
|
||||||
|
|
||||||
Util::addScript($this->appName, 'photos');
|
Util::addScript($this->appName, 'photos');
|
||||||
Util::addStyle($this->appName, 'icons');
|
Util::addStyle($this->appName, 'icons');
|
||||||
|
@ -75,5 +79,4 @@ class PageController extends Controller {
|
||||||
$response = new TemplateResponse($this->appName, 'main');
|
$response = new TemplateResponse($this->appName, 'main');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,15 @@ import Vue from 'vue'
|
||||||
import Albums from '../views/Albums'
|
import Albums from '../views/Albums'
|
||||||
import Timeline from '../views/Timeline'
|
import Timeline from '../views/Timeline'
|
||||||
import Tags from '../views/Tags'
|
import Tags from '../views/Tags'
|
||||||
|
import isMapsInstalled from '../services/IsMapsInstalled'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
|
|
||||||
|
let mapsPath = generateUrl('/apps/maps')
|
||||||
|
if (!isMapsInstalled) {
|
||||||
|
mapsPath = generateUrl('/settings/apps/integration/maps')
|
||||||
|
}
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
// if index.php is in the url AND we got this far, then it's working:
|
// if index.php is in the url AND we got this far, then it's working:
|
||||||
|
@ -86,7 +92,10 @@ export default new Router({
|
||||||
{
|
{
|
||||||
path: '/maps',
|
path: '/maps',
|
||||||
name: 'maps',
|
name: 'maps',
|
||||||
redirect: '',
|
// router-link doesn't support external url, let's force the redirect
|
||||||
|
beforeEnter() {
|
||||||
|
location.href = mapsPath
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||||
|
*
|
||||||
|
* @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 { loadState } from '@nextcloud/initial-state'
|
||||||
|
|
||||||
|
const maps = loadState('photos', 'maps')
|
||||||
|
export default maps
|
Загрузка…
Ссылка в новой задаче