big cleanup

This commit is contained in:
vabene1111
2025-06-22 11:37:35 +02:00
parent 9fc77be51b
commit edcc5f6441
309 changed files with 15636 additions and 131437 deletions

View File

@@ -1,31 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
{% block title %}{% trans 'Batch edit Category' %}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h3>
{% trans 'Batch edit Recipes' %}
</h3>
<div class="card border-info" >
<div class="card-body text-info">
<p class="card-text">{% trans 'Add the specified keywords to all recipes containing a word' %}</p>
</div>
</div>
<br/>
<form method="POST" class="post-form">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-success">
</form>
{% endblock %}

View File

@@ -1,35 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
{% block title %}{% trans 'Sync' %}{% endblock %}
{% block content %}
<h3>{% trans 'Manage watched Folders' %}</h3>
<div class="card border-info">
<div class="card-body text-info">
<p class="card-text">
{% trans 'On this Page you can manage all storage folder locations that should be monitored and synced.' %}
<br/>
{% trans 'The path must be in the following format' %}: <code>/Folder/RecipesFolder</code>
</p>
<form method="POST" class="post-form">{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="{% trans 'Save' %}" class="btn btn-success">
<a href="{% url 'list_storage' %}"><button type="button" class="btn btn-primary">{% trans 'Manage External Storage' %}</button></a>
</form>
</div>
</div>
<br/>
<a href="{% url 'data_sync_wait' %}" class="btn btn-warning">{% trans 'Sync Now!' %}</a>
<a href="{% url 'list_recipe_import' %}" class="btn btn-info">{% trans 'Show Recipes' %}</a>
<a href="{% url 'list_sync_log' %}" class="btn btn-secondary">{% trans 'Show Log' %}</a>
<br/><br/>
{% render_table monitored_paths %}
{% endblock %}

View File

@@ -1,38 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'Importing Recipes' %}{% endblock %}
{% block content %}
<h3>
{% trans 'Importing Recipes' %}
</h3>
<br/>
<br/>
<br/>
<br/>
<div class="text-center">
{% if not request.user.is_authenticated or request.user.userpreference.theme == request.user.userpreference.TANDOOR %}
<img class="spinner-tandoor"/>
{% else %}
<i class="fas fa-sync fa-spin fa-10x"></i>
{% endif %}
<br/>
<br/>
<br/>
<div class="alert alert-success" role="alert">
{% trans 'This can take a few minutes, depending on the number of recipes in sync, please wait.' %}
</div>
</div>
<script>
$(document).ready(function () {
window.location.href = "{% url 'api_sync' %}"
});
</script>
{% endblock %}

View File

@@ -1,33 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Recipe Books' %}{% endblock %}
{% block content_fluid %}
<div id="app" >
<cookbook-view></cookbook-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
</script>
{% render_bundle 'cookbook_view' %}
{% endblock %}

View File

@@ -1,32 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Export Recipes' %}{% endblock %}
{% block content %}
<div id="app">
<export-view></export-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
{% if pk %}
window.EXPORT_ID = {{ pk }}
{% else %}
window.EXPORT_ID = null
{% endif %}
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}';
</script>
{% render_bundle 'export_view' %}
{% endblock %}

View File

@@ -1,33 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Export' %}{% endblock %}
{% block content %}
<div id="app">
<export-response-view></export-response-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
{% if pk %}
window.EXPORT_ID = {{ pk }}
{% else %}
window.EXPORT_ID = null
{% endif %}
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
</script>
{% render_bundle 'export_response_view' %}
{% endblock %}

View File

@@ -1,24 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% block title %}{% trans 'Import new Recipe' %}{% endblock %}
{% block content %}
<h3>{% trans 'Import new Recipe' %}</h3>
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
</form>
<script>
//converts multiselct in recipe edit to searchable multiselect
//shitty solution that needs to be redone at some point
$(document).ready(function () {
$('#id_keywords').select2();
});
</script>
{% endblock %}

View File

@@ -1,42 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Edit Recipe' %}{% endblock %}
{% block extra_head %}
{% endblock %}
{% block content %}
<div id="app">
<edit-internal-recipe></edit-internal-recipe>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.RECIPE_ID = {{ recipe.pk }}
window.DEFAULT_UNIT = '{{request.user.userpreference.default_unit}}'
window.USER_PREF = {
'use_kj': {% if request.user.userpreference.use_kj %} true {% else %} false {% endif %},
}
</script>
{% render_bundle 'edit_internal_recipe' %}
{% endblock %}

