Files
old-ribica/front-ui/app/globals.js
2015-11-28 08:35:42 +01:00

28 lines
954 B
JavaScript

module.exports = {
ApiUrl: '@@apiEndpoint',
DefaultPageSize: 24,
ItemGroupIdOfStartPage: "1",
ItemGroupIdOfEmptyCartPage: "1",
FormatCurrency: function(amount_s) {
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + " KM")
},
FormatPercentage: function(amount_s) {
var amount = parseFloat(amount_s);
return (amount.toFixed(2) + "%")
},
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
}
};