Files
mozo-backend/app/assets/javascripts/supplier/application.js
T

62 lines
1.6 KiB
JavaScript

//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.ui.datepicker-en
//= require jquery.ui.datepicker-nl
// require bootstrap-transition
// require bootstrap-affix
// require bootstrap-alert
// require bootstrap-button
// require bootstrap-carousel
// require bootstrap-collapse
// require bootstrap-dropdown
// require bootstrap-modal
// require bootstrap-scrollspy
// require bootstrap-tab
// require bootstrap-tooltip
// require bootstrap-popover
// require bootstrap-typeahead
//= require bootstrap
//= require handlebars
//= require faye
//= require supplier/base
//= require qwaiter
//= require qtip
//= require_directory .
//= require_self
//= require moment
var Qstorage = localStorage;
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
var path_mapping = {
user_root: '/user',
join_occupied_table: '/user/join_occupied_table',
list_products_for_table: '/user/list_products_for_table',
list_products: '/user/list_products'
}
function redirect_to(mapping, variables){
variables || (variables = {});
var vars = []
for(var name in variables){
vars.push(name + '=' +variables[name])
}
window.location = path_mapping[mapping] + '?' + vars.join('&')
}
function currency(num) {
return Qwaiter.currency(num);
}
Handlebars.registerHelper('t', function(tlocation) {
return t(tlocation)
})
Handlebars.registerHelper('currency', function(price) {
if(price.fn){
price = price.fn(this);
}
if(typeof(price) == 'function'){
price = price.call(this)
}
return new Handlebars.SafeString(currency(price))
})