mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
50 lines
1.3 KiB
HTML
50 lines
1.3 KiB
HTML
{% extends "base.html" %}
|
|
{% load django_tables2 %}
|
|
{% load crispy_forms_tags %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "Cookbook" %}{% endblock %}
|
|
|
|
{% block content %}
|
|
{% if filter %}
|
|
<div class="card">
|
|
<div class="card-header">
|
|
{% trans "Search" %}
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="" method="get">
|
|
{{ filter.form|crispy }}
|
|
<input class="btn btn-primary" type="submit"/>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
<br/>
|
|
|
|
{% if recipes %}
|
|
{% render_table recipes %}
|
|
{% else %}
|
|
<div class="alert alert-danger" role="alert">
|
|
{% trans "Log in to view Recipies" %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
<script type="text/javascript">
|
|
function openRecipe(id) {
|
|
url = "{% url 'get_file_link' recipe_id=12345 %}".replace(/12345/, id);
|
|
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function () {
|
|
if (this.readyState === 4 && this.status === 200) {
|
|
console.log(this.response);
|
|
window.open(this.responseText, '_blank');
|
|
}
|
|
};
|
|
xhttp.open("GET", url, true);
|
|
xhttp.send();
|
|
}
|
|
</script>
|
|
|
|
{% endblock %} |