add support for multi actions with dialogs
This commit is contained in:
parent
7da6263136
commit
bdead6c58b
|
@ -322,26 +322,43 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
$('.multi-actions button').on('click', function() {
|
$('.multi-actions button').on('click', function(ev) {
|
||||||
var $div = $(this).parent();
|
var $div = $(this).parent();
|
||||||
var url = $(this).parent().data('actions-url');
|
var url = $(this).parent().data('actions-url');
|
||||||
var action = $(this).data('action');
|
var action = $(this).data('action');
|
||||||
var action_status = $(this).data('status');
|
var action_status = $(this).data('status');
|
||||||
|
var popup = $(this).data('popup');
|
||||||
var documents = Array();
|
var documents = Array();
|
||||||
$(this).parents('div.table').find('tr.selected.row-state-' + action_status + ' input').each(function(idx, elem) {
|
$(this).parents('div.table').find('tr.selected.row-state-' + action_status + ' input').each(function(idx, elem) {
|
||||||
documents.push($(elem).data('value'));
|
documents.push($(elem).data('value'));
|
||||||
});
|
});
|
||||||
$div.find('button').prop('disabled', true);
|
if (action) {
|
||||||
$.post(url, {'action': action, 'documents': documents }
|
$div.find('button').prop('disabled', true);
|
||||||
|
$.post(url, {'action': action, 'documents': documents }
|
||||||
).done(function() {
|
).done(function() {
|
||||||
console.log('success');
|
console.log('success');
|
||||||
console.log('xx:', $.querywidget.updateSearch);
|
|
||||||
$.querywidget.updateSearch(true);
|
$.querywidget.updateSearch(true);
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
console.log('fail');
|
console.log('fail');
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
$div.find('button').prop('disabled', false);
|
$div.find('button').prop('disabled', false);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (popup) {
|
||||||
|
var base_popup_url = $(this).parent().data('popup-action-base-url');
|
||||||
|
var $fake_a = $('<a class="' + popup + '" href="' + base_popup_url + '@@' + popup +
|
||||||
|
'?documents=' + documents.join(',') + '"></a>');
|
||||||
|
$fake_a.appendTo('body');
|
||||||
|
$fake_a.prepOverlay({
|
||||||
|
closeselector: "#form-buttons-cancel",
|
||||||
|
config: {closeOnClick: false, closeOnEsc: false},
|
||||||
|
filter: "#content>*:not(div.configlet),dl.portalMessage.error,dl.portalMessage.info",
|
||||||
|
formselector: "#form",
|
||||||
|
subtype: 'ajax',
|
||||||
|
noform: 'reload'
|
||||||
|
});
|
||||||
|
$fake_a.trigger(ev);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}(jQuery));
|
}(jQuery));
|
||||||
|
|
|
@ -191,10 +191,13 @@ class ResultsDocumentsTable(ResultsTable):
|
||||||
portal_url = api.portal.get().portal_url()
|
portal_url = api.portal.get().portal_url()
|
||||||
return self.renderTable() + u"""
|
return self.renderTable() + u"""
|
||||||
|
|
||||||
<div class="multi-actions" data-actions-url="%(portal_url)s/@@multiactions">
|
<div class="multi-actions"
|
||||||
|
data-actions-url="%(portal_url)s/@@multiactions"
|
||||||
|
data-popup-action-base-url="%(portal_url)s/">
|
||||||
<button data-status="assigning" data-action="to_process">À traiter</button>
|
<button data-status="assigning" data-action="to_process">À traiter</button>
|
||||||
<button data-status="processing" data-action="to_considered">Pris en compte</button>
|
<button data-status="processing" data-action="to_considered">Pris en compte</button>
|
||||||
<button data-status="processing" data-action="to_noaction">Sans suite</button>
|
<button data-status="processing" data-action="to_noaction">Sans suite</button>
|
||||||
|
<button data-status="processing" data-popup="add_multi_information">Transmettre pour info</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
""" % {'portal_url': portal_url}
|
""" % {'portal_url': portal_url}
|
||||||
|
@ -230,7 +233,9 @@ class ResultsTasksTable(TasksTable):
|
||||||
|
|
||||||
return self.renderTable() + """
|
return self.renderTable() + """
|
||||||
|
|
||||||
<div class="multi-actions" data-actions-url="%(portal_url)s/@@multiactions">
|
<div class="multi-actions"
|
||||||
|
data-actions-url="%(portal_url)s/@@multiactions"
|
||||||
|
data-popup-action-base-url="%(portal_url)s/">
|
||||||
<button data-type="task" data-status="todo" data-action="take-responsibility">Prendre en charge</button>
|
<button data-type="task" data-status="todo" data-action="take-responsibility">Prendre en charge</button>
|
||||||
<button data-type="task" data-status="in-progress" data-action="mark-as-done">Marquer comme fait </button>
|
<button data-type="task" data-status="in-progress" data-action="mark-as-done">Marquer comme fait </button>
|
||||||
<button data-type="information" data-status="todo" data-action="mark-as-done">Marquer comme lu</button>
|
<button data-type="information" data-status="todo" data-action="mark-as-done">Marquer comme lu</button>
|
||||||
|
|
Reference in New Issue