diff --git a/kfet/static/kfet/js/kfet.api.js b/kfet/static/kfet/js/kfet.api.js
index d2fca5d7..348fe57b 100644
--- a/kfet/static/kfet/js/kfet.api.js
+++ b/kfet/static/kfet/js/kfet.api.js
@@ -908,15 +908,15 @@ class Formatter {
var prefix_prop = options.prefix_prop !== undefined ? options.prefix_prop : '.';
var prefix_attr = options.prefix_attr !== undefined ? options.prefix_attr : '';
- for (var i in props) {
- var selector = prefix_prop + props[i];
- var html = options.empty_props ? '' : this.get_prop(object, props[i]);
+ for (let prop of props) {
+ var selector = prefix_prop + prop;
+ var html = options.empty_props ? '' : this.get_prop(object, prop);
$container.find( selector ).html( html );
}
- for (var i in attrs) {
- var name = prefix_attr + attrs[i];
- var value = options.empty_attrs ? '' : this.get_attr(object, attrs[i]);
+ for (let attr of attrs) {
+ var name = prefix_attr + attr;
+ var value = options.empty_attrs ? '' : this.get_attr(object, attr);
$container.attr( name, value );
}
diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js
index 455d2d95..0fb5c0e1 100644
--- a/kfet/static/kfet/js/kfet.js
+++ b/kfet/static/kfet/js/kfet.js
@@ -25,6 +25,21 @@ String.prototype.isValidTri = function() {
}
+function intCheck(v) {
+ return Number.parseInt(v);
+}
+
+function floatCheck(v) {
+ if (typeof v === 'number')
+ return v;
+ return Number.parseFloat(v);
+}
+
+function booleanCheck(v) {
+ return v == true;
+}
+
+
$(document).ready(function() {
$(window).scroll(function() {
if ($(window).width() >= 768 && $(this).scrollTop() > 72.6) {
diff --git a/kfet/static/kfet/js/kpsul.js b/kfet/static/kfet/js/kpsul.js
index 49c61468..67af4e57 100644
--- a/kfet/static/kfet/js/kpsul.js
+++ b/kfet/static/kfet/js/kpsul.js
@@ -51,15 +51,15 @@ class AccountManager {
if (this.is_empty()) {
var trigramme = this.selection.get();
if (trigramme.isValidTri()) {
- var url_base = "{% url 'kfet.account.create' %}";
+ var url_base = Urls['kfet.account.create']();
var url = url_base + '?trigramme=' + encodeURIComponent(trigramme);
buttons += '';
} else { /* trigramme input is empty or invalid */
buttons += '';
}
} else { /* an account is loaded */
- var url = Urls['kfet.account.update'](encodeURIComponent(this.account.trigramme));
- buttons += '';
+ var url = this.account.url_object;
+ buttons += '';
}
this._$container.find('.buttons').html(buttons);
@@ -188,13 +188,14 @@ class AccountSearch {
var that = this;
this._$input.yourlabsAutocomplete({
- url: '{% url "kfet.account.search.autocomplete" %}',
+ url: Urls['kfet.account.search.autocomplete'](),
minimumCharacters: 2,
id: 'search_autocomplete',
choiceSelector: '.choice',
placeholder: "Chercher un utilisateur K-Fêt",
container: that._$results_container,
box: that._$results_container,
+ fixPosition: function() {},
});
return this;
@@ -344,11 +345,10 @@ class CheckoutSelection {
this._init_events();
- this.choices = [
- for (option of this._$input.find('option'))
- if ($(option).attr('value') != '')
- parseInt($(option).attr('value'))
- ];
+ this.choices = this._$input.find('option[value!=""]').toArray()
+ .map(function(opt) {
+ return parseInt($(opt).attr('value'));
+ });
}
_init_events() {
diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html
index 8fd903df..1657ba6d 100644
--- a/kfet/templates/kfet/kpsul.html
+++ b/kfet/templates/kfet/kpsul.html
@@ -170,27 +170,6 @@
{% csrf_token %}
+
{% endblock %}
{% block title %}Nouveaux transferts{% endblock %}
@@ -51,14 +52,12 @@