diff options
author | ankitjavalkar | 2020-05-18 19:08:39 +0530 |
---|---|---|
committer | GitHub | 2020-05-18 19:08:39 +0530 |
commit | 6f32060616b256546912cc8b29c9e9407839681b (patch) | |
tree | dea268e6fe4d62e8681fa1c37bf4f9e7a139bb6f | |
parent | c1b55f7a9a3e11ce4363206e86b6be3dfec90dd6 (diff) | |
parent | f41364c5a01360093e3b26a7427cdfacd4fb4776 (diff) | |
download | workshop_booking-6f32060616b256546912cc8b29c9e9407839681b.tar.gz workshop_booking-6f32060616b256546912cc8b29c9e9407839681b.tar.bz2 workshop_booking-6f32060616b256546912cc8b29c9e9407839681b.zip |
Merge pull request #134 from pnshiralkar/propose-ws-tnc
Propose workshop page terms and conditions
-rw-r--r-- | workshop_app/templates/workshop_app/propose_workshop.html | 42 | ||||
-rw-r--r-- | workshop_app/urls.py | 1 | ||||
-rw-r--r-- | workshop_app/views.py | 11 |
3 files changed, 53 insertions, 1 deletions
diff --git a/workshop_app/templates/workshop_app/propose_workshop.html b/workshop_app/templates/workshop_app/propose_workshop.html index 678d11e..5ebc435 100644 --- a/workshop_app/templates/workshop_app/propose_workshop.html +++ b/workshop_app/templates/workshop_app/propose_workshop.html @@ -26,6 +26,20 @@ maxDate: upto, beforeShowDay: $.datepicker.noWeekends, }); + + + $('#disp_tnc').click(function (e) { + e.preventDefault() + if ($('#id_workshop_type').val() === '') + $('.modal-body').html("<p class='text-danger'>Please select a workshop_type first!</p>") + else + $.ajax({ + url: '/workshop_type_tnc/' + $('#id_workshop_type').val(), + success: function (data) { + $('.modal-body').html(data.tnc) + } + }) + }) }); </script> {% endblock %} @@ -36,6 +50,10 @@ .errorlist { color: red; } + + .modal-open .modal{ + overflow-y: hidden; + } </style> <div class="container" align="center"> @@ -59,7 +77,9 @@ <br> {{ form.date }} <br> - {{ form.tnc_accepted }} I accept the <a href="/tnc">terms and conditions</a> + {{ form.tnc_accepted }} I accept the <a href="#" id="disp_tnc" data-toggle="modal" + data-target="#exampleModalCenter">terms and + conditions</a> <br> {% if form.errors %} <br> @@ -78,4 +98,24 @@ <br> </div> + <!-- Modal --> + <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" + aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> + <div class="modal-dialog modal-dialog-centered" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title" id="exampleModalLongTitle">Terms and Conditions</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> + </div> + </div> + </div> + </div> {% endblock %}
\ No newline at end of file diff --git a/workshop_app/urls.py b/workshop_app/urls.py index 5faf3ab..4c63c4c 100644 --- a/workshop_app/urls.py +++ b/workshop_app/urls.py @@ -31,6 +31,7 @@ urlpatterns = [ url(r'^change_workshop_date/(?P<workshop_id>\d+)$', views.change_workshop_date, name='change_workshop_date'), url(r'^propose_workshop/$', views.propose_workshop), url(r'^workshop_types/$', views.workshop_type_list), + url(r'^workshop_type_tnc/(?P<workshop_type_id>\d+)$', views.workshop_type_tnc, name='workshop_type_tnc'), url(r'^workshop_type_details/(?P<workshop_type_id>\d+)$', views.workshop_type_details), url(r'^view_profile/(?P<workshop_type_id>\d+)$', views.view_comment_profile, name='view_profile'), ] diff --git a/workshop_app/views.py b/workshop_app/views.py index 5b88d90..ab59795 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -1,3 +1,4 @@ +from django.http import JsonResponse, Http404 from django.db.models import Q from django.urls import reverse @@ -348,6 +349,16 @@ def workshop_type_details(request, workshop_type_id): ) +@login_required +def workshop_type_tnc(request, workshop_type_id): + workshop_type = WorkshopType.objects.filter(id=workshop_type_id) + if workshop_type.exists(): + workshop_type = workshop_type.first() + return JsonResponse({'tnc': workshop_type.terms_and_conditions}) + else: + raise Http404 + + def workshop_type_list(request): """Gives the details for types of workshops.""" user = request.user |