Skip to content

Commit

Permalink
Merge pull request arachnys#562 from iPalash/develop
Browse files Browse the repository at this point in the history
Option to enable/disable subscription & duty pages
  • Loading branch information
frankh authored Sep 15, 2017
2 parents 3e2e1d4 + 3ae07bb commit edba32a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
10 changes: 8 additions & 2 deletions cabot/cabotapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ class Meta:
'data-rel': 'chosen',
'style': 'width: 70%',
}),
'users_to_notify': forms.CheckboxSelectMultiple(),
'users_to_notify': forms.SelectMultiple(attrs={
'data-rel': 'chosen',
'style': 'width: 70%',
}),
}

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -337,7 +340,10 @@ class Meta:
'data-rel': 'chosen',
'style': 'width: 70%',
}),
'users_to_notify': forms.CheckboxSelectMultiple(),
'users_to_notify': forms.SelectMultiple(attrs={
'data-rel': 'chosen',
'style': 'width: 70%',
}),
'hackpad_id': forms.TextInput(attrs={'style': 'width:70%;'}),
'runbook_link': forms.TextInput(attrs={'style': 'width:70%;'}),
}
Expand Down
8 changes: 8 additions & 0 deletions cabot/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.conf import settings


def global_settings(request):
return {
'ENABLE_SUBSCRIPTION': settings.ENABLE_SUBSCRIPTION,
'ENABLE_DUTY_ROTA': settings.ENABLE_DUTY_ROTA,
}
3 changes: 3 additions & 0 deletions cabot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'cabot.context_processors.global_settings',
],
'debug': force_bool(os.environ.get('TEMPLATE_DEBUG', False))
},
Expand Down Expand Up @@ -307,3 +308,5 @@
SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = os.environ.get('AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS', '').split(',')

EXPOSE_USER_API = force_bool(os.environ.get('EXPOSE_USER_API', False))
ENABLE_SUBSCRIPTION = force_bool(os.environ.get('ENABLE_SUBSCRIPTION', True))
ENABLE_DUTY_ROTA = force_bool(os.environ.get('ENABLE_DUTY_ROTA', True))
6 changes: 3 additions & 3 deletions cabot/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
</ul>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<li class="{% if not ENABLE_SUBSCRIPTION%}hidden{%endif%}">
<a href="{% url 'subscriptions' %}"><i class="fa fa-table"></i> Alert subscriptions</a>
</li>
<li>
<li class="{% if not ENABLE_DUTY_ROTA%}hidden{%endif%}">
<a href="{% url 'shifts' %}"><i class="glyphicon glyphicon-time"></i> Duty rota</a>
</li>
<li class="dropdown">
Expand All @@ -73,4 +73,4 @@
</ul>
</li>
</ul>
{% endblock header_navbar_menu %}
{% endblock header_navbar_menu %}

0 comments on commit edba32a

Please sign in to comment.