Use nextcloud-router

This commit is contained in:
Marcel Klehr 2019-08-26 16:38:25 +02:00
parent e24a2a4d6c
commit 0b48c5c75b
7 changed files with 28 additions and 7 deletions

15
package-lock.json generated
View File

@ -6423,6 +6423,21 @@
"axios": "^0.19.0"
}
},
"nextcloud-router": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/nextcloud-router/-/nextcloud-router-0.0.6.tgz",
"integrity": "sha512-dpSqy9Ot7zfP3pF0cWRk2aTOXiAD1xryW3HvGeR+EMARothEf04FiK83CwCWin1OqLee9KLrVmvMVT+QfIDsfg==",
"requires": {
"core-js": "^3.1.4"
},
"dependencies": {
"core-js": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz",
"integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw=="
}
}
},
"nextcloud-server": {
"version": "0.15.10",
"resolved": "https://registry.npmjs.org/nextcloud-server/-/nextcloud-server-0.15.10.tgz",

View File

@ -23,6 +23,7 @@
"@babel/polyfill": "^7.4.4",
"humanize-duration": "^3.20.1",
"nextcloud-axios": "^0.2.0",
"nextcloud-router": "0.0.6",
"nextcloud-server": "^0.15.10",
"nextcloud-vue": "^0.12.0",
"uuid": "^3.3.2",

View File

@ -63,6 +63,7 @@
</template>
<script>
import { Actions, ActionButton } from 'nextcloud-vue';
import { generateUrl } from 'nextcloud-router'
import { actions, mutations } from '../store';
import TagLine from './TagLine';
@ -84,12 +85,12 @@ export default {
},
computed: {
iconUrl() {
return OC.generateUrl(
return generateUrl(
'/apps/bookmarks/bookmark/' + this.bookmark.id + '/favicon'
);
},
imageUrl() {
return OC.generateUrl(
return generateUrl(
'/apps/bookmarks/bookmark/' + this.bookmark.id + '/image'
);
},

View File

@ -102,6 +102,7 @@
</div>
</template>
<script>
import { generateUrl } from 'nextcloud-router'
import { actions } from '../store';
export default {
name: 'Settings',
@ -112,13 +113,13 @@ export default {
},
bookmarklet() {
const bookmarkletUrl
= window.location.origin + OC.generateUrl('/apps/bookmarks/bookmarklet');
= window.location.origin + generateUrl('/apps/bookmarks/bookmarklet');
return `javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('${bookmarkletUrl}?output=popup&url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=500px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();`;
},
rssURL() {
return (
window.location.origin
+ OC.generateUrl(
+ generateUrl(
'/apps/bookmarks/public/rest/v2/bookmark?'
+ $.param(
Object.assign({}, this.$store.state.fetchState.query, {

View File

@ -45,6 +45,7 @@
</template>
<script>
import { AppSidebar, AppSidebarTab, Multiselect } from 'nextcloud-vue';
import { generateUrl } from 'nextcloud-router'
import humanizeDuration from 'humanize-duration';
import { actions, mutations } from '../store';
@ -68,7 +69,7 @@ export default {
return this.$store.getters.getBookmark(this.$store.state.sidebar.id);
},
background() {
return OC.generateUrl(
return generateUrl(
`/apps/bookmarks/bookmark/${this.bookmark.id}/image`
);
},

View File

@ -1,12 +1,13 @@
import Vue from 'vue';
import Router from 'vue-router';
import ViewPrivate from './components/ViewPrivate';
import { generateUrl } from 'nextcloud-router';
Vue.use(Router);
export default new Router({
mode: 'hash',
base: OC.generateUrl('/apps/bookmarks'),
base: generateUrl('/apps/bookmarks'),
linkActiveClass: 'active',
routes: [
{

View File

@ -1,6 +1,7 @@
import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'nextcloud-axios';
import { generateUrl } from 'nextcloud-router';
import AppGlobal from './mixins/AppGlobal';
Vue.use(Vuex);
@ -717,7 +718,7 @@ export default new Vuex.Store({
function url(url) {
url = `/apps/bookmarks${url}`;
return OC.generateUrl(url);
return generateUrl(url);
}
function findFolder(id, children) {