diff --git a/app/javascript/components/RecipeShow.vue b/app/javascript/components/RecipeShow.vue
index 47547e0..fb7ef18 100644
--- a/app/javascript/components/RecipeShow.vue
+++ b/app/javascript/components/RecipeShow.vue
@@ -23,7 +23,10 @@
@@ -182,6 +185,26 @@
}
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;
+ }
}
},
diff --git a/app/javascript/lib/Api.js b/app/javascript/lib/Api.js
index bef827a..95e90e6 100644
--- a/app/javascript/lib/Api.js
+++ b/app/javascript/lib/Api.js
@@ -155,7 +155,7 @@ class Api {
total_time: recipe.total_time,
active_time: recipe.active_time,
step_text: recipe.step_text,
- tag_names: recipe.tag_names,
+ tag_names: recipe.tags,
recipe_ingredients_attributes: recipe.ingredients.map(i => {
if (i._destroy) {
return {
diff --git a/app/views/recipes/_recipe.json.jbuilder b/app/views/recipes/_recipe.json.jbuilder
index 317fa21..0db38e0 100644
--- a/app/views/recipes/_recipe.json.jbuilder
+++ b/app/views/recipes/_recipe.json.jbuilder
@@ -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)