Don't show signup link if disable_signup.
parent
c438c1e2e0
commit
860f1afca5
|
@ -1,4 +1,5 @@
|
|||
import hashlib
|
||||
import os
|
||||
|
||||
from django import template
|
||||
from snipts.models import Favorite, Snipt
|
||||
|
@ -42,6 +43,12 @@ def snipts_count_for_user(context):
|
|||
return snipts
|
||||
|
||||
|
||||
@tag(register, [Constant('as'), Variable()])
|
||||
def signup_enabled(context, asvar):
|
||||
context[asvar] = os.environ.get("DISABLE_SIGNUP") != "true"
|
||||
return ''
|
||||
|
||||
|
||||
@tag(register, [Constant('as'), Variable()])
|
||||
def get_lexers(context, asvar):
|
||||
context[asvar] = get_lexers_list()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{% load snipt_tags static %}
|
||||
|
||||
{% signup_enabled as 'signup_is_enabled' %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="{% block html-class %}{% endblock %}" ng-app="Snipt">
|
||||
<head>
|
||||
|
@ -92,6 +94,11 @@
|
|||
<li>
|
||||
<a href="/login/?next={{ request.path }}" {% if '/login/' in request.path %} class="active"{% endif %}>Log in</a>
|
||||
</li>
|
||||
{% if signup_is_enabled %}
|
||||
<li>
|
||||
<a href="/signup/" {% if '/signup/' in request.path %} class="active"{% endif %}>Sign up</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="/{{ request.user.username }}/" {% if request.user.username in request.path %} class="active"{% endif %}>My snipts</a>
|
||||
|
@ -165,12 +172,6 @@
|
|||
Account
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/for-teams/">
|
||||
<i class="icon-star-empty icon-white"></i>
|
||||
For Teams
|
||||
</a>
|
||||
</li>
|
||||
{% if request.user.is_superuser %}
|
||||
<li>
|
||||
<a href="/admin/">
|
||||
|
|
Loading…
Reference in New Issue