diff --git a/selfserv/urls.py b/selfserv/urls.py index 22c08b8..b993489 100644 --- a/selfserv/urls.py +++ b/selfserv/urls.py @@ -1,5 +1,5 @@ # Society Self-Service -# Copyright © 2018 Yingtong Li (RunasSudo) +# Copyright © 2018-2019 Yingtong Li (RunasSudo) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -19,11 +19,16 @@ from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path -urlpatterns = [ - path('admin/', admin.site.urls), - path('auth/', include('social_django.urls', namespace='social')), - path('treasury/', include('sstreasury.urls')), - path('promotions/', include('sspromotions.urls')), - path('membership/', include('ssmembership.urls')), - path('', include('ssmain.urls')), -] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +urlpatterns = [] +urlpatterns.append(path('admin/', admin.site.urls)) +urlpatterns.append(path('auth/', include('social_django.urls', namespace='social'))) + +if 'sstreasury' in settings.INSTALLED_APPS: + urlpatterns.append(path('treasury/', include('sstreasury.urls'))) +if 'sspromotions' in settings.INSTALLED_APPS: + urlpatterns.append(path('promotions/', include('sspromotions.urls'))) +if 'ssmembership' in settings.INSTALLED_APPS: + urlpatterns.append(path('membership/', include('ssmembership.urls'))) + +urlpatterns.append(path('', include('ssmain.urls'))) +urlpatterns.extend(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)) diff --git a/ssmain/jinja2/ssmain/splash.html b/ssmain/jinja2/ssmain/splash.html index 53e8223..1442446 100644 --- a/ssmain/jinja2/ssmain/splash.html +++ b/ssmain/jinja2/ssmain/splash.html @@ -2,7 +2,7 @@ {# Society Self-Service - Copyright © 2018 Yingtong Li (RunasSudo) + Copyright © 2018-2019 Yingtong Li (RunasSudo) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -30,17 +30,19 @@ {% block content %}
- -
-
Treasury Connect
-
Submit budgets for approval. Lodge reimbursement forms.
-
-
- {# .right.icon messes up the alignment #} - - Enter -
-
+ {% if 'sstreasury' in apps %} + +
+
Treasury Connect
+
Submit budgets for approval. Lodge reimbursement forms.
+
+
+ {# .right.icon messes up the alignment #} + + Enter +
+
+ {% endif %} {#
@@ -53,25 +55,29 @@
#} - -
-
Promotions Hub
-
Create and manage bulletin items.
-
-
- - Enter -
-
- -
-
Membership Portal
-
View and update your membership details.
-
-
- - Enter -
-
+ {% if 'sspromotions' in apps %} + +
+
Promotions Hub
+
Create and manage bulletin items.
+
+
+ + Enter +
+
+ {% endif %} + {% if 'ssmembership' in apps %} + +
+
Membership Portal
+
View and update your membership details.
+
+
+ + Enter +
+
+ {% endif %}
{% endblock %} diff --git a/ssmain/views.py b/ssmain/views.py index daa51d1..dc6ac13 100644 --- a/ssmain/views.py +++ b/ssmain/views.py @@ -17,6 +17,7 @@ from django.contrib.auth import logout as auth_logout from django.contrib.auth.decorators import login_required +from django.conf import settings from django.http import HttpResponse from django.shortcuts import render, redirect from django.urls import reverse @@ -40,4 +41,4 @@ def logout(request): @login_required def splash(request): - return render(request, 'ssmain/splash.html') + return render(request, 'ssmain/splash.html', {'apps': settings.INSTALLED_APPS})