Commit 8c970da5 authored by Romain Courteaud's avatar Romain Courteaud

Drop loopEventListener dependency

parent 17604d11
......@@ -9,7 +9,6 @@
<link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="gadget_global.js"></script>
<script src="gadget_json_generated_form.js" type="text/javascript"></script>
</head>
<body>
......
/*jslint nomen: true, maxlen: 200, indent: 2*/
/*global window, document, rJS, RSVP, loopEventListener */
/*global window, document, rJS, RSVP */
(function (window, document, rJS, RSVP, loopEventListener) {
(function (window, document, rJS, RSVP) {
"use strict";
function decodeJsonPointer(_str) {
......@@ -812,62 +812,36 @@
});
})
.declareJob('listenEvents', function () {
var g = this,
field_list = g.props.inputs,
button_list = g.props.add_buttons,
label_list = g.element.querySelectorAll('label.slapos-parameter-dict-key'),
i,
promise_list = [];
if (g.props.delete_button) {
promise_list.push(loopEventListener(
g.props.delete_button,
'click',
false,
g.selfRemove.bind(g)
));
.onEvent('click', function (evt) {
if (evt.target === this.props.delete_button) {
return this.selfRemove(evt);
}
if (g.props.property_name_edit) {
promise_list.push(loopEventListener(
g.props.property_name_edit,
'change',
false,
function (event) {
return g.rename(g.props.property_name_edit.value, event);
var button_list = this.props.add_buttons,
i;
for (i = 0; i < button_list.length; i = i + 1) {
if (evt.target === button_list[i].element) {
return button_list[i].event(evt);
}
));
}
})
for (i = 0; i < field_list.length; i = i + 1) {
promise_list.push(loopEventListener(
field_list[i],
'change',
false,
g.processValidation.bind(g, g.options.schema_url, undefined)
));
.onEvent('change', function (evt) {
if (evt.target === this.props.property_name_edit) {
return this.rename(this.props.property_name_edit.value, evt);
}
for (i = 0; i < button_list.length; i = i + 1) {
promise_list.push(loopEventListener(
button_list[i].element,
'click',
false,
button_list[i].event
));
}
// for (i = 0; i < label_list.length; i = i + 1) {
// promise_list.push(loopEventListener(
// label_list[i],
// 'click',
// false,
// collapseParameter.bind(g, label_list[i])
// ));
// }
return RSVP.all(promise_list);
var field_list = this.props.inputs,
i;
for (i = 0; i < field_list.length; i = i + 1) {
if (evt.target === field_list[i].element) {
return this.processValidation.bind(this, this.options.schema_url, undefined)(evt);
}
}
})
.declareJob('listenEvents', function () {
// XXX Disable
return;
})
.declareMethod('getContent', function () {
......@@ -882,4 +856,4 @@
// });
});
}(window, document, rJS, RSVP, loopEventListener));
\ No newline at end of file
}(window, document, rJS, RSVP));
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment