From cdd932c35fc48a978172587720eed9c2e2d9c175 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 11 Nov 2019 17:57:29 -0500 Subject: [PATCH] render descriptions --- assets/js/booru.js | 4 ++-- lib/philomena_web/controllers/image_controller.ex | 6 +++++- lib/philomena_web/templates/image/show.html.slime | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/js/booru.js b/assets/js/booru.js index 69359900..284ee457 100644 --- a/assets/js/booru.js +++ b/assets/js/booru.js @@ -43,9 +43,9 @@ function fetchAndPersistTags(tagIds) { for (let i = 0; i < tagIds.length; i += chunk) { const ids = tagIds.slice(i, i + chunk); - fetch(`${window.booru.apiEndpoint}tags/fetch_many.json?ids[]=${ids.join('&ids[]=')}`) + /*fetch(`${window.booru.apiEndpoint}tags/fetch_many.json?ids[]=${ids.join('&ids[]=')}`) .then(response => response.json()) - .then(data => data.tags.forEach(tag => persistTag(tag))); + .then(data => data.tags.forEach(tag => persistTag(tag)));*/ } } diff --git a/lib/philomena_web/controllers/image_controller.ex b/lib/philomena_web/controllers/image_controller.ex index 3246e6f0..32e7feeb 100644 --- a/lib/philomena_web/controllers/image_controller.ex +++ b/lib/philomena_web/controllers/image_controller.ex @@ -39,6 +39,10 @@ defmodule PhilomenaWeb.ImageController do comments = Enum.zip(comments, rendered) - render(conn, "show.html", image: conn.assigns.image, comments: comments) + description = + %{body: conn.assigns.image.description} + |> Renderer.render_one() + + render(conn, "show.html", image: conn.assigns.image, comments: comments, description: description) end end diff --git a/lib/philomena_web/templates/image/show.html.slime b/lib/philomena_web/templates/image/show.html.slime index 1197a1da..c4f10f8a 100644 --- a/lib/philomena_web/templates/image/show.html.slime +++ b/lib/philomena_web/templates/image/show.html.slime @@ -7,7 +7,7 @@ p | Description: .image-description__text - = @image.description + == @description .js-tagsauce id="image_tags_and_source_#{@image.id}" .tagsauce .block