1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

UI improvements and saving

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-04-01 21:22:22 +02:00
parent 2a4f9309b9
commit e23a8a5189
8 changed files with 81 additions and 23 deletions

View file

@ -3,7 +3,8 @@
let LogicConditionsCollection = function () {
let self = {},
data = [];
data = [],
$container;
self.put = function (element) {
data.push(element);
@ -19,17 +20,41 @@ let LogicConditionsCollection = function () {
self.getCount = function () {
return data.length
}
};
self.render = function ($container) {
self.render = function () {
let $table = $container.find(".logic__table")
$table.find("tbody tr").remove();
for (let k in self.get()) {
if (self.get().hasOwnProperty(k)) {
self.get()[k].render(k, $container);
self.get()[k].render(k, $table);
}
}
};
}
self.onSave = function () {
let chain = new MSPChainerClass()
chain.setChain([
mspHelper.sendLogicConditions,
mspHelper.saveToEeprom
]);
chain.execute();
};
self.onClose = function() {
$container.hide();
};
self.init = function ($element) {
$container = $element;
$container.find('.logic__save').click(self.onSave);
$container.find('.logic__close').click(self.onClose);
};
return self;
};