nice checkboxes

This commit is contained in:
vabene1111
2019-12-24 09:39:53 +01:00
parent 6c6264ce4d
commit 3428e75b86
3 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="JavaScriptLibraryMappings"> <component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{jquery-3.4.1.slim, select2-bootstrap, tabulator_bootstrap4}" /> <file url="file://$PROJECT_DIR$" libraries="{pretty-checkbox}" />
</component> </component>
</project> </project>

View File

@ -5,6 +5,11 @@
{% block title %}{% trans 'View' %}{% endblock %} {% block title %}{% trans 'View' %}{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pretty-checkbox@3.0/dist/pretty-checkbox.min.css"
integrity="sha384-ICB8i/maQ/5+tGLDUEcswB7Ch+OO9Oj8Z4Ov/Gs0gxqfTgLLkD3F43MhcEJ2x6/D" crossorigin="anonymous">
{% endblock %}
{% block content %} {% block content %}
<h3>{{ recipe.name }} <a href="{% url 'edit_recipe' recipe.pk %}"><i class="fas fa-pencil-alt"></i></a></h3> <h3>{{ recipe.name }} <a href="{% url 'edit_recipe' recipe.pk %}"><i class="fas fa-pencil-alt"></i></a></h3>
@ -40,9 +45,16 @@
<table class=""> <table class="">
{% for i in ingredients %} {% for i in ingredients %}
<tr> <tr>
<td><input type="checkbox"></td> <td style="font-size: large">
<td>{{ i.amount.normalize }} {{ i.unit }}</td> <div class="pretty p-default p-curve">
<td style="padding-left: 8px">{{ i.name }}</td> <input type="checkbox"/>
<div class="state p-success">
<label>{{ i.amount.normalize }} {{ i.unit }}</label>
</div>
</div>
</td>
<td style="font-size: large">{{ i.name }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -114,4 +126,5 @@
{% if recipe.storage %} {% if recipe.storage %}
{% include 'include/recipe_open_modal.html' %} {% include 'include/recipe_open_modal.html' %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -15,7 +15,7 @@ from cookbook.provider.nextcloud import Nextcloud
def get_file_link(request, recipe_id): def get_file_link(request, recipe_id):
recipe = Recipe.objects.get(id=recipe_id) recipe = Recipe.objects.get(id=recipe_id)
if recipe.instructions: if recipe.internal:
return HttpResponse(reverse('view_recipe', args=[recipe_id])) return HttpResponse(reverse('view_recipe', args=[recipe_id]))
if recipe.storage.method == Storage.DROPBOX: if recipe.storage.method == Storage.DROPBOX:
if recipe.link == "": if recipe.link == "":