fix: Use dedicated context variable for map to not interfer withother displays
This commit is contained in:
		@@ -19,7 +19,7 @@
 | 
				
			|||||||
        zoom: 5
 | 
					        zoom: 5
 | 
				
			||||||
    }).addControl(new maplibregl.NavigationControl());
 | 
					    }).addControl(new maplibregl.NavigationControl());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    {% for adoption_notice in adoption_notices %}
 | 
					    {% for adoption_notice in adoption_notices_map %}
 | 
				
			||||||
        {% if adoption_notice.location %}
 | 
					        {% if adoption_notice.location %}
 | 
				
			||||||
        // create the popup
 | 
					        // create the popup
 | 
				
			||||||
        const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}`);
 | 
					        const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}`);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,13 +39,13 @@ def fail_if_user_not_owner_or_trust_level(user, django_object, trust_level=User.
 | 
				
			|||||||
def index(request):
 | 
					def index(request):
 | 
				
			||||||
    """View function for home page of site."""
 | 
					    """View function for home page of site."""
 | 
				
			||||||
    latest_adoption_list = AdoptionNotice.objects.filter(
 | 
					    latest_adoption_list = AdoptionNotice.objects.filter(
 | 
				
			||||||
        adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")[:5]
 | 
					        adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")
 | 
				
			||||||
    active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
 | 
					    active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
 | 
				
			||||||
    language_code = translation.get_language()
 | 
					    language_code = translation.get_language()
 | 
				
			||||||
    lang = Language.objects.get(languagecode=language_code)
 | 
					    lang = Language.objects.get(languagecode=language_code)
 | 
				
			||||||
    active_announcements = Announcement.get_active_announcements(lang)
 | 
					    active_announcements = Announcement.get_active_announcements(lang)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context = {"adoption_notices": active_adoptions, "announcements": active_announcements}
 | 
					    context = {"adoption_notices": active_adoptions[:5], "adoption_notices_map": active_adoptions, "announcements": active_announcements}
 | 
				
			||||||
    for text_code in ["how_to", "introduction"]:
 | 
					    for text_code in ["how_to", "introduction"]:
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            context[text_code] = Text.objects.get(text_code=text_code, language=lang, )
 | 
					            context[text_code] = Text.objects.get(text_code=text_code, language=lang, )
 | 
				
			||||||
@@ -398,7 +398,7 @@ def modqueue(request):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def map(request):
 | 
					def map(request):
 | 
				
			||||||
    adoption_notices = AdoptionNotice.objects.all() #TODO: Filter to active
 | 
					    adoption_notices = AdoptionNotice.objects.all() #TODO: Filter to active
 | 
				
			||||||
    context = {"adoption_notices": adoption_notices}
 | 
					    context = {"adoption_notices_map": adoption_notices}
 | 
				
			||||||
    return render(request, 'fellchensammlung/map.html', context=context)
 | 
					    return render(request, 'fellchensammlung/map.html', context=context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user