Add character names to the end of their URL's
Closes #21, makes links to characters human readable
This commit is contained in:
@@ -125,7 +125,7 @@ Migrations.add({
|
||||
}
|
||||
});
|
||||
var effect = Effects.findOne({
|
||||
charId: char._id, name: "Natural Carrying Capacity"
|
||||
charId: char._id, name: "Natural Carrying Capacity",
|
||||
});
|
||||
if (effect) return;
|
||||
Effects.insert({
|
||||
@@ -141,7 +141,7 @@ Migrations.add({
|
||||
},
|
||||
});
|
||||
effect = Effects.findOne({
|
||||
charId: char._id, name: "Natural Carrying Capacity"
|
||||
charId: char._id, name: "Natural Carrying Capacity",
|
||||
});
|
||||
if (!effect) throw "Carry capacity effect should be set by now."
|
||||
});
|
||||
@@ -150,3 +150,19 @@ Migrations.add({
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 5,
|
||||
name: "Gives all characters a URL name",
|
||||
up: function() {
|
||||
//update characters
|
||||
Characters.find({}).forEach(function(char){
|
||||
if (char.urlName) return;
|
||||
var urlName = getSlug(char.name, {maintainCase: true});
|
||||
Characters.update(char._id, {$set: {urlName}});
|
||||
});
|
||||
},
|
||||
down: function(){
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ Meteor.publish("characterList", function(){
|
||||
{
|
||||
fields: {
|
||||
name: 1,
|
||||
urlName: 1,
|
||||
race: 1,
|
||||
alignment: 1,
|
||||
gender: 1,
|
||||
|
||||
Reference in New Issue
Block a user