Fixed source and tag editing
This commit is contained in:
parent
7071a7203b
commit
bc681481ab
@ -23,7 +23,10 @@
|
|||||||
<div class="level-item has-text-centered">
|
<div class="level-item has-text-centered">
|
||||||
<div>
|
<div>
|
||||||
<p class="heading">Source</p>
|
<p class="heading">Source</p>
|
||||||
<p class="title is-6">{{recipe.source}}</p>
|
<p class="title is-6">
|
||||||
|
<a v-if="isSourceUrl" :href="sourceUrl">{{sourceText}}</a>
|
||||||
|
<span v-else>{{sourceText}}</span>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -182,6 +185,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return t + a;
|
return t + a;
|
||||||
|
},
|
||||||
|
|
||||||
|
sourceUrl() {
|
||||||
|
try {
|
||||||
|
return new URL(this.recipe.source);
|
||||||
|
} catch(err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
isSourceUrl() {
|
||||||
|
return this.sourceUrl !== null;
|
||||||
|
},
|
||||||
|
|
||||||
|
sourceText() {
|
||||||
|
if (this.isSourceUrl) {
|
||||||
|
return this.sourceUrl.host;
|
||||||
|
} else {
|
||||||
|
return this.source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class Api {
|
|||||||
total_time: recipe.total_time,
|
total_time: recipe.total_time,
|
||||||
active_time: recipe.active_time,
|
active_time: recipe.active_time,
|
||||||
step_text: recipe.step_text,
|
step_text: recipe.step_text,
|
||||||
tag_names: recipe.tag_names,
|
tag_names: recipe.tags,
|
||||||
recipe_ingredients_attributes: recipe.ingredients.map(i => {
|
recipe_ingredients_attributes: recipe.ingredients.map(i => {
|
||||||
if (i._destroy) {
|
if (i._destroy) {
|
||||||
return {
|
return {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
json.extract! recipe, :id, :name, :rating, :yields, :total_time, :active_time, :created_at, :updated_at, :step_text, :converted_scale, :converted_system, :converted_unit
|
json.extract! recipe, :id, :name, :rating, :yields, :total_time, :active_time, :source, :created_at, :updated_at, :step_text, :converted_scale, :converted_system, :converted_unit
|
||||||
|
|
||||||
json.rendered_steps MarkdownProcessor.render(recipe.step_text)
|
json.rendered_steps MarkdownProcessor.render(recipe.step_text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user