Added pretty url's from v1
This commit is contained in:
5
app/imports/api/creature/creatures/getCreatureUrlName.js
Normal file
5
app/imports/api/creature/creatures/getCreatureUrlName.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import getSlug from 'speakingurl';
|
||||
|
||||
export default function getCreatureUrlName({name}){
|
||||
return getSlug(name, {maintainCase: true}) || '-';
|
||||
}
|
||||
@@ -66,9 +66,10 @@
|
||||
import Creatures from '/imports/api/creature/creatures/Creatures.js';
|
||||
import CreatureFolders from '/imports/api/creature/creatureFolders/CreatureFolders.js';
|
||||
import CreatureFolderList from '/imports/ui/creature/creatureList/CreatureFolderList.vue';
|
||||
import getCreatureUrlName from '/imports/api/creature/creatures/getCreatureUrlName.js';
|
||||
|
||||
const characterTransform = function(char){
|
||||
char.url = `/character/${char._id}/${char.urlName || '-'}`;
|
||||
char.url = `/character/${char._id}/${getCreatureUrlName(char)}`;
|
||||
char.initial = char.name && char.name[0] || '?';
|
||||
return char;
|
||||
};
|
||||
|
||||
@@ -82,9 +82,10 @@
|
||||
import {snackbar} from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||
import CreatureFolderList from '/imports/ui/creature/creatureList/CreatureFolderList.vue';
|
||||
import ArchiveButton from '/imports/ui/creature/creatureList/ArchiveButton.vue';
|
||||
import getCreatureUrlName from '/imports/api/creature/creatures/getCreatureUrlName.js';
|
||||
|
||||
const characterTransform = function(char){
|
||||
char.url = `/character/${char._id}/${char.urlName || '-'}`;
|
||||
char.url = `/character/${char._id}/${getCreatureUrlName(char)}`;
|
||||
char.initial = char.name && char.name[0] || '?';
|
||||
return char;
|
||||
};
|
||||
|
||||
@@ -130,18 +130,9 @@ RouterFactory.configure(factory => {
|
||||
meta: {
|
||||
title: 'Library',
|
||||
},
|
||||
},{
|
||||
path: '/character/:id/:urlName',
|
||||
components: {
|
||||
default: CharacterSheetPage,
|
||||
toolbar: CharacterSheetToolbar,
|
||||
rightDrawer: CharacterSheetRightDrawer,
|
||||
},
|
||||
meta: {
|
||||
title: 'Character Sheet',
|
||||
},
|
||||
},{
|
||||
path: '/character/:id',
|
||||
alias: '/character/:id/:urlName',
|
||||
components: {
|
||||
default: CharacterSheetPage,
|
||||
toolbar: CharacterSheetToolbar,
|
||||
|
||||
23
app/package-lock.json
generated
23
app/package-lock.json
generated
@@ -2330,6 +2330,11 @@
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
|
||||
},
|
||||
"mongo-object": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/mongo-object/-/mongo-object-0.1.4.tgz",
|
||||
@@ -2805,6 +2810,11 @@
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"speakingurl": {
|
||||
"version": "14.0.1",
|
||||
"resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz",
|
||||
"integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
@@ -2956,9 +2966,9 @@
|
||||
}
|
||||
},
|
||||
"tar": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
|
||||
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==",
|
||||
"version": "6.1.6",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.6.tgz",
|
||||
"integrity": "sha512-oaWyu5dQbHaYcyZCTfyPpC+VmI62/OM2RTUYavTk1MDr1cwW5Boi3baeYQKiZbY2uSQJGr+iMOzb/JFxLrft+g==",
|
||||
"requires": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
@@ -2966,13 +2976,6 @@
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"text-table": {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
"request": "^2.88.2",
|
||||
"simpl-schema": "^1.12.0",
|
||||
"source-map-support": "^0.5.16",
|
||||
"speakingurl": "^14.0.1",
|
||||
"styles": "^0.2.1",
|
||||
"underscore": "^1.13.1",
|
||||
"vue": "2.6.10",
|
||||
|
||||
Reference in New Issue
Block a user