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