Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.11.24] Add form for contact information #3034

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Conversation

MizukiTemma
Copy link
Member

@MizukiTemma MizukiTemma commented Sep 3, 2024

Short description

This PR implements a new form for contact objects.

This PR is not yet finalized. Changes from #3007 have been taken over but are not actual in this branch. Once it is merged, this PR will be updated too.

To Do after #3007 is merged

  • Add the real URL to contacts listed in poi_form_sidebar/action_box.html

Proposed changes

  • Add three new boolean fields to the model contact to store whether E-mail, phone number and website must be imported from the related POI.
  • Make the fields for E-mail, phone number and website read-only when the corresponding check box is checked.
  • Create a new form ContactForm with check whether those three fields match with those of the selected POI if checked for import from the POI
  • Create a new template for the form, reusing poibox.html and _related_contents_table.html

Side effects

  • Change the field name "poi" to "location" in the contact model to be compatible with poi_box.html

Memo

Resolved issues

Fixes: #2953


Pull Request Review Guidelines

Copy link

codeclimate bot commented Sep 3, 2024

Code Climate has analyzed commit e01c256 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 62.3% (50% is the threshold).

This pull request will bring the total coverage in the repository to 82.4% (0.0% change).

View more on Code Climate.

@MizukiTemma MizukiTemma force-pushed the form_for_contact branch 5 times, most recently from 3dd3d9e to 616733c Compare September 11, 2024 18:05
@MizukiTemma MizukiTemma changed the title [provisional] Add form for contact information [7.11.24] Add form for contact information Sep 11, 2024
@MizukiTemma MizukiTemma added prio: high Needs to be resolved ASAP. deadline Needs to be fixed in the given time labels Sep 11, 2024
@MizukiTemma MizukiTemma marked this pull request as ready for review September 11, 2024 18:30
@MizukiTemma
Copy link
Member Author

MizukiTemma commented Sep 14, 2024

Update after exchange with @osmers : Name should not be mandatory anymore. It should be possible to create a contact only with position or department name (which will be given in the field "title") without name of individual person.

done

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool 🎉

I have a few suggestions

integreat_cms/cms/templates/contacts/contact_list_row.html Outdated Show resolved Hide resolved
integreat_cms/static/src/js/events/event-query-pois.ts Outdated Show resolved Hide resolved
integreat_cms/static/src/js/events/event-query-pois.ts Outdated Show resolved Hide resolved
integreat_cms/cms/migrations/0103_update_contact.py Outdated Show resolved Hide resolved
integreat_cms/cms/views/contacts/contact_form_view.py Outdated Show resolved Hide resolved
integreat_cms/cms/views/contacts/contact_form_view.py Outdated Show resolved Hide resolved
integreat_cms/cms/views/contacts/contact_form_view.py Outdated Show resolved Hide resolved
integreat_cms/cms/views/events/event_form_view.py Outdated Show resolved Hide resolved
@MizukiTemma MizukiTemma force-pushed the form_for_contact branch 2 times, most recently from 0cc831b to afbd95d Compare September 16, 2024 12:51
Copy link
Collaborator

@PeterNerlich PeterNerlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with most of davids comments, so mine are only what caught my eye on top of them.

integreat_cms/cms/models/contact/contact.py Outdated Show resolved Hide resolved
integreat_cms/cms/templates/contacts/contact_form.html Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/locale/de/LC_MESSAGES/django.po Outdated Show resolved Hide resolved
integreat_cms/static/src/js/events/event-query-pois.ts Outdated Show resolved Hide resolved
integreat_cms/cms/forms/contacts/contact_form.py Outdated Show resolved Hide resolved
@MizukiTemma MizukiTemma force-pushed the form_for_contact branch 2 times, most recently from 86ccfd6 to 978454e Compare October 1, 2024 12:59
@MizukiTemma
Copy link
Member Author

@david-venhoff @PeterNerlich
The check boxes and related codes are removed. Could you review again?

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! The only thing missing are the changes to which fields are required I think.

In the details block are some nits, but I don't think they are required to merge this :)

I noticed that `Pages` does not line up with `Title` ![image](https://github.com/user-attachments/assets/8c97bdbe-dcf3-4bea-970f-a7b696356741)

But I did not find a quick fix, and it is probably not that important 🤷

When a user starts to edit a contact and then clicks on the archive or delete button, the unsaved warning will show up, which probably should not happen. But I guess this is also not important and probably would never happen ^^

integreat_cms/cms/forms/contacts/contact_form.py Outdated Show resolved Hide resolved
integreat_cms/cms/views/events/event_form_view.py Outdated Show resolved Hide resolved
integreat_cms/static/src/js/poi_box.ts Outdated Show resolved Hide resolved
@PeterNerlich
Copy link
Collaborator

@david-venhoff: I noticed that `Pages` does not line up with `Title`. But I did not find a quick fix, and it is probably not that important 🤷

image

This is because for the last column, this note is in its own div.p-4, while the other columns have it in a div.p-4 along with more content. The message and the following headline each have margins set, which don't add but collapse to the greater margin of both elements, while in the last column they each fully take up space, plus the padding from both div.p-4.

If we don't want to change _related_contents_table.html to have the outermost element only be a div.w-full.table-listing and push the responsibility of giving appropriate spacing to wherever it is being embedded (I don't know whether we have any conventions regarding html snippets like this), we could change all columns to have the hint on top to uniformly be in a separate div.p-4.pb-0.

Copy link
Member

@david-venhoff david-venhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

I'd just propose to move the new contact constraints to the database layer, instead of performing them at the form-level.

integreat_cms/cms/forms/contacts/contact_form.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@PeterNerlich PeterNerlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It feels nice to use with the way we settled to do the constraints now, I think revisiting those was worth it. Thank you very much!

integreat_cms/cms/views/contacts/contact_form_view.py Outdated Show resolved Hide resolved
Co-authored-by: David Venhoff <[email protected]>
Co-authored-by: Peter Nerlich <[email protected]>
@MizukiTemma MizukiTemma merged commit 1a2dc0d into develop Oct 4, 2024
5 checks passed
@MizukiTemma MizukiTemma deleted the form_for_contact branch October 4, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deadline Needs to be fixed in the given time prio: high Needs to be resolved ASAP.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[2024-11-07] Create form for contacts
5 participants