-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
…res for agenda and add pagination
geocity/apps/api/serializers.py
Outdated
"width": "1365", | ||
"height": "2048", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define how we can have width and height ? Is it the actual image width and height ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be depend on thumbor specs that will resize depending on what the web component asks for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how it's working. I've been doing some tests, and this value is required to show an image. We can still resize the image through Thumblor
. Seems like to be the original file dimensions.
@monodo
geocity/apps/agenda/views.py
Outdated
|
||
|
||
# TODO: Place this view in the form or submission, so we have direct access to the image settings, public or not ? From API | ||
def image_display(request, form_id, image_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want once to display image in the the "geo-calendar", we'll have to duplicate this code in current api ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically no, but if it's the case, we should not put this in an app called "agenda".
We should use another name, so we can group data providers in a specific app for this usage.
The reason to put this in another app is to make it easier to find all the code that has the same purpose, and to have a complete URL that doesn't start with /submissions/
geocity/apps/agenda/views.py
Outdated
image_dir, f"permit_requests_uploads/{form_id}/{image_name}" | ||
) | ||
|
||
# TODO: Ajouter de la sécurité afin de savoir si l'image peut-être affichée ou non |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some help to ensure only public images are returned (not tested):
field_value = get_object_or_404(
models.FieldValue.objects.filter(field__input_type=Field.INPUT_TYPE_FILE,is_public_when_permitrequest_is_public=True),
pk=property_value_id,
field_values__field__public_info=True,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
geocity/apps/forms/models.py
Outdated
_("Visible dans l'agenda"), | ||
default=False, | ||
help_text=_( | ||
"""Lorsque cette case est cochée, les données de ce formulaire sont accessibles dans l'API <b>/rest/agenda/</b>""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Lorsque cette case est cochée, les données de ce formulaire sont accessibles dans l'API /rest/agenda/ si l'annonce est rendue publique par le pilote"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 : Done
2: TODO Added on the right place on the code
geocity/apps/submissions/models.py
Outdated
_("Visible dans l'API light"), | ||
default=False, | ||
help_text=_( | ||
"""Lorsque cette case est cochée, ce champ est affichée dans la version light de l'api (/rest/RESSOURCE).<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
affichée => affiché
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"si la demande est rendue publique par le pilote" added on the help text, like the comment above
Agenda embed from npm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- think about updating the wiki
geocity/apps/api/views.py
Outdated
INTERNAL_WEB_ROOT_URL = "http://web:9000" | ||
image_url = f"{INTERNAL_WEB_ROOT_URL}/rest/image/{submission_id}/{image_name}" | ||
|
||
# TODO: understand (adaptive-)(full-)fit-in between unsafe and size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional => v2
geocity/apps/forms/models.py
Outdated
@@ -870,7 +877,7 @@ class Field(models.Model): | |||
max_length=255, | |||
blank=True, | |||
help_text=_( | |||
'Ex: "Yverdon-les-Bains" afin de limiter les recherches à Yverdon, <a href="https://api3.geo.admin.ch/services/sdiservices.html#search" target="_blank">Plus d\'informations</a>' | |||
'Ex: "Yverdon-les-Bains" afin de limiter les recherches à Yverdon, <a href="https://api3.Sgeo.admin.ch/services/sdiservices.html#search" target="_blank">Plus d\'informations</a>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
<agenda-embed api-base-url="http://localhost:9095/rest"></agenda-embed> | ||
|
||
<!-- Initialize the component --> | ||
<script type="module" src="{% static 'js/agenda-embed/agenda-embed.js' %}"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove js code from static and use code that is made available throught build process in statics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
add env variable for THUMBOR and allow to set network name in .env
Thumbor variables
geocity/settings.py
Outdated
@@ -138,6 +140,7 @@ | |||
"geocity.apps.reports", | |||
"geocity.apps.forms", | |||
"geocity.apps.submissions", | |||
"geocity.apps.agenda", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove before merge
Required points before merging embed-agenda in develop
startAt
andendAt
work properlyPublication agenda
instead ofPublication calendrier
filter for api
infields
when type is not correct@monodo
featured
(checkbox in admin) work properly 🐛 ? featured items do NOT come firstfilters
in/rest/agenda
are isolated correctly with large data (preprod)filters
in/rest/agenda/domain
return only :/rest/image/
and/rest/image/thumbor/
@AlexandreJunod
featured
(checkbox in admin) work properlyfeatured
in serializerfilters
in/rest/agenda
are isolated correctly with large data (preprod)filters
in/rest/agenda
return only :/rest/image/
and/rest/image/thumbor/
TODO
. TagIMPROVE V2
things not required in V1