mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
Merge branch 'develop' into feature/meal-planning
This commit is contained in:
@@ -21,13 +21,17 @@
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<button class="btn btn-success" type="submit"><i class="fas fa-save"></i> {% trans 'Save' %}</button>
|
||||
<a href="{% delete_url form.instance|get_class form.instance.pk %}"
|
||||
class="btn btn-danger"><i class="fas fa-trash-alt"></i> {% trans 'Delete' %}</a>
|
||||
{% delete_url form.instance|get_class form.instance.pk as delete_view_url %}
|
||||
{% if delete_view_url %}
|
||||
<a href="{{ delete_view_url }}"
|
||||
class="btn btn-danger"><i class="fas fa-trash-alt"></i> {% trans 'Delete' %}</a>
|
||||
{% 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>
|
||||
<a href="{{ delete_external_url }}" class="btn btn-warning"><i
|
||||
class="fas fa-exclamation-triangle"></i> {% trans 'Delete original file' %}</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
|
||||
@@ -20,14 +20,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* prevent weired character stuff escaping the pdf box */
|
||||
.textLayer > span {
|
||||
color: transparent;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
transform-origin: 0% 0%;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
@@ -214,7 +206,6 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
{% if recipe.storage %}
|
||||
<div class="row">
|
||||
{% if recipe.internal %}
|
||||
@@ -224,19 +215,23 @@
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
<div class="col col-12" style="margin-top: 2vh">
|
||||
<div class="loader" id="id_loader"></div>
|
||||
{% if '.pdf' in recipe.file_path %}
|
||||
<div class="col col-12">
|
||||
<iframe src="{% static 'pdfjs/viewer.html' %}?file={% url 'api_get_recipe_file' recipe.id %}"
|
||||
width="100%"
|
||||
height="700px"
|
||||
style="border: none;"></iframe>
|
||||
|
||||
<div id="viewerContainer" class="border">
|
||||
<div id="viewer" class="pdfViewer"></div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning" role="alert" id="id_warning_no_preview" style="display: none">
|
||||
{% trans 'Cloud not show a file preview. Maybe its not a PDF ?' %}
|
||||
{% endif %}
|
||||
{% if '.jpg' in recipe.file_path or '.png' in recipe.file_path or '.jpeg' in recipe.file_path %}
|
||||
<div class="col-md-12" style="text-align: center">
|
||||
<img class="img img-fluid" src="{% url 'api_get_recipe_file' recipe.id %}"
|
||||
alt="{% trans 'External recipe image' %}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col col-12" style="margin-top: 2vh">
|
||||
<div class="col col-12" style="margin-top: 1vh">
|
||||
<div class="card border-info">
|
||||
<div class="card-body text-info">
|
||||
<h5 class="card-title">{% trans 'External recipe' %}</h5>
|
||||
@@ -261,50 +256,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'js/pdf.min.js' %}"></script>
|
||||
|
||||
<script src="{% static 'js/pdf_viewer.js' %}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var url = "{% url 'api_get_recipe_file' recipe_id=12345 %}".replace(/12345/, {{ recipe.id }});
|
||||
$('#viewerContainer').hide();
|
||||
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
var base64Pdf = atob(this.responseText);
|
||||
$('#id_loader').hide();
|
||||
$('#viewerContainer').show();
|
||||
|
||||
var container = document.getElementById("viewerContainer");
|
||||
|
||||
var pdfViewer = new pdfjsViewer.PDFViewer({
|
||||
container: container,
|
||||
});
|
||||
|
||||
document.addEventListener("pagesinit", function () {
|
||||
// We can use pdfViewer now, e.g. let's change default scale.
|
||||
pdfViewer.currentScaleValue = "page-width";
|
||||
|
||||
});
|
||||
|
||||
var loadingTask = pdfjsLib.getDocument({
|
||||
data: base64Pdf
|
||||
});
|
||||
|
||||
loadingTask.promise.then(function (pdfDocument) {
|
||||
// Document loaded, specifying document for the viewer and
|
||||
// the (optional) linkService.
|
||||
pdfViewer.setDocument(pdfDocument);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
xhttp.open("GET", url, true);
|
||||
xhttp.send();
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -13,10 +13,16 @@
|
||||
<h1>{% trans 'System Information' %}</h1>
|
||||
|
||||
{% blocktrans %}
|
||||
Django Recipes is an open source free software application. It can be found on <a href="https://github.com/vabene1111/recipes">GitHub</a>.
|
||||
Django Recipes is an open source free software application. It can be found on
|
||||
<a href="https://github.com/vabene1111/recipes">GitHub</a>.
|
||||
Changelogs can be found <a href="https://github.com/vabene1111/recipes/releases">here</a>.
|
||||
{% endblocktrans %}
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
Current Version: {% if version and version != '' %}
|
||||
<a href="https://github.com/vabene1111/recipes/releases/tag/{{ version }}">{{ version }}</a>{% else %}
|
||||
{{ version }}{% endif %}<br/>
|
||||
Ref: <a href="https://github.com/vabene1111/recipes/commit/{{ ref }}">{{ ref }}</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Reference in New Issue
Block a user