Hide apps not installed

This commit is contained in:
Yingtong Li 2019-01-25 23:01:44 +11:00
parent 4727a02914
commit b03d7457a7
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 54 additions and 42 deletions

View File

@ -1,5 +1,5 @@
# Society Self-Service # 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 # 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 # 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.contrib import admin
from django.urls import include, path from django.urls import include, path
urlpatterns = [ urlpatterns = []
path('admin/', admin.site.urls), urlpatterns.append(path('admin/', admin.site.urls))
path('auth/', include('social_django.urls', namespace='social')), urlpatterns.append(path('auth/', include('social_django.urls', namespace='social')))
path('treasury/', include('sstreasury.urls')),
path('promotions/', include('sspromotions.urls')), if 'sstreasury' in settings.INSTALLED_APPS:
path('membership/', include('ssmembership.urls')), urlpatterns.append(path('treasury/', include('sstreasury.urls')))
path('', include('ssmain.urls')), if 'sspromotions' in settings.INSTALLED_APPS:
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 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))

View File

@ -2,7 +2,7 @@
{# {#
Society Self-Service 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 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 it under the terms of the GNU Affero General Public License as published by
@ -30,6 +30,7 @@
{% block content %} {% block content %}
<div class="ui cards"> <div class="ui cards">
{% if 'sstreasury' in apps %}
<a class="ui card" href="{{ url('treasury') }}"> <a class="ui card" href="{{ url('treasury') }}">
<div class="content"> <div class="content">
<div class="header">Treasury Connect</div> <div class="header">Treasury Connect</div>
@ -41,6 +42,7 @@
Enter Enter
</div> </div>
</a> </a>
{% endif %}
{# {#
<a class="ui card" href="#"> <a class="ui card" href="#">
<div class="content"> <div class="content">
@ -53,6 +55,7 @@
</div> </div>
</a> </a>
#} #}
{% if 'sspromotions' in apps %}
<a class="ui card" href="{{ url('promotions') }}"> <a class="ui card" href="{{ url('promotions') }}">
<div class="content"> <div class="content">
<div class="header">Promotions Hub</div> <div class="header">Promotions Hub</div>
@ -63,6 +66,8 @@
Enter Enter
</div> </div>
</a> </a>
{% endif %}
{% if 'ssmembership' in apps %}
<a class="ui card" href="{{ url('membership') }}"> <a class="ui card" href="{{ url('membership') }}">
<div class="content"> <div class="content">
<div class="header">Membership Portal</div> <div class="header">Membership Portal</div>
@ -73,5 +78,6 @@
Enter Enter
</div> </div>
</a> </a>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -17,6 +17,7 @@
from django.contrib.auth import logout as auth_logout from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.urls import reverse from django.urls import reverse
@ -40,4 +41,4 @@ def logout(request):
@login_required @login_required
def splash(request): def splash(request):
return render(request, 'ssmain/splash.html') return render(request, 'ssmain/splash.html', {'apps': settings.INSTALLED_APPS})