File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 3636 "context_processors" : [
3737 "argus.auth.context_processors.preferences" ,
3838 "argus.htmx.context_processors.static_paths" ,
39+ "argus.htmx.user.context_processors.logout_context" ,
3940 ],
4041 "middleware" : {
4142 "argus.htmx.middleware.LoginRequiredMiddleware" : "end" ,
Original file line number Diff line number Diff line change 1+ {% include logout_modal.template_name with modal=logout_modal %}
12< form class ="flex " action ="{% url "htmx:logout " %}" method="post ">
23 {% csrf_token %}
34 < button class ="flex-1 text-start " type ="submit "> Log out</ button >
Original file line number Diff line number Diff line change 1+ """
2+ How to use:
3+
4+ Append the "context_processors" list for the TEMPLATES-backend
5+ ``django.template.backends.django.DjangoTemplates`` with the full dotted path.
6+
7+ See django settings for ``TEMPLATES``.
8+ """
9+
10+ from django .urls import reverse
11+
12+ from .views import LogoutModal
13+
14+
15+ def logout_context (request ):
16+ return {
17+ "logout_modal" : LogoutModal (
18+ endpoint = reverse ("htmx:logout" ),
19+ dialog_id = "logout-dialog" ,
20+ ),
21+ }
Original file line number Diff line number Diff line change 66
77from argus .auth .utils import get_preference_obj , save_preferences
88from argus .htmx .incident .views import HtmxHttpRequest
9+ from argus .htmx .modals import ConfirmationModal
10+
11+
12+ class LogoutModal (ConfirmationModal ):
13+ header : str = "Log out"
14+ submit_text : str = header
15+ button_title : str = header
16+ explanation : str = "Log out of Argus?"
917
1018
1119@require_GET
You can’t perform that action at this time.
0 commit comments