changed slugs to be nicer

This commit is contained in:
Senad Uka
2015-11-28 08:35:42 +01:00
parent e993904d78
commit 7d01bfb393
2 changed files with 23 additions and 9 deletions

View File

@@ -4,12 +4,24 @@ module.exports = {
ItemGroupIdOfStartPage: "1",
ItemGroupIdOfEmptyCartPage: "1",
FormatCurrency: function(amount_s) {
var amount = parseFloat(amount_s);
return ( amount.toFixed(2) + " KM" )
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + " KM")
},
FormatPercentage: function(amount_s) {
var amount = parseFloat(amount_s);
return ( amount.toFixed(2) + "%" )
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + "%")
},
MaxNumberOfItemsToBeAdded: 1000
MaxNumberOfItemsToBeAdded: 1000,
Slugify: function(text) {
return text.toString().toLowerCase()
.replace(/š/g,'s')
.replace(/[čć]/g,'c')
.replace(/[ž]/g,'z')
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
};