summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-02-06 09:32:30 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-02-06 09:32:30 (GMT)
commit043a16842666a3c4b936c02eee6f5f40763951c3 (patch)
tree096a8b012bc38f8531680def57b23b1e34d91031
parent2fe980a81aebd5e15b4a647008c531525ecaecbb (diff)
downloadpfwbged.contact-043a16842666a3c4b936c02eee6f5f40763951c3.zip
pfwbged.contact-043a16842666a3c4b936c02eee6f5f40763951c3.tar.gz
pfwbged.contact-043a16842666a3c4b936c02eee6f5f40763951c3.tar.bz2
add filter to select between organization and person
-rw-r--r--src/pfwbged/contact/table.pt20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/pfwbged/contact/table.pt b/src/pfwbged/contact/table.pt
index 2a67100..2863e35 100644
--- a/src/pfwbged/contact/table.pt
+++ b/src/pfwbged/contact/table.pt
@@ -12,6 +12,13 @@
<h1 class="documentFirstHeading" tal:content="context/Title" />
<div tal:replace="structure provider:plone.belowcontenttitle" />
+ <div class="metatypes">
+ Que cherchez-vous :
+<label><input value="filter-all" name="contact-filter" checked="checked" type="radio">Tout</label>
+<label><input value="filter-orgs" name="contact-filter" type="radio">Organisations</label>
+<label><input value="filter-persons" name="contact-filter" type="radio">Personnes</label>
+</div>
+
<div class="criteria-content" style="display:block;">
Rechercher : <input name="text-criteria-fulltext">
</div>
@@ -31,7 +38,14 @@ $.querywidget.updateSearch = function () {
return baseUrl;
})();
var query = context_url + "/@@querybuilder_html_results?";
- query += "query.i:records=portal_type&query.o:records=plone.app.querystring.operation.selection.is&query.v:records:list=organization&query.v:records:list=person&";
+ query += "query.i:records=portal_type&query.o:records=plone.app.querystring.operation.selection.is&";
+ var filter_val = $('input[name="contact-filter"]:checked').val();
+ if (filter_val == "filter-all" || filter_val == "filter-orgs") {
+ query += "query.v:records:list=organization&";
+ }
+ if (filter_val == "filter-all" || filter_val == "filter-persons") {
+ query += "query.v:records:list=person&";
+ }
query += "query.i:records=SearchableText&query.o:records=plone.app.querystring.operation.string.contains&query.v:records=";
query += $('input[name="text-criteria-fulltext"]').val();
query += '&sort_on=sortable_title';
@@ -41,6 +55,10 @@ $.querywidget.updateSearch = function () {
$(function() {
$.querywidget.updateSearch();
+ $('input[name="contact-filter"]').change(function() {
+ $.querywidget.updateSearch();
+ });
+
$('input[name="text-criteria-fulltext"]').on('keyup', function() {
$.querywidget.updateSearch();
});