diff options
author | pnshiralkar | 2020-05-18 20:35:54 +0530 |
---|---|---|
committer | pnshiralkar | 2020-05-18 20:35:54 +0530 |
commit | a950ed30df4186cee4f08cbde8ad8a210d134e8b (patch) | |
tree | aa58236df5d5f2219c3760b3c971d66d21bfcb51 | |
parent | 19bdce8e9584aadc6a82ec36d65ead9f54e9a774 (diff) | |
parent | 6f32060616b256546912cc8b29c9e9407839681b (diff) | |
download | workshop_booking-a950ed30df4186cee4f08cbde8ad8a210d134e8b.tar.gz workshop_booking-a950ed30df4186cee4f08cbde8ad8a210d134e8b.tar.bz2 workshop_booking-a950ed30df4186cee4f08cbde8ad8a210d134e8b.zip |
Resolved merge conflicts
-rw-r--r-- | workshop_app/templates/workshop_app/propose_workshop.html | 42 | ||||
-rw-r--r-- | workshop_app/urls.py | 3 | ||||
-rw-r--r-- | workshop_app/views.py | 15 |
3 files changed, 56 insertions, 4 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 3c22a05..eb101c3 100644 --- a/workshop_app/urls.py +++ b/workshop_app/urls.py @@ -33,5 +33,6 @@ urlpatterns = [ url(r'^workshop_types/$', views.workshop_type_list), url(r'^workshops/(?P<workshop_id>\d+)$', views.workshop_details, name='workshop_details'), url(r'^workshop_type_details/(?P<workshop_type_id>\d+)$', views.workshop_type_details, name='workshop_type_details'), - url(r'^view_profile/(?P<workshop_type_id>\d+)$', views.view_comment_profile, name='view_profile') + url(r'^workshop_type_tnc/(?P<workshop_type_id>\d+)$', views.workshop_type_tnc, name='workshop_type_tnc'), + 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 1a84833..b2f56cc 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -1,5 +1,5 @@ -from django.http import Http404 from django.db.models import Q +from django.http import JsonResponse, Http404 from django.urls import reverse try: @@ -349,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 @@ -388,7 +398,8 @@ def workshop_details(request, workshop_id): else: workshop_comments = WorkshopComment.objects.filter(workshop=workshop, public=True) return render(request, 'workshop_app/workshop_details.html', - {'workshop': workshop, 'workshop_comments': workshop_comments, 'form': WorkshopCommentsForm(initial={'public': True})}) + {'workshop': workshop, 'workshop_comments': workshop_comments, + 'form': WorkshopCommentsForm(initial={'public': True})}) @login_required |