Skip to content

Commit 3f6a90c

Browse files
committed
added config for modal, access via View)
1 parent eafacbd commit 3f6a90c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

chipy_org/apps/contact/views.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ class ContactView(FormView):
99
form_class = ContactForm
1010
success_url = "/contact"
1111
message_as_modal = True
12+
modal_config = {
13+
"close_button_redirect": "/",
14+
"close_button_label": "Return to home"
15+
}
1216

1317
def form_valid(self, form):
1418
try:
@@ -23,4 +27,5 @@ def get_context_data(self, **kwargs):
2327
""" Used to access message_as_modal in template as context """
2428
context = super(ContactView, self).get_context_data(**kwargs)
2529
context.update({"message_as_modal": self.message_as_modal})
30+
context.update({"modal_config": self.modal_config})
2631
return context

chipy_org/templates/_modal.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ <h5 class="modal-title black-text" id="modalLabel">Thank You.</h5>
1515
class="btn btn-primary"
1616
data-bs-dismiss="modal"
1717
aria-label="Close"
18-
onclick="javascript:window.location='/'">
19-
Return to home
18+
onclick="javascript:window.location='{{ modal_config.close_button_redirect }}'">
19+
{{ modal_config.close_button_label }}
2020
</button>
2121
</div>
2222
</div>

0 commit comments

Comments
 (0)