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

Drop loopEventListener dependency

parent 17604d11
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/> <link href="gadget_erp5_page_slap_parameter_form.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.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> <script src="gadget_json_generated_form.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*jslint nomen: true, maxlen: 200, indent: 2*/ /*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"; "use strict";
function decodeJsonPointer(_str) { function decodeJsonPointer(_str) {
...@@ -812,62 +812,36 @@ ...@@ -812,62 +812,36 @@
}); });
}) })
.declareJob('listenEvents', function () { .onEvent('click', function (evt) {
var g = this, if (evt.target === this.props.delete_button) {
field_list = g.props.inputs, return this.selfRemove(evt);
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)
));
} }
if (g.props.property_name_edit) { var button_list = this.props.add_buttons,
promise_list.push(loopEventListener( i;
g.props.property_name_edit, for (i = 0; i < button_list.length; i = i + 1) {
'change', if (evt.target === button_list[i].element) {
false, return button_list[i].event(evt);
function (event) {
return g.rename(g.props.property_name_edit.value, event);
} }
));
} }
})
for (i = 0; i < field_list.length; i = i + 1) { .onEvent('change', function (evt) {
promise_list.push(loopEventListener( if (evt.target === this.props.property_name_edit) {
field_list[i], return this.rename(this.props.property_name_edit.value, evt);
'change',
false,
g.processValidation.bind(g, g.options.schema_url, undefined)
));
} }
for (i = 0; i < button_list.length; i = i + 1) { var field_list = this.props.inputs,
promise_list.push(loopEventListener( i;
button_list[i].element, for (i = 0; i < field_list.length; i = i + 1) {
'click', if (evt.target === field_list[i].element) {
false, return this.processValidation.bind(this, this.options.schema_url, undefined)(evt);
button_list[i].event }
)); }
} })
.declareJob('listenEvents', function () {
// for (i = 0; i < label_list.length; i = i + 1) { // XXX Disable
// promise_list.push(loopEventListener( return;
// label_list[i],
// 'click',
// false,
// collapseParameter.bind(g, label_list[i])
// ));
// }
return RSVP.all(promise_list);
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
...@@ -882,4 +856,4 @@ ...@@ -882,4 +856,4 @@
// }); // });
}); });
}(window, document, rJS, RSVP, loopEventListener)); }(window, document, rJS, RSVP));
\ No newline at end of file \ 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