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

💄 [#1492] Adding notification dot in login menu #739

Merged
merged 6 commits into from
Aug 28, 2023

Conversation

jiromaykin
Copy link
Contributor

@jiromaykin jiromaykin commented Aug 21, 2023

https://taiga.maykinmedia.nl/project/open-inwoner/task/1492

show just a dot IF there are any notifications for messages OR plans.
we do not have a design for this so I just made it look like this (dot has the same size as the other one and overlaps the down-arrow a bit):

open-dicht-dot

@jiromaykin jiromaykin force-pushed the feature/1492-display-notification-dot branch 2 times, most recently from 34445d5 to 97c75a6 Compare August 22, 2023 08:04
@jiromaykin jiromaykin marked this pull request as ready for review August 22, 2023 08:07
@jiromaykin jiromaykin force-pushed the feature/1492-display-notification-dot branch from 26731b0 to 806f62b Compare August 22, 2023 10:30
Comment on lines 11 to 15
{% for child in children %}
{% if child.indicator %}
<span class="indicator"><span class="indicator__dot"></span></span>
{% endif %}
{% endfor %}
Copy link
Contributor

Choose a reason for hiding this comment

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

This for-loop is probably not what we want, as there could be multiple menu items with indicators.

Also there is a weird situation because the children context variable shouldn't be present at this point, it supposedly gets generated by show_menu_below_id a little further down.

I'll investigate what is going on and create a snippet of code for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be a pattern. Cf. e.g. templates/cms/menu/primary.html: a loop over children, even though the context is updated by show_menu further down.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like a bug or flaw in django-cms where it doesn't use the context stack the way template tags are supposed to. I filled an issue django-cms/django-cms#7628 but I don't expect anything from it.

@Bartvaderkin Bartvaderkin self-assigned this Aug 22, 2023
@jiromaykin jiromaykin force-pushed the feature/1492-display-notification-dot branch 2 times, most recently from d6b82b8 to 7eae139 Compare August 24, 2023 09:23
@jiromaykin jiromaykin force-pushed the feature/1492-display-notification-dot branch from 7e870c3 to 7b6cc04 Compare August 24, 2023 09:36
Bart van der Schoor and others added 3 commits August 24, 2023 11:45
…menu-indicators issue & context pollution

Also dropped the `header` template tag.
…ation-dot-fix

[#1492] Capture django-cms menu output and re-use, as workaround for menu-indicators issue & context pollution
@Bartvaderkin
Copy link
Contributor

Bartvaderkin commented Aug 24, 2023

@jiromaykin We were a bit too early to merge my fix branch, but at least the test did catch the issue you spotted as well.

I appended a fix, let's see if it turns green.

@@ -86,7 +86,7 @@ def test_only_published_subcategories_exist_in_detail_page_when_logged_in(self):
def test_only_published_categories_exist_in_my_categories_page(self):
response = self.app.get(reverse("profile:categories"), user=self.user)
self.assertEqual(
list(response.context["categories"]),
list(response.context["menu_categories"]),
Copy link
Contributor

Choose a reason for hiding this comment

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

This test didn't test what it supposed to test (it is not about the menu but about a form), so this fix is not what we want. I'm rewriting it right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jiromaykin I pushed a fix for this as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Bartvaderkin The bad test is no longer bad - all seems good now! + and @pi-sigma also the "configure Onderwerpen to become invisible for logged out users" still seems to be working this way. May have something to do with the 'context'.

@codecov-commenter
Copy link

Codecov Report

Merging #739 (5e9b37f) into develop (4c96c35) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop     #739   +/-   ##
========================================
  Coverage    96.28%   96.28%           
========================================
  Files          676      676           
  Lines        24044    24044           
========================================
  Hits         23151    23151           
  Misses         893      893           
Files Changed Coverage Δ
...pen_inwoner/components/templatetags/header_tags.py 100.00% <ø> (ø)
src/open_inwoner/pdc/tests/test_category.py 100.00% <ø> (ø)
src/open_inwoner/cms/extensions/cms_menus.py 75.00% <100.00%> (+1.82%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@alextreme alextreme merged commit d7a9c3c into develop Aug 28, 2023
10 checks passed
@alextreme alextreme deleted the feature/1492-display-notification-dot branch August 28, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants