Skip to content

Commit

Permalink
Merge pull request #63 from IMIO/test-lint
Browse files Browse the repository at this point in the history
Added classes to contact sections to differentiate the type of contact (multiple or single)
  • Loading branch information
thomlamb authored Feb 17, 2025
2 parents caf5835 + 6e3a008 commit e703d7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
1.2.89 (unreleased)
-------------------

- WEB-4225 : Added classes to contact sections to differentiate the type of contact (multiple or single)
[thomlamb]

- Fix issue : We don't need carousel view in timestamped publications
[boulch]

Expand Down
7 changes: 5 additions & 2 deletions src/imio/smartweb/core/contents/sections/contact/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
<metal:macro use-macro="context/@@sections_macros/section_edition" />
<div class="container section-container section-contact"
id=""
tal:define="batch view/contacts | nothing"
tal:define="batch view/contacts | nothing;
number_of_contacts view/get_number_of_contacts"
tal:attributes="id string:container-section-${context/id}"
i18n:domain="imio.smartweb">
<div class="number_of_contacts"></div>
<metal:macro use-macro="context/@@sections_macros/section_title" />
<div class="row"
<div tal:attributes="class string:row nb-contact-by-line-${context/nb_contact_by_line} number-of-contacts-${number_of_contacts}"
tal:repeat="items batch">
<tal:block tal:content="structure python:context.__dict__" />
<tal:loop tal:repeat="item items">
<metal:macro use-macro="context/@@contact_macros/contact_body"
tal:define="section_view nocall:view;
Expand Down
11 changes: 11 additions & 0 deletions src/imio/smartweb/core/contents/sections/contact/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
class ContactView(HashableJsonSectionView):
"""Contact Section view"""

def get_number_of_contacts(self):
"""
Returns the number of related contacts.
"""
related_contacts = (
self.context.related_contacts
) # Assurez-vous que 'related_contacts' est une liste
if related_contacts:
return len(related_contacts)
return 0

def contacts(self):
# Firstly, try to get contact from the container view
container_view = queryMultiAdapter(
Expand Down

0 comments on commit e703d7b

Please sign in to comment.