summaryrefslogtreecommitdiff
path: root/workshop_app
diff options
context:
space:
mode:
Diffstat (limited to 'workshop_app')
-rw-r--r--workshop_app/static/workshop_app/js/datepicker.js53
-rw-r--r--workshop_app/templates/workshop_app/workshop_status_coordinator.html (renamed from workshop_app/templates/workshop_app/my_workshops.html)21
-rw-r--r--workshop_app/templates/workshop_app/workshop_status_instructor.html (renamed from workshop_app/templates/workshop_app/workshop_status.html)82
-rw-r--r--workshop_app/urls.py8
-rw-r--r--workshop_app/views.py22
5 files changed, 89 insertions, 97 deletions
diff --git a/workshop_app/static/workshop_app/js/datepicker.js b/workshop_app/static/workshop_app/js/datepicker.js
new file mode 100644
index 0000000..f419f86
--- /dev/null
+++ b/workshop_app/static/workshop_app/js/datepicker.js
@@ -0,0 +1,53 @@
+//ToolTip popup function on-hover
+$(document).ready(function () {
+ $('[data-toggle="popover"]').popover({
+ placement: 'top',
+ trigger: 'hover'
+ });
+});
+
+//ToolTip popup function on-hover
+$(document).ready(function () {
+ $('[data-toggle="popinfo"]').popover({
+ placement: 'top',
+ trigger: 'hover'
+ });
+});
+
+// Change date modal
+function changeDate(date) {
+ let previous_date = new Date(date);
+ let dateToday = new Date();
+ let upto = new Date();
+
+ previous_date.setDate(previous_date.getDate() + 1);
+ upto.setFullYear(dateToday.getFullYear() + 1);
+
+ let counter = date.split(" ");
+ const id = counter.slice(-1).pop();
+ if (date[0] === 'P') {
+ counter = '.pDate' + id
+ $(counter).datepicker({
+ changeMonth: true,
+ changeYear: true,
+ minDate: dateToday,
+ maxDate: upto,
+ dateFormat: "yy-mm-dd",
+ });
+ $(".ui-dialog-content").dialog("close");
+ $('.myDialogP' + id).dialog();
+
+ } else {
+ counter = '.rDate' + id;
+ $(counter).datepicker({
+ changeMonth: true,
+ changeYear: true,
+ minDate: dateToday,
+ maxDate: upto,
+ dateFormat: "yy-mm-dd",
+ });
+ $(".ui-dialog-content").dialog("close");
+ $('.myDialogR' + id).dialog();
+
+ }
+}; \ No newline at end of file
diff --git a/workshop_app/templates/workshop_app/my_workshops.html b/workshop_app/templates/workshop_app/workshop_status_coordinator.html
index b5b4add..07045de 100644
--- a/workshop_app/templates/workshop_app/my_workshops.html
+++ b/workshop_app/templates/workshop_app/workshop_status_coordinator.html
@@ -5,7 +5,16 @@
{% endblock %}
{% block content %}
- {% if workshops %}
+ {% if not workshops %}
+ <div class="container">
+ <div class="jumbotron">
+ <h1>Welcome {{ user.first_name }}</h1>
+ <p>Information Related to your workshops will be shown here, you can also
+ propose a Workshop as per your available date in <strong>Workshops > Propose a Workshop
+ tab</strong> .</p>
+ </div>
+ </div>
+ {% else %}
<h3 class="text-center" style="color:#2952a2;">The status of your workshops </h3>
<br>
@@ -67,16 +76,6 @@
{% endfor %}
</table>
</div>
-
- {% else %}
- <div class="container">
- <div class="jumbotron">
- <h1>Welcome {{ user.first_name }}</h1>
- <p>Information Related to your workshops will be shown here, you can also
- propose a Workshop as per your available date in <strong>Workshops > Propose a Workshop
- tab</strong> .</p>
- </div>
- </div>
{% endif %}
{% endblock %}
diff --git a/workshop_app/templates/workshop_app/workshop_status.html b/workshop_app/templates/workshop_app/workshop_status_instructor.html
index b2b17ee..0a246b3 100644
--- a/workshop_app/templates/workshop_app/workshop_status.html
+++ b/workshop_app/templates/workshop_app/workshop_status_instructor.html
@@ -10,67 +10,23 @@
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
{% endblock %}
{% block extra-custom-scripts %}
- <script>
- //ToolTip popup function on-hover
- $(document).ready(function () {
- $('[data-toggle="popover"]').popover({
- placement: 'top',
- trigger: 'hover'
- });
- });
-
- //ToolTip popup function on-hover
- $(document).ready(function () {
- $('[data-toggle="popinfo"]').popover({
- placement: 'top',
- trigger: 'hover'
- });
- });
-
- // Change date modal
- function changeDate(date) {
- let previous_date = new Date(date);
- let dateToday = new Date();
- let upto = new Date();
-
- previous_date.setDate(previous_date.getDate() + 1);
- upto.setFullYear(dateToday.getFullYear() + 1);
-
- let counter = date.split(" ");
- const id = counter.slice(-1).pop();
- if (date[0] === 'P') {
- counter = '.pDate' + id
- $(counter).datepicker({
- changeMonth: true,
- changeYear: true,
- minDate: dateToday,
- maxDate: upto,
- dateFormat: "yy-mm-dd",
- });
- $(".ui-dialog-content").dialog("close");
- $('.myDialogP' + id).dialog();
-
- } else {
- counter = '.rDate' + id;
- $(counter).datepicker({
- changeMonth: true,
- changeYear: true,
- minDate: dateToday,
- maxDate: upto,
- dateFormat: "yy-mm-dd",
- });
- $(".ui-dialog-content").dialog("close");
- $('.myDialogR' + id).dialog();
-
- }
- };
-
- </script>
+ {% load static %}
+ <script src="{% static 'workshop_app/js/datepicker.js' %}"></script>
{% endblock %}
{% block content %}
- {% if workshops %}
+ {% if not workshops %}
+ <div class="container">
+ <div class="jumbotron">
+ <h1>Welcome {{ user.first_name }}</h1>
+ <p>Your workshop related information will be shown here, Please navigate to <b>Workshop list</b> and
+ depending upon
+ your expertise and availability create a workshop by going to
+ <b>Create Workshop</b>.</p>
+ </div>
+ </div>
+ {% else %}
<h3 class="text-center" style="color:#2952a2;">The status of your workshops </h3>
<br>
@@ -173,18 +129,6 @@
{% endfor %}
</table>
</div>
-
- <!-- No workshops for the user -->
- {% else %}
- <div class="container">
- <div class="jumbotron">
- <h1>Welcome {{ user.first_name }}</h1>
- <p>Your workshop related information will be shown here, Please navigate to <b>Workshop list</b> and
- depending upon
- your expertise and availability create a workshop by going to
- <b>Create Workshop</b>.</p>
- </div>
- </div>
{% endif %}
{% endblock %}
diff --git a/workshop_app/urls.py b/workshop_app/urls.py
index 32378fd..d18b8a9 100644
--- a/workshop_app/urls.py
+++ b/workshop_app/urls.py
@@ -16,10 +16,6 @@ Including another URLconf
from django.conf.urls import url
from workshop_app import views
-js_info_dict = {
- 'packages': ('recurrence',),
-}
-
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^register/$', views.user_register),
@@ -29,8 +25,8 @@ urlpatterns = [
url(r'^logout/$', views.user_logout),
url(r'^view_profile/$', views.view_profile),
url(r'^edit_profile/$', views.edit_profile),
- url(r'^my_workshops/$', views.my_workshops, name='my_workshops'), # Coordinator
- url(r'^workshop_status/$', views.workshop_status, name='workshop_status'), # Instructor
+ url(r'^workshop_status$', views.workshop_status_coordinator, name='workshop_status_coordinator'),
+ url(r'^dashboard$', views.workshop_status_instructor, name='workshop_status_instructor'),
url(r'^accept_workshop/([1-9][0-9]*)$', views.accept_workshop, name='accept_workshop'),
url(r'^change_workshop_date/([1-9][0-9]*)$', views.change_workshop_date, name='change_workshop_date'),
url(r'^propose_workshop/$', views.propose_workshop),
diff --git a/workshop_app/views.py b/workshop_app/views.py
index 9f077a3..2eba2e0 100644
--- a/workshop_app/views.py
+++ b/workshop_app/views.py
@@ -44,8 +44,8 @@ def is_instructor(user):
def get_landing_page(user):
# For now, landing pages of both instructor and coordinator are same
if is_instructor(user):
- return reverse('workshop_status')
- return reverse('my_workshops')
+ return reverse('workshop_status_instructor')
+ return reverse('workshop_status_coordinator')
# View functions
@@ -152,7 +152,7 @@ def user_register(request):
)
else:
if request.user.is_authenticated and is_email_checked(request.user):
- return redirect('/my_workshops/')
+ return redirect(get_landing_page(request.user))
elif request.user.is_authenticated:
return render(request, 'workshop_app/activation.html')
form = UserRegistrationForm()
@@ -197,7 +197,7 @@ def edit_profile(request):
# Workshop views
@login_required
-def my_workshops(request):
+def workshop_status_coordinator(request):
""" Workshops proposed by Coordinator """
user = request.user
if is_instructor(user):
@@ -205,12 +205,12 @@ def my_workshops(request):
workshops = Workshop.objects.filter(
coordinator=user.id
).order_by('-date')
- return render(request, 'workshop_app/my_workshops.html',
+ return render(request, 'workshop_app/workshop_status_coordinator.html',
{"workshops": workshops})
@login_required
-def workshop_status(request):
+def workshop_status_instructor(request):
""" Workshops to accept and accepted by Instructor """
user = request.user
if not is_instructor(user):
@@ -226,7 +226,7 @@ def workshop_status(request):
).order_by('-date')
workshops = list(proposed_workshop) + list(proposed_workshop_pending)
- return render(request, 'workshop_app/workshop_status.html',
+ return render(request, 'workshop_app/workshop_status_instructor.html',
{"workshops": workshops,
"today": today})
@@ -262,7 +262,7 @@ def accept_workshop(request, workshop_id):
other_email=workshop.coordinator.email,
phone_number=request.user.profile.phone_number
)
- return redirect(reverse('workshop_status'))
+ return redirect(reverse('workshop_status_instructor'))
@login_required
@@ -292,7 +292,7 @@ def change_workshop_date(request, workshop_id):
workshop_date=str(workshop_date),
other_email=workshop.first().coordinator.email
)
- return redirect(reverse('workshop_status'))
+ return redirect(reverse('workshop_status_instructor'))
# TODO: Show terms n conditions of selected ws type
@@ -318,7 +318,7 @@ def propose_workshop(request):
workshop_type=form_data.workshop_type,
coordinator=form_data.coordinator
).exists():
- return redirect('/my_workshops/')
+ return redirect(get_landing_page(user))
else:
form_data.save()
instructors = Profile.objects.filter(position='instructor')
@@ -332,7 +332,7 @@ def propose_workshop(request):
phone_number=user.profile.phone_number,
institute=user.profile.institute
)
- return redirect('/my_workshops/')
+ return redirect(get_landing_page(user))
# GET request
return render(
request, 'workshop_app/propose_workshop.html',