View File

@@ -47,6 +47,7 @@
<script type="application/javascript">
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
{#window.addEventListener("load", () => {#}
{# if ("serviceWorker" in navigator) {#}
{# navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {#}
@@ -56,9 +57,9 @@
{# } else {#}
{# console.warn('service worker not in navigator');#}
{# }#}
{#})
;
#}
{#});#}
</script>
</body>

View File

@@ -1,78 +0,0 @@
{% extends "base.html" %}
{% load custom_tags %}
{% load custom_tags %}
{% load crispy_forms_tags %}
{% load i18n %}
{% block title %}{% trans 'Delete' %} - {{ title }}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h3>{% trans 'Delete' %} {{ title }}</h3>
<form action="." method="post">
{% csrf_token %}
<div class="alert alert-warning" role="alert">
{% blocktrans %}Are you sure you want to delete the {{ title }}: <b>{{ object }}</b> {% endblocktrans %}
{% trans 'This cannot be undone!' %}
</div>
{{ form|crispy }}
{% if protected_objects %}
<h5>{% trans 'Protected' %} <small class="text-muted">The object you are trying to delete is <b>protected</b> by the following references to it.</small></h5>
{% for o in protected_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
{% if cascading_objects %}
<h5>{% trans 'Cascade' %} <small class="text-muted">The object you are trying to delete is used by the following objects which will <b>also be deleted</b>.</small></h5>
{% for o in cascading_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
{% if set_null_objects %}
<h5>{% trans 'Remove' %} <small class="text-muted">The object you are trying to delete is used by the following objects from which the reference will be removed.</small></h5>
{% for o in set_null_objects %}
{% class_name o.model as name %}
<u>{{ name }}</u>
<ul>
{% for e in o %}
<li>
<span class="badge badge-info">#{{ e.id }}</span> {{ e }}
</li>
{% endfor %}
</ul>
{% endfor %}
{% endif %}
<button class="btn btn-success" type="submit" href="{{ success_url }}" {% if protected_objects %}disabled{% endif %}><i
class="fas fa-trash-alt"></i> {% trans 'Confirm' %}</button>
<a href="javascript:history.back()" class="btn btn-danger"><i class="fas fa-undo-alt"></i> {% trans 'Cancel' %}
</a>
</form>
{% endblock %}

View File

@@ -1,40 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load custom_tags %}
{% block title %}{% trans 'Edit' %} - {{ title }}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h3>{% trans 'Edit' %} {{ title }}</h3>
{% if form.Meta.model|get_class_name == 'Storage' %}
{% include 'include/storage_backend_warning.html' %}
{% endif %}
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<button href="{{ view.get_success_url }}" class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
{% delete_url form.instance|get_class form.instance.pk as delete_view_url %}
{% if delete_view_url %}
{% if not object.numchild or object.numchild == 0 %}
<a href="{{ delete_view_url }}"
class="btn btn-danger"><i class="fas fa-trash-alt"></i> {% trans 'Delete' %}</a>
{% endif %}
{% endif %}
{% if view_url %}
<a href="{{ view_url }}" class="btn btn-info"><i class="far fa-eye"></i> {% trans 'View' %}</a>
{% endif %}
{% if delete_external_url %}
<a href="{{ delete_external_url }}" class="btn btn-warning"><i
class="fas fa-exclamation-triangle"></i> {% trans 'Delete original file' %}</a>
{% endif %}
</form>
{% endblock %}

View File

@@ -1,50 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
{% block title %}{% trans 'List' %}{% endblock %}
{% block content %}
{% if request.resolver_match.url_name in 'list_storage,list_recipe_import,list_sync_log' %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'data_sync' %}">{% trans 'External Recipes' %}</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ title }}</li>
</ol>
</nav>
{% endif %}
<div class="table-container">
<span class="col col-md-9">
<h3 style="margin-bottom: 2vh">{{ title }} {% trans 'List' %}
{% if create_url %}
<a href="{% url create_url %}"> <i class="fas fa-plus-circle"></i>
</a>
{% endif %}
</h3>
</span>
{% if filter %}
<br/>
<br/>
<form action="." method="get">
{% csrf_token %}
{{ filter.form|crispy }}
<button type="submit" class="btn btn-success">{% trans 'Filter' %}</button>
</form>
{% endif %}
{% if import_btn %}
<a href="{% url 'data_batch_import' %}" class="btn btn-warning">{% trans 'Import all' %}</a>
<br/>
<br/>
{% endif %}
{% render_table table %}
</div>
{% endblock content %}

View File

@@ -1,40 +0,0 @@
{% extends "base.html" %}
{% load l10n %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% comment %} {% load l10n %} {% endcomment %}
{% block title %}{{ title }}{% endblock %}
{% block content_fluid %}
<div id="app">
<model-list-view></model-list-view>
</div>
{% endblock %}
{% block script %}
{{ config | json_script:"model_config" }}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
{% if current_file_size_mb %}
window.CURRENT_FILE_SIZE_MB = {{ current_file_size_mb|unlocalize }}
window.MAX_FILE_SIZE_MB = {{ max_file_size_mb|unlocalize }}
{% endif %}
</script>
{% render_bundle 'model_list_view' %}
{% endblock %}

View File

@@ -1,37 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load custom_tags %}
{% block title %}{% trans 'New' %} - {{ title }}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h3>{% trans 'New' %} {{ title }} </h3>
{% if form.Meta.model|get_class_name == 'Storage' %}
{% include 'include/storage_backend_warning.html' %}
{% endif %}
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
</form>
{% if default_recipe %}
<script type="text/javascript">
$(document).ready(function () {
$('#id_recipe').val({{ default_recipe.pk }}).trigger('change');
});
</script>
{% endif %}
{% endblock %}

View File

@@ -1,109 +0,0 @@
{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
{% block content %}
<div class="table-container">
{% block table %}
<table {% render_attrs table.attrs class="table" %}>
{% block table.thead %}
{% if table.show_header %}
<thead {{ table.attrs.thead.as_html }}>
<tr>
{% for column in table.columns %}
<th {{ column.attrs.th.as_html }}>
{% if column.orderable %}
<a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a>
{% else %}
{{ column.header }}
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
{% endblock table.thead %}
{% block table.tbody %}
<tbody {{ table.attrs.tbody.as_html }}>
{% for row in table.paginated_rows %}
{% block table.tbody.row %}
<tr {{ row.attrs.as_html }}>
{% for column, cell in row.items %}
<td {{ column.attrs.td.as_html }}>
{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}
{{ cell|localize }}{% else %}{{ cell|unlocalize }}
{% endif %}{% endif %}</td>
{% endfor %}
</tr>
{% endblock table.tbody.row %}
{% empty %}
{% if table.empty_text %}
{% block table.tbody.empty_text %}
<tr>
<td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td>
</tr>
{% endblock table.tbody.empty_text %}
{% endif %}
{% endfor %}
</tbody>
{% endblock table.tbody %}
{% block table.tfoot %}
{% if table.has_footer %}
<tfoot {{ table.attrs.tfoot.as_html }}>
<tr>
{% for column in table.columns %}
<td {{ column.attrs.tf.as_html }}>{{ column.footer }}</td>
{% endfor %}
</tr>
</tfoot>
{% endif %}
{% endblock table.tfoot %}
</table>
{% endblock table %}
{% block pagination %}
{% if table.page and table.paginator.num_pages > 1 %}
<nav aria-label="Table navigation">
<ul class="pagination justify-content-center flex-wrap">
{% if table.page.has_previous %}
{% block pagination.previous %}
<li class="previous page-item">
<a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}"
class="page-link">
<span aria-hidden="true">&laquo;</span>
{% trans 'previous' %}
</a>
</li>
{% endblock pagination.previous %}
{% endif %}
{% if table.page.has_previous or table.page.has_next %}
{% block pagination.range %}
{% for p in table.page|table_page_range:table.paginator %}
<li class="page-item{% if table.page.number == p %} active{% endif %}">
<a class="page-link"
{% if p != '...' %}href="{% querystring table.prefixed_page_field=p %}"{% endif %}>
{{ p }}
</a>
</li>
{% endfor %}
{% endblock pagination.range %}
{% endif %}
{% if table.page.has_next %}
{% block pagination.next %}
<li class="next page-item">
<a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}"
class="page-link">
{% trans 'next' %}
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% endblock pagination.next %}
{% endif %}
</ul>
</nav>
{% endif %}
{% endblock pagination %}
</div>
{% endblock content %}

View File

@@ -1,37 +0,0 @@
{% extends "base.html" %}
{% load django_tables2 %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "History" %}{% endblock %}
{% block extra_head %}
{% endblock %}
{% block content %}
<h3>{% trans 'History' %}</h3>
<br/>
<ul class="nav nav-tabs" id="id_tab_nav" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#view_log" role="tab" aria-controls="view_log"
aria-selected="true">{% trans 'View Log' %}</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#cook_log" role="tab" aria-controls="cook_log"
aria-selected="false">{% trans 'Cook Log' %}</a>
</li>
</ul>
<div class="tab-content" id="id_tab_content">
<div class="tab-pane fade show active" id="view_log" role="tabpanel" aria-labelledby="view-log">
{% render_table view_log %}
</div>
<div class="tab-pane fade" id="cook_log" role="tabpanel" aria-labelledby="profile-tab">
{% render_table cook_log %}
</div>
</div>
{% endblock %}

View File

@@ -1,32 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Import' %}{% endblock %}
{% block content %}
<div id="app">
<import-response-view></import-response-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMPORT_ID = {{pk}};
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
</script>
{% render_bundle 'import_response_view' %}
{% endblock %}

View File

@@ -1,11 +0,0 @@
{% load i18n %}
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading"><i class="fas fa-exclamation-triangle"></i> {% trans 'Security Warning' %}</h4>
<p>{% blocktrans %}
The <b>Password and Token</b> field are stored as <b>plain text</b> inside the database.
This is necessary because they are needed to make API requests, but it also increases the risk of
someone stealing it. <br/>
To limit the possible damage tokens or accounts with limited access can be used.
{% endblocktrans %}</p>
</div>

View File

@@ -1,39 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Ingredient Editor' %}{% endblock %}
{% block content %}
<div class="row">
<div class="col col-md-12">
<h3>{% trans 'Ingredient Editor' %}</h3>
</div>
</div>
<div id="app">
<ingredient-editor-view></ingredient-editor-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.DEFAULT_FOOD = {{ food_id }}
window.DEFAULT_UNIT = {{ unit_id }}
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
</script>
{% render_bundle 'ingredient_editor_view' %}
{% endblock %}

View File

@@ -1,35 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Meal-Plan' %}{% endblock %}
{% block content_fluid %}
<div id="app">
<meal-plan-view></meal-plan-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.SHOPPING_URL = '{% url 'view_shopping' %}'
</script>
{% render_bundle 'meal_plan_view' %}
{% endblock %}

View File

@@ -1,31 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Property Editor' %}{% endblock %}
{% block content_fluid %}
<div id="app">
<property-editor-view></property-editor-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.RECIPE_ID = {{ recipe_id }}
</script>
{% render_bundle 'property_editor_view' %}
{% endblock %}

View File

@@ -1,92 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% load custom_tags %}
{% block title %}{{ recipe.name }}{% endblock %}
{% block extra_head %}
<meta property="og:title" content="{{ recipe.name }}"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="{% base_path request 'base' %}{% url 'view_recipe' recipe.pk share %}"/>
{% if recipe.image %}
<meta property="og:image" content="{% base_path request 'base' %}{{ recipe.image.url }}"/>
<meta property="og:image:url" content="{% base_path request 'base' %}{{ recipe.image.url }}"/>
<meta property="og:image:secure" content="{% base_path request 'base' %}{{ recipe.image.url }}"/>
{% endif %}
{% if recipe.description %}
<meta property="og:description" content="{{ recipe.description }}"/>
{% endif %}
<meta property="og:site_name" content="Tandoor Recipes"/>
{% endblock %}
{% block content %}
{% recipe_rating recipe request.user as rating %}
<div id="app">
<recipe-view recipe_id="5"></recipe-view>
</div>
{% if request.user.userpreference.comments %}
<br/>
<br/>
<h5 {% if not comments %}class="d-print-none" {% endif %}><i class="far fa-comments"></i> {% trans 'Comments' %}
</h5>
{% for c in comments %}
<div class="card">
<div class="card-body">
<small class="card-title">{{ c.updated_at }} {% trans 'by' %} {{ c.created_by.username }}</small> <a
href="{% url 'edit_comment' c.pk %}" class="d-print-none"><i
class="fas fa-pencil-alt"></i></a><br/>
{{ c.text | urlize |linebreaks }}
</div>
</div>
<br/>
{% endfor %}
{% if request.user.is_authenticated %}
<div class="d-print-none" style="padding-bottom: 60px">
<form method="POST" class="post-form">
{% csrf_token %}
<div class="input-group mb-3">
<textarea name="comment-text" cols="15" rows="2" class="textarea form-control" required
id="comment-id_text"></textarea>
<div class="input-group-append">
<input type="submit" value="{% trans 'Comment' %}" class="btn btn-success">
</div>
</div>
</form>
</div>
{% endif %}
{% endif %}
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.RECIPE_ID = {{recipe.pk}};
window.RECIPE_SERVINGS = '{{ servings }}'
window.SHARE_UID = '{{ share }}';
window.USER_PREF = {
'use_fractions': {% if request.user.userpreference.use_fractions %} true {% else %} false {% endif %},
'ingredient_decimals': {% if request.user.userpreference.use_fractions %} {{ request.user.userpreference.ingredient_decimals }} {% else %} 2 {% endif %},
'use_kj': {% if request.user.userpreference.use_kj %} true {% else %} false {% endif %},
}
</script>
{% render_bundle 'recipe_view' %}
{% endblock %}

View File

@@ -1,33 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Search' %}{% endblock %}
{% block content_fluid %}
<div id="app" >
<recipe-search-view></recipe-search-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
</script>
{% render_bundle 'recipe_search_view' %}
{% endblock %}

View File

@@ -1,68 +0,0 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load static %}
{% block title %}{% trans 'Settings' %}{% endblock %}
{% block extra_head %}
{{ search_form.media }}
{% endblock %}
{% block content %}
<div class="tab-pane {% if active_tab == 'search' %} active {% endif %}" id="search" role="tabpanel"
aria-labelledby="search-tab">
<h4>{% trans 'Search Settings' %}</h4>
{% trans 'There are many options to configure the search depending on your personal preferences.' %}
{% trans 'Usually you do <b>not need</b> to configure any of them and can just stick with either the default or one of the following presets.' %}
{% trans 'If you do want to configure the search you can read about the different options <a href="/docs/search/">here</a>.' %}
<div class="card-deck mt-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">{% trans 'Fuzzy' %}</h5>
<p class="card-text">{% trans 'Find what you need even if your search or the recipe contains typos. Might return more results than needed to make sure you find what you are looking for.' %}</p>
<p class="card-text"><small class="text-muted">{% trans 'This is the default behavior' %}</small>
</p>
<button class="btn btn-primary card-link"
onclick="applyPreset('fuzzy')">{% trans 'Apply' %}</button>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">{% trans 'Precise' %}</h5>
<p class="card-text">{% trans 'Allows fine control over search results but might not return results if too many spelling mistakes are made.' %}</p>
<p class="card-text"><small class="text-muted">{% trans 'Perfect for large Databases' %}</small></p>
<button class="btn btn-primary card-link"
onclick="applyPreset('precise')">{% trans 'Apply' %}</button>
</div>
</div>
</div>
<hr/>
<form action="./#search" method="post" id="id_search_form">
{% csrf_token %}
{{ search_form|crispy }}
<button class="btn btn-success" type="submit" name="search_form" id="search_form_button"><i
class="fas fa-save"></i> {% trans 'Save' %}</button>
</form>
</div>
<script type="application/javascript">
$(function () {
$('#id_search-trigram_threshold').get(0).type = 'range';
});
function applyPreset(preset) {
$('#id_search-preset').val(preset);
$('#id_search-search').val('plain');
$('#search_form_button').click();
}
</script>
{% endblock %}

View File

@@ -1,27 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Cookbook Setup" %}{% endblock %}
{% block extra_head %}
{{ form.media }}
{% endblock %}
{% block content %}
<h1>{% trans 'Setup' %}</h1>
<p>{% blocktrans %}To start using this application you must first create a superuser account.{% endblocktrans %}</p>
<form action="." method="post">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Create Superuser account' %}</button>
</form>
<script>
$('#id_name').focus()
</script>
{% endblock %}

View File

@@ -1,31 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% block title %} {{ title }} {% endblock %}
{% block content_fluid %}
<div id="app">
<shopping-list-view></shopping-list-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.SHOPPING_MIN_AUTOSYNC_INTERVAL = {{ SHOPPING_MIN_AUTOSYNC_INTERVAL }}
</script>
{% render_bundle 'shopping_list_view' %}
{% endblock %}

View File

@@ -1,55 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Space Management' %}{% endblock %}
{% block content %}
<div class="row">
<div class="col col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'view_space_manage' request.space.pk %}">{% trans 'Space Settings' %}</a></li>
</ol>
</nav>
</div>
</div>
<div class="row">
<div class="col col-12">
<h3>
<span class="text-muted">{% trans 'Space:' %}</span> {{ request.space.name }}
<small>{% if HOSTED %} <a href="https://tandoor.dev/manage">{% trans 'Manage Subscription' %}</a>
{% endif %}</small>
</h3>
</div>
</div>
<div id="app">
<space-manage-view></space-manage-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.ACTIVE_SPACE_ID = {{ request.space.id }}
</script>
{% render_bundle 'space_manage_view' %}
{% endblock %}

View File

@@ -1,119 +0,0 @@
{% extends "base.html" %}
{% load crispy_forms_filters %}
{% load static %}
{% load i18n %}
{% block title %}{% trans "Overview" %}{% endblock %}
{% block content %}
<div style="text-align: center">
<h3 class="">{% trans 'Space' %}</h3>
<div class="row">
<div class="col col-md-12">
{% trans 'Recipes, foods, shopping lists and more are organized in spaces of one or more people.' %}
{% trans 'You can either be invited into an existing space or create your own one.' %}
</div>
</div>
{% if request.user.userspace_set.all|length > 0 %}
<div class="row mt-2">
<div class="col col-12">
<h5>{% trans 'Your Spaces' %}</h5>
</div>
</div>
<div class="row mt-2">
<div class="col col-12">
<div class="card-deck">
{% for us in request.user.userspace_set.all %}
<div class="card">
{% if us.space.image and us.space.image.is_image %}
<img style="height: 15vh; object-fit: cover" src="{{ us.space.image.file.url }}"
class="card-img-top" alt="Image">
{% else %}
<img style="height: 15vh; object-fit: cover" src="{% static 'assets/recipe_no_image.svg' %}"
class="card-img-top" alt="Image">
{% endif %}
<div class="card-body">
<h5 class="card-title"><a
href="{% url 'view_switch_space' us.space.id %}">{{ us.space.name }}</a>
</h5>
{# {% if us.active %}#}
{# <i class="far fa-dot-circle fa-fw"></i>#}
{# {% else %}#}
{# <i class="far fa-circle fa-fw"></i>#}
{# {% endif %}#}
<p class="card-text"><small
class="text-muted">{% trans 'Owner' %}: {{ us.space.created_by }}</small>
{% if us.space.created_by != us.user %}
<p class="card-text"><small
class="text-muted"><a
href="{% url 'delete_user_space' us.pk %}">{% trans 'Leave Space' %}</a></small>
{% endif %}
<!--TODO add direct link to management page -->
</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
<div class="row" style="margin-top: 2vh">
<div class="col col-md-12">
<div class="card-group">
<div class="card">
<div class="card-header">
{% trans 'Join Space' %}
</div>
<div class="card-body">
<h5 class="card-title">{% trans 'Join an existing space.' %}</h5>
<p class="card-text"
style="height: 64px">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p>
<form method="POST" action="{% url 'view_space_overview' %}">
{% csrf_token %}
{{ join_form | crispy }}
<input type="submit" class="btn btn-primary" value="{% trans 'Join Space' %}"/>
</form>
</div>
</div>
<div class="card">
<div class="card-header">
{% trans 'Create Space' %}
</div>
<div class="card-body">
<h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5>
<p class="card-text"
style="height: 64px">{% trans 'Start your own recipe space and invite other users to it.' %}</p>
<form method="POST" action="{% url 'view_space_overview' %}">
{% csrf_token %}
{{ create_form | crispy }}
<input type="submit" class="btn btn-primary" value="{% trans 'Create Space' %}"/>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,36 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% load custom_tags %}
{% block title %}{% trans 'URL Import' %}{% endblock %}
{% block content_fluid %}
<div id="app">
<import-view></import-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.API_TOKEN = '{{ api_token }}'
window.BOOKMARKLET_IMPORT_ID = {{ bookmarklet_import_id }}
</script>
{% render_bundle 'import_view' %}
{% endblock %}

View File

@@ -1,46 +0,0 @@
{% extends "base.html" %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% load custom_tags %}
{% block title %}{% trans 'Settings' %}{% endblock %}
{% block content %}
<div id="app">
<settings-view></settings-view>
</div>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
window.USER_ID = {{ request.user.pk }}
window.SHOPPING_MIN_AUTOSYNC_INTERVAL = {{ SHOPPING_MIN_AUTOSYNC_INTERVAL }}
<!--TODO build custom API endpoint for this -->
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
window.AVAILABLE_LANGUAGES = [
{% for language in languages %}
['{{ language.name_local }}', '{{ language.code }}'],
{% endfor %}
]
</script>
{% render_bundle 'settings_view' %}
{% endblock %}