66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
//= require modernizr
|
|
//= require jquery
|
|
//= require jquery_ujs
|
|
//= require jquery-ui/sortable
|
|
// require ./im
|
|
// require foundation FOUNDATION 5 JAVASCRIPT IMPLEMENTATIONS AND EMBER ARE NOT COMPATIBLE, FOUNDATION IS TOO SIMPLISTIC AT THE MOMENT AND DESTROYS DOM EVENTS
|
|
//= require js-routes
|
|
//= require moment
|
|
//= require fullcalendar
|
|
//= require translations
|
|
//= require faye
|
|
//= require ./base
|
|
//= require pickdate
|
|
//= require_directory .
|
|
//= require_self
|
|
|
|
if(!Modernizr.cssanimations){
|
|
window.location = "/unsupported-browser";
|
|
}
|
|
var Qstorage = localStorage;
|
|
|
|
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
|
|
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
|
|
|
|
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
|
|
|
|
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
|
|
window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>;
|
|
|
|
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) {
|
|
// num = 0.0 if isNaN(num) || num == '' || num == null
|
|
// '€ ' + parseFloat(num).toFixed(2)
|
|
if (isNaN(num) || num === '' || num === null) {
|
|
num = 0.0;
|
|
}
|
|
return '€ ' + parseFloat(num).toFixed(2);
|
|
}
|
|
/*
|
|
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))
|
|
})
|
|
*/
|