Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/photos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2019-12-05 14:38:50 +0300
committerGitHub <noreply@github.com>2019-12-05 14:38:50 +0300
commit502ffb413f7bb51cf200865e26d295c7c35e2456 (patch)
tree810b6a4cb99392a65ac65b83f4665da79c374df2
parent8d79a2b9f4bb9473f1f5868e631ef2b6b63602d0 (diff)
parent82a63d9897c02ab12b334f0caf955744f7a03f17 (diff)
Maps navigation entry (#13)
Maps navigation entry
-rw-r--r--lib/Controller/PageController.php5
-rw-r--r--src/router/index.js11
-rw-r--r--src/services/IsMapsInstalled.js26
3 files changed, 40 insertions, 2 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 593f7c1b..5fd2ca0d 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -33,6 +33,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\IInitialStateService;
use OCP\IRequest;
use OCP\Util;
+use OCP\IConfig;
class PageController extends Controller {
@@ -47,12 +48,14 @@ class PageController extends Controller {
public function __construct($appName,
IRequest $request,
IEventDispatcher $eventDispatcher,
+ IConfig $config,
IInitialStateService $initialStateService) {
parent::__construct($appName, $request);
$this->appName = $appName;
$this->eventDispatcher = $eventDispatcher;
$this->initialStateService = $initialStateService;
+ $this->config = $config;
}
@@ -68,6 +71,7 @@ class PageController extends Controller {
$this->eventDispatcher->dispatch(LoadViewer::class, new LoadViewer());
$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::addStyle($this->appName, 'icons');
@@ -75,5 +79,4 @@ class PageController extends Controller {
$response = new TemplateResponse($this->appName, 'main');
return $response;
}
-
}
diff --git a/src/router/index.js b/src/router/index.js
index a5372a59..c6cc453c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -27,9 +27,15 @@ import Vue from 'vue'
import Albums from '../views/Albums'
import Timeline from '../views/Timeline'
import Tags from '../views/Tags'
+import isMapsInstalled from '../services/IsMapsInstalled'
Vue.use(Router)
+let mapsPath = generateUrl('/apps/maps')
+if (!isMapsInstalled) {
+ mapsPath = generateUrl('/settings/apps/integration/maps')
+}
+
export default new Router({
mode: 'history',
// 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',
name: 'maps',
- redirect: '',
+ // router-link doesn't support external url, let's force the redirect
+ beforeEnter() {
+ location.href = mapsPath
+ },
},
],
})
diff --git a/src/services/IsMapsInstalled.js b/src/services/IsMapsInstalled.js
new file mode 100644
index 00000000..1c841628
--- /dev/null
+++ b/src/services/IsMapsInstalled.js
@@ -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