Commit 7567a1b0 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: clean up

parent e2152113
......@@ -1219,18 +1219,6 @@
gadget.state.option_list.length > 0 &&
gadget.state.graphic_type !== "") {
result_queue
.push(function () {
return gadget.getUrlParameter("display_graphic_panel")
})
.push(function (result) {
if (result) {
return gadget.renderEditorPanel(
"gadget_erp5_graphic_editor.html", {
graphic_option_list: gadget.state.option_list,
graphic_type: gadget.state.graphic_type
});
}
})
.push(function () {
return gadget.declareGadget('gadget_graphic.html', {
scope: 'gadget_graphic',
......@@ -1337,6 +1325,7 @@
search_column_list: JSON.parse(this.state.search_column_list_json),
domain_list: domain_list,
domain_dict: domain_dict,
graphic_option_list: this.state.option_list,
begin_from: this.state.key + "_begin_from"
};
})
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>997.43623.34440.2457</string> </value>
<value> <string>997.48220.58774.24832</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1642798544.4</float>
<float>1643074611.1</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, renderFormViewHeader, renderFormListHeader,
SimpleQuery, ComplexQuery,
Query, QueryFactory, ensureArray, triggerListboxClipboardAction,
declareGadgetClassCanHandleListboxClipboardAction*/
declareGadgetClassCanHandleListboxClipboardAction, RSVP*/
/*jslint nomen: true, indent: 2, maxerr: 3, continue: true */
(function (window, rJS, renderFormViewHeader, renderFormListHeader,
SimpleQuery, ComplexQuery,
Query, QueryFactory, ensureArray, triggerListboxClipboardAction,
declareGadgetClassCanHandleListboxClipboardAction) {
declareGadgetClassCanHandleListboxClipboardAction, RSVP) {
"use strict";
function updateSearchQueryFromSelection(extended_search, checked_uid_list,
......@@ -268,7 +268,25 @@
return result_list;
});
})
.allowPublicAcquisition("triggerListboxGraphicSelection", function triggerListboxGraphicSelection() {
var gadget = this;
return this.getDeclaredGadget("erp5_form")
.push(function (declared_gadget) {
return RSVP.all([
declared_gadget.getListboxInfo(),
gadget.getUrlParameter("graphic_type")
]);
})
.push(function (result_list) {
var result_dict = result_list[0],
graphic_type = result_list[1];
return gadget.renderEditorPanel(
"gadget_erp5_graphic_editor.html", {
graphic_option_list: result_dict.graphic_option_list,
graphic_type: result_list[1]
});
});
})
.allowPublicAcquisition("triggerListboxSelectAction", function triggerListboxSelectAction(argument_list) {
var action = argument_list[0],
checked_uid_list = argument_list[1],
......@@ -312,4 +330,4 @@
}(window, rJS, renderFormViewHeader, renderFormListHeader, SimpleQuery,
ComplexQuery, Query,
QueryFactory, ensureArray, triggerListboxClipboardAction,
declareGadgetClassCanHandleListboxClipboardAction));
\ No newline at end of file
declareGadgetClassCanHandleListboxClipboardAction, RSVP));
\ No newline at end of file
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>997.39340.10291.26709</string> </value>
<value> <string>997.48212.37929.9830</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1642802822.3</float>
<float>1643074253.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -36,7 +36,8 @@
};
return this.changeState(state_dict);
})
.declareAcquiredMethod("triggerListboxGraphicSelection",
"triggerListboxGraphicSelection")
.onStateChange(function (modification_dict) {
var gadget = this,
i,
......@@ -242,27 +243,16 @@
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("triggerSubmit", "triggerSubmit")
.onEvent('click', function (evt) {
var gadget = this;
if (evt.target.tagName === 'BUTTON') {
if ((evt.target.nodeType === Node.ELEMENT_NODE) &&
(evt.target.value)) {
// Open the filter panel if one 'search' button is clicked
evt.preventDefault();
return this.triggerSubmit({focus_on: parseInt(evt.target.value, 10)});
} else if (evt.target.classList.contains("graphic-button")) {
return this.redirect({
command: "change",
options: {
extended_search: ""
}
});
} else if (evt.target.classList.contains("change-graphic-button")) {
return this.redirect({
command: "change",
options: {
display_graphic_panel: true,
extended_search: ""
}
});
} else if (evt.target.classList.contains("graphic-button") ||
evt.target.classList.contains("change-graphic-button")) {
return gadget.triggerListboxGraphicSelection();
}
}
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>997.43698.44863.10427</string> </value>
<value> <string>997.48219.25108.64102</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1643061187.04</float>
<float>1643074808.7</float>
<string>UTC</string>
</tuple>
</state>
......
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