#32 fix social media ucinają gwiazdkę z `/on*`

This commit is contained in:
Avris 2020-08-03 14:54:43 +02:00
parent cbf360fcab
commit e2ff62303c
2 changed files with 8 additions and 5 deletions

View File

@ -77,7 +77,7 @@
templates: templates,
getTemplate: getTemplate,
selectedTemplate: buildTemplate(templates, this.$route.path.substr(1)),
selectedTemplate: buildTemplate(templates, this.$route.path.substr(1).replace(/\/$/, '')),
counter: 0,
}
@ -93,7 +93,7 @@
}
const title = 'Moje zaimki to: ' + this.selectedTemplate.name();
const banner = `${process.env.baseUrl}/banner${this.$route.path}.png`;
const banner = `${process.env.baseUrl}/banner${this.$route.path.replace(/\/$/, '')}.png`;
return {
title: title,

View File

@ -16,7 +16,7 @@
Wybierz sposród najpopularniejszych:
</p>
<nuxt-link v-for="(template, pronoun) in templates" :to="'/' + pronoun" :key="pronoun" class="btn btn-outline-primary m-2 btn-md-lg">
<nuxt-link v-for="(template, pronoun) in templates" :to="addSlash('/' + pronoun)" :key="pronoun" class="btn btn-outline-primary m-2 btn-md-lg">
{{template.name()}}
</nuxt-link>
</section>
@ -247,14 +247,14 @@
if (!this.selectedTemplate.pronoun()) {
return null;
}
return process.env.baseUrl + '/' + (this.usedBaseEquals ? this.usedBase : this.longLink);
return this.addSlash(process.env.baseUrl + '/' + (this.usedBaseEquals ? this.usedBase : this.longLink));
},
linkMultiple() {
if (!this.multiple.length) {
return null;
}
return process.env.baseUrl + '/' + this.multiple.join('&');
return this.addSlash(process.env.baseUrl + '/' + this.multiple.join('&'));
},
sources() {
return getSources(this.selectedTemplate);
@ -268,6 +268,9 @@
} else {
this.multiple.push(name);
}
},
addSlash(link) {
return link + (link.substr(link.length - 1) === '*' ? '/' : '');
}
},
}