WIP: Aureplop/kpsul js refactor #501
2 changed files with 7 additions and 4 deletions
|
@ -683,15 +683,17 @@ class ModelList {
|
||||||
.filter(v => v[name].id == elt.id) ;
|
.filter(v => v[name].id == elt.id) ;
|
||||||
children.sort(child_model.compare);
|
children.sort(child_model.compare);
|
||||||
|
|
||||||
|
//TODO: less dirty
|
||||||
var $container = $('<div></div>');
|
var $container = $('<div></div>');
|
||||||
$container.attr('data-'+name+'-id', elt.id);
|
var $elt = elt.display($(template), options);
|
||||||
$container.append(elt.display($(template), options));
|
$elt.attr('data-'+name+'-id', elt.id);
|
||||||
|
$container.append($elt);
|
||||||
|
|
||||||
for (let child of children) {
|
for (let child of children) {
|
||||||
$container.append(this.render_element(child, templates, options));
|
$container.append(this.render_element(child, templates, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $container;
|
return $container.html();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +721,7 @@ class ModelList {
|
||||||
* @param {Object} props Properties to match
|
* @param {Object} props Properties to match
|
||||||
*/
|
*/
|
||||||
find(model, props) {
|
find(model, props) {
|
||||||
if (!this.constructor.models.find(model)) {
|
if (this.constructor.models.indexOf(model) == -1) {
|
||||||
return undefined ;
|
return undefined ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -915,6 +915,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
var env = {
|
var env = {
|
||||||
articleSelect: articleSelect,
|
articleSelect: articleSelect,
|
||||||
|
addPurchase: addPurchase,
|
||||||
updateBasketAmount: updateBasketAmount,
|
updateBasketAmount: updateBasketAmount,
|
||||||
updateBasketRel: updateBasketRel,
|
updateBasketRel: updateBasketRel,
|
||||||
performOperations: performOperations,
|
performOperations: performOperations,
|
||||||
|
|
Loading…
Reference in a new issue