2 * PoisCasse -- Open Data POIs portal
3 * By: Emmanuel Raviart <eraviart@easter-eggs.com>
4 * Romain Soufflet <rsoufflet@easter-eggs.com>
6 * Copyright (C) 2011 Easter-eggs
7 * http://gitorious.org/infos-pratiques/poiscasse
9 * This file is part of PoisCasse.
11 * PoisCasse is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as
13 * published by the Free Software Foundation, either version 3 of the
14 * License, or (at your option) any later version.
16 * PoisCasse is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Affero General Public License for more details.
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 var etalage = etalage || {};
30 $('#territory').autocomplete({
31 source: function(request, response) {
33 url: etalage.territoryAutocompleterUrl + '?jsonp=?',
38 success: function (data) {
39 response($.map(data.data.items, function(item) {
40 var label = item.main_postal_distribution;
41 if (item.main_postal_distribution != item.nearest_postal_distribution) {
42 label += ' (' + item.nearest_postal_distribution + ')';
44 if (item.type_name != 'Arrondissement municipal' && item.type_name != 'Commune'
45 && item.type_name != 'Commune associƩe') {
46 label += ' (' + item.type_name + ')';
50 value: item.main_postal_distribution