sync all criterias with collection view (#4054)
This commit is contained in:
parent
9ac483ada6
commit
ef523e5de0
|
@ -16,6 +16,24 @@
|
|||
if (!items.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#orig-query-render select[name="form.widgets.query.i:records"]').each(function(i, elem) {
|
||||
/* when the querywidget is being initialized it will convert static
|
||||
* html elements to various widgets then call updateSearch, we take
|
||||
* the opportunity to handle those new widgets to move them around.
|
||||
*/
|
||||
var index = $(elem).find('option:selected').val();
|
||||
if (index == 'portal_type') {
|
||||
return; /* already handled before */
|
||||
}
|
||||
|
||||
var criteria_div = $('option[value="' + index + '"]:selected').parents('select').parent().detach();
|
||||
criteria_div.appendTo('.more-fieldset .criteria-content');
|
||||
criteria_div.find('select.queryindex').prop('disabled', true);
|
||||
criteria_div.find('.multipleSelectionWidget dt').removeClass('hiddenStructure');
|
||||
criteria_div.find('.multipleSelectionWidget dd').addClass('widgetPulldownMenu').addClass('hiddenStructure');
|
||||
});
|
||||
|
||||
items.each(function () {
|
||||
var results = $(this).parents('.criteria').children('.queryresults');
|
||||
var index = $(this).val();
|
||||
|
@ -192,6 +210,20 @@ function select_metatype(elem)
|
|||
}
|
||||
});
|
||||
|
||||
$('option[data-index]').parents('select').change(function() {
|
||||
index = $(this).find('option[data-index]:selected').data('index');
|
||||
if ($('option[value="' + index + '"]:selected').length == 0) {
|
||||
$('.addIndex option[value="' + index + '"]').prop('selected', true);
|
||||
$('.addIndex').trigger('change');
|
||||
var criteria_div = $('option[value="' + index + '"]:selected').parents('select').parent().detach();
|
||||
criteria_div.appendTo('.more-fieldset .criteria-content');
|
||||
criteria_div.find('select.queryindex').prop('disabled', true);
|
||||
$($(this).find('option[data-index]').parents('select').find('option')[0]).prop('selected', true);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
/* install callbacks */
|
||||
|
||||
$('.metatypes button').click(function() {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div metal:use-macro="view/criterias_template/macros/criterias">
|
||||
</div>
|
||||
|
||||
<div style="display:none">
|
||||
<div style="display:none" id="orig-query-render">
|
||||
<input id="orig-extra-columns" tal:attributes="value view/extra_columns"/>
|
||||
<div tal:content="structure view/w/query/render"/>
|
||||
<div tal:content="structure view/w/sort_on/render"/>
|
||||
|
|
Reference in New Issue