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
# 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))

View File

@ -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 %}
<div class="ui cards">
<a class="ui card" href="{{ url('treasury') }}">
<div class="content">
<div class="header">Treasury Connect</div>
<div class="description">Submit budgets for approval. Lodge reimbursement forms.</div>
</div>
<div class="ui bottom attached primary button">
{# .right.icon messes up the alignment #}
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
{% if 'sstreasury' in apps %}
<a class="ui card" href="{{ url('treasury') }}">
<div class="content">
<div class="header">Treasury Connect</div>
<div class="description">Submit budgets for approval. Lodge reimbursement forms.</div>
</div>
<div class="ui bottom attached primary button">
{# .right.icon messes up the alignment #}
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
{% endif %}
{#
<a class="ui card" href="#">
<div class="content">
@ -53,25 +55,29 @@
</div>
</a>
#}
<a class="ui card" href="{{ url('promotions') }}">
<div class="content">
<div class="header">Promotions Hub</div>
<div class="description">Create and manage bulletin items.</div>
</div>
<div class="ui bottom attached primary button">
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
<a class="ui card" href="{{ url('membership') }}">
<div class="content">
<div class="header">Membership Portal</div>
<div class="description">View and update your membership details.</div>
</div>
<div class="ui bottom attached primary button">
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
{% if 'sspromotions' in apps %}
<a class="ui card" href="{{ url('promotions') }}">
<div class="content">
<div class="header">Promotions Hub</div>
<div class="description">Create and manage bulletin items.</div>
</div>
<div class="ui bottom attached primary button">
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
{% endif %}
{% if 'ssmembership' in apps %}
<a class="ui card" href="{{ url('membership') }}">
<div class="content">
<div class="header">Membership Portal</div>
<div class="description">View and update your membership details.</div>
</div>
<div class="ui bottom attached primary button">
<i class="chevron right icon" style="margin: 0 .42857143em 0 -.21428571em;"></i>
Enter
</div>
</a>
{% endif %}
</div>
{% endblock %}

View File

@ -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})