mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
dark mode
This commit is contained in:
96
cookbook/templates/settings.html
Normal file
96
cookbook/templates/settings.html
Normal file
@@ -0,0 +1,96 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{% trans 'Settings' %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h3>
|
||||
{% trans 'Settings' %}
|
||||
</h3>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<h4><i class="fas fa-language"></i> {% trans 'Language' %}</h4>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
|
||||
<input class="form-control" name="next" type="hidden" value="{{ redirect_to }}">
|
||||
<select name="language" class="form-control">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
{% for language in languages %}
|
||||
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
|
||||
{{ language.name_local }} ({{ language.code }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<br/>
|
||||
<input type="submit" value="{% trans 'Save' %}" class="btn btn-success">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<h4><i class="fas fa-palette"></i>{% trans 'Style' %}</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
<label>
|
||||
{% trans 'Choose Theme' %}
|
||||
<select class="form-control" id="id_select_theme" onchange="changeTheme()">
|
||||
<option value="{% static 'themes/bootstrap.min.css' %}">{% trans 'Default' %}</option>
|
||||
<option value="{% static 'themes/flatly.min.css' %}">Flatly</option>
|
||||
<option value="{% static 'themes/darkly.min.css' %}">Darkly</option>
|
||||
<option value="{% static 'themes/superhero.min.css' %}">Superhero</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
<label>
|
||||
{% trans 'Choose Navigation Color' %}
|
||||
<select class="form-control" id="id_select_color" onchange="changeNavColor()">
|
||||
<option value="primary">Primary</option>
|
||||
<option value="secondary">Secondary</option>
|
||||
<option value="info">Info</option>
|
||||
<option value="success">Success</option>
|
||||
<option value="warning">Warning</option>
|
||||
<option value="danger">Danger</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<script type="text/javascript">
|
||||
if (theme !== "") {
|
||||
$('#id_select_theme').val(theme)
|
||||
}
|
||||
if (nav_color !== "") {
|
||||
$('#id_select_color').val(nav_color)
|
||||
}
|
||||
|
||||
function changeTheme() {
|
||||
let theme = $('#id_select_theme').val();
|
||||
document.cookie = "theme=" + theme + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function changeNavColor() {
|
||||
let color = $('#id_select_color').val();
|
||||
document.cookie = "color=" + color + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
|
||||
location.reload();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user