Skip to content

Commit

Permalink
event form: remove time from date picker when setting "whole day"
Browse files Browse the repository at this point in the history
Resolves #144
  • Loading branch information
thomersch committed May 17, 2024
1 parent 4b9383a commit 09e7f1d
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ ENV PYTHONDONTWRITEBYTECODE 1
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get -y install curl make libgdal32
RUN pip install poetry==1.7.1
RUN pip install poetry==1.8.3

CMD /bin/bash
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"vscode": {
"extensions": ["ms-python.python", "ms-python.black-formatter"]
}
}
},
"forwardPorts": [8000, "db:5432"]
}
17 changes: 17 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#folder-specific-settings
{
"language_overrides": {
"Python": {
"format_on_save": {
"external": {
"command": "black",
"arguments": ["-"]
}
}
},
"HTML": { "format_on_save": "off" }
}
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN useradd -m osmcal
RUN chown osmcal /app

USER osmcal
RUN pip install poetry==1.7.1
RUN pip install poetry==1.8.3

# This is a hack to speed up docker builds through leveraging the layer cache.
COPY pyproject.toml poetry.lock Makefile ./
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PATH := "$(PATH):$(HOME)/.local/bin"
CALL := env PATH=$(PATH) poetry
CALL := env PATH=$(PATH) POETRY_VIRTUALENVS_IN_PROJECT=true poetry

GUNICORN_WORKERS ?= 1
FLY_REGION ?= ""
Expand Down
4 changes: 2 additions & 2 deletions osmcal/static/osmcal/thirdparty/flatpickr.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions osmcal/static/osmcal/thirdparty/flatpickr.min.css

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions osmcal/templates/osmcal/event_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block head %}
{{ block.super }}
{% include "osmcal/partials/no_index.html" %}

{% leaflet_js plugins="forms" %}
{% leaflet_css plugins="forms" %}
<link rel="stylesheet" href="{% static 'osmcal/thirdparty/flatpickr.min.css' %}">
Expand All @@ -31,7 +31,7 @@
{% if page_title %}<h1>{{ page_title }}</h1>{% endif %}
<form id="event-main-form" method="POST">
{% csrf_token %}

{% timezone tz %}
<section class="event-form">
{% for field in form %}
Expand Down Expand Up @@ -168,9 +168,13 @@ <h3 style="flex-grow: 2;">Question [[ index+1 ]]</h3>
fp[i].config.enableTime = !evt.target.checked;
if(evt.target.checked) {
fp[i].config.dateFormat = 'Y-m-d';
if(fp[i].selectedDates.length > 0) {
fp[i].setDate(new Date(fp[i].selectedDates[0].toDateString()));
}
} else {
fp[i].config.dateFormat = 'Y-m-d H:i';
}
fp[i].redraw();
}
});

Expand Down Expand Up @@ -201,8 +205,8 @@ <h3 style="flex-grow: 2;">Question [[ index+1 ]]</h3>
});
}
});
leafletmap.addControl(osmGeocoder);

leafletmap.addControl(osmGeocoder);
}, false);
</script>
{% endblock %}
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ build-backend = "poetry.core.masonry.api"
line-length = 120
target-version = ['py39']
extend-exclude = 'osmcal/migrations'

[tool.pyright]
venvPath = "."
venv = ".venv"

0 comments on commit 09e7f1d

Please sign in to comment.