mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 21:37:49 -05:00
manually parse json
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!--I PROBLABLY DON'T NEED THIS??-->
|
||||
{% extends "base.html" %}
|
||||
{% load crispy_forms_filters %}
|
||||
{% load i18n %}
|
||||
@@ -24,7 +25,7 @@
|
||||
<div v-if="!parsed">
|
||||
<h2>{% trans 'Import From Source' %}</h2>
|
||||
<div class="input-group input-group-lg">
|
||||
<textarea class="form-control" v-model="raw_recipe" rows="12" style="font-size: 12px"></textarea>
|
||||
<textarea class="form-control" v-model="html_recipe" rows="12" style="font-size: 12px"></textarea>
|
||||
</div>
|
||||
<small class="text-muted">Simply paste a web page source or JSON document into this textarea and click import.</small>
|
||||
<br>
|
||||
@@ -51,18 +52,17 @@
|
||||
|
||||
<template scope="_">
|
||||
<div class="container-fluid" >
|
||||
<div class="col" @click.ctrl="customItemClickWithCtrl">
|
||||
<div class="row clearfix" style="width:50%" >
|
||||
<div class="col-md-12" >
|
||||
<div class="row clearfix" style="width:95%" >
|
||||
<div class="col">
|
||||
<i :class="_.vm.themeIconClasses" role="presentation" v-if="!_.model.loading"></i>
|
||||
{% verbatim %}
|
||||
[[_.model.name]]
|
||||
{% endverbatim %}
|
||||
</div>
|
||||
<div class="col-es" style="align-right">
|
||||
<div class="col-es-auto" style="align-right">
|
||||
<button style="border: 0px; background-color: transparent; cursor: pointer;"
|
||||
@click="deleteNode(_.vm, _.model, $event)"><i class="fas fa-minus-square" style="color:red"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,7 +93,7 @@
|
||||
delimiters: ['[[', ']]'],
|
||||
el: '#app',
|
||||
data: {
|
||||
raw_recipe: '',
|
||||
html_recipe: '',
|
||||
keywords: [],
|
||||
keywords_loading: false,
|
||||
units: [],
|
||||
@@ -137,7 +137,7 @@
|
||||
this.error = undefined
|
||||
this.parsed = true
|
||||
this.loading = true
|
||||
this.$http.post("{% url 'api_recipe_from_raw' %}", {'raw_text': this.raw_recipe}, {emulateJSON: true}).then((response) => {
|
||||
this.$http.post("{% url 'api_recipe_from_html' %}", {'html_text': this.html_recipe}, {emulateJSON: true}).then((response) => {
|
||||
console.log(response.data)
|
||||
this.recipe_data = response.data['recipe_data'];
|
||||
this.recipe_tree = response.data['recipe_tree'];
|
||||
@@ -278,7 +278,7 @@
|
||||
e.stopPropagation()
|
||||
var index = node.parentItem.indexOf(item)
|
||||
node.parentItem.splice(index, 1)
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user