diff --git a/project/forms/event_date.py b/project/forms/event_date.py index 36a6893..e9bf9a7 100644 --- a/project/forms/event_date.py +++ b/project/forms/event_date.py @@ -19,7 +19,7 @@ class FindEventDateForm(FlaskForm): lazy_gettext("Category"), validators=[Optional()], coerce=int ) coordinate = HiddenField(validators=[Optional()]) - location = StringField(lazy_gettext("Location"), validators=[Optional()]) + location = SelectField(lazy_gettext("Location"), validators=[Optional()]) distance = SelectField( lazy_gettext("Distance"), validators=[Optional()], diff --git a/project/forms/planing.py b/project/forms/planing.py index aff65c8..b682ec4 100644 --- a/project/forms/planing.py +++ b/project/forms/planing.py @@ -1,6 +1,6 @@ from flask_babelex import lazy_gettext from flask_wtf import FlaskForm -from wtforms import HiddenField, SelectField, StringField, SubmitField +from wtforms import HiddenField, SelectField, SubmitField from wtforms.validators import Optional from project.forms.common import distance_choices, weekday_choices @@ -17,7 +17,7 @@ class PlaningForm(FlaskForm): lazy_gettext("Category"), validators=[Optional()], coerce=int ) coordinate = HiddenField(validators=[Optional()]) - location = StringField(lazy_gettext("Location"), validators=[Optional()]) + location = SelectField(lazy_gettext("Location"), validators=[Optional()]) distance = SelectField( lazy_gettext("Distance"), validators=[Optional()], diff --git a/project/static/site.js b/project/static/site.js index 9e84d9c..deca6df 100644 --- a/project/static/site.js +++ b/project/static/site.js @@ -307,9 +307,7 @@ function handle_request_success( $(error_id).hide(); } -function reset_place_form(prefix = "") { - $("#" + prefix + "name").val(""); - $("#" + prefix + "url").val(""); +function reset_location_form(prefix = "") { $("#" + prefix + "location-street").val(""); $("#" + prefix + "location-postalCode").val(""); $("#" + prefix + "location-city").val(""); @@ -318,11 +316,15 @@ function reset_place_form(prefix = "") { $("#" + prefix + "location-longitude").val(""); } +function reset_place_form(prefix = "") { + $("#" + prefix + "name").val(""); + $("#" + prefix + "url").val(""); + reset_location_form(prefix); +} + function reset_organizer_form(prefix = "") { $("#" + prefix + "name").val(""); - $("#" + prefix + "location-street").val(""); - $("#" + prefix + "location-postalCode").val(""); - $("#" + prefix + "location-city").val(""); + reset_location_form(prefix); } function fill_place_form_with_gmaps_place( @@ -425,7 +427,7 @@ $(function () { $("#clear_location_btn").click(function () { $("#coordinate").val(""); - $("#location").val(""); + $("#location").val("").trigger('change'); }); $(".btn-print").click(function () { diff --git a/project/templates/_macros.html b/project/templates/_macros.html index d75259f..6b70c2e 100644 --- a/project/templates/_macros.html +++ b/project/templates/_macros.html @@ -722,83 +722,111 @@ {% endmacro %} -{% macro render_google_place_autocomplete_header(location_only = False, prefix = '') %} - +{% macro render_google_place_autocomplete_header() %} {% endmacro %} -{% macro render_google_place_autocomplete_field() %} +{% macro render_google_place_autocomplete_field(location_only = False) %}