dark mode reverted + meal plan button
This commit is contained in:
parent
c96159e15c
commit
bc066d29f6
@ -30,7 +30,7 @@
|
|||||||
return b ? b.pop() : '';
|
return b ? b.pop() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
let theme_list = ['{% static 'themes/bootstrap.min.css' %}', '{% static 'themes/flatly.min.css' %}', '{% static 'themes/darkly.min.css' %}', '{% static 'themes/superhero.min.css' %}'];
|
let theme_list = ['{% static 'themes/bootstrap.min.css' %}', '{% static 'themes/flatly.min.css' %}', '{% static 'themes/superhero.min.css' %}'];
|
||||||
|
|
||||||
let css = $('#id_main_css');
|
let css = $('#id_main_css');
|
||||||
let theme = getCookieValue('theme');
|
let theme = getCookieValue('theme');
|
||||||
|
@ -23,4 +23,14 @@
|
|||||||
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
|
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
{% if default_recipe %}
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#id_recipe').val({{ default_recipe.pk }}).trigger('change');
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -47,7 +47,7 @@
|
|||||||
<select class="form-control" id="id_select_theme" onchange="changeTheme()">
|
<select class="form-control" id="id_select_theme" onchange="changeTheme()">
|
||||||
<option value="{% static 'themes/bootstrap.min.css' %}">{% trans 'Default' %}</option>
|
<option value="{% static 'themes/bootstrap.min.css' %}">{% trans 'Default' %}</option>
|
||||||
<option value="{% static 'themes/flatly.min.css' %}">Flatly</option>
|
<option value="{% static 'themes/flatly.min.css' %}">Flatly</option>
|
||||||
<option value="{% static 'themes/darkly.min.css' %}">Darkly</option>
|
<!--<option value="{% static 'themes/darkly.min.css' %}">Darkly</option>-->
|
||||||
<option value="{% static 'themes/superhero.min.css' %}">Superhero</option>
|
<option value="{% static 'themes/superhero.min.css' %}">Superhero</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
@ -126,4 +128,11 @@ class MealPlanCreate(LoginRequiredMixin, CreateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(MealPlanCreate, self).get_context_data(**kwargs)
|
context = super(MealPlanCreate, self).get_context_data(**kwargs)
|
||||||
context['title'] = _("Meal-Plan")
|
context['title'] = _("Meal-Plan")
|
||||||
|
|
||||||
|
recipe = self.request.GET.get('recipe')
|
||||||
|
if recipe:
|
||||||
|
if re.match(r'^([0-9])+$', recipe):
|
||||||
|
if Recipe.objects.filter(pk=int(recipe)).exists():
|
||||||
|
context['default_recipe'] = Recipe.objects.get(pk=int(recipe))
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
Loading…
Reference in New Issue
Block a user