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