Skip to content
Snippets Groups Projects
Unverified Commit e698d5d1 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

try to fix

parent d3a685ad
No related branches found
No related tags found
No related merge requests found
......@@ -60,13 +60,14 @@ module Admin::ApplicationHelper
form: form.options.dig(:html, :id)
end
def prepare_for_github(html)
def prepare_for_github(html, university)
text = html.to_s
text = sanitize text,
tags: %w(table a figure img figcaption i em b strong p h2 h3 h4 h5 h6 blockquote),
attributes: %w(href alt title target rel src srcset width height)
text.gsub! "\r", ''
text.gsub! "\n", ' '
text.gsub! "/rails/active_storage", "#{university.url}/rails/active_storage"
sanitize text
end
......
<figure class="attachment attachment--<%= blob.variable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
<% if blob.image? %>
<%= kamifusen_tag blob, width: 800, active_storage_direct_url: true %>
<%= kamifusen_tag blob, width: 800 %>
<% elsif blob.video? %>
<video>
<source src="<%= rails_blob_path(blob) %>" type="<%= blob.content_type %>">
</video>
<% else %>
<%= link_to polymorphic_url(blob), target: :blank do %>
<%= link_to polymorphic_path(blob), target: :blank do %>
<p>
<span class="attachment__name"><%= blob.filename %></span>
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
......
......@@ -5,6 +5,6 @@ first_name: "<%= @author.first_name %>"
last_name: "<%= @author.last_name %>"
slug: "<%= @author.slug %>"
biography: >
<%= prepare_for_github @author.biography %>
<%= prepare_for_github @author.biography, @author.university %>
---
<%= @author.github_frontmatter.content.html_safe %>
......@@ -4,6 +4,6 @@ slug: "<%= @category.slug %>"
identifier: "<%= @category.id %>"
parent: "<%= @category.parent_id %>"
description: >
<%= prepare_for_github @category.description %>
<%= prepare_for_github @category.description, @category.university %>
---
<%= @category.github_frontmatter.content.html_safe %>
......@@ -7,8 +7,8 @@ parent: "<%= @page.parent_id %>"
image: "<%= @page.featured_image.blob.id %>"
<% end %>
description: >
<%= prepare_for_github @page.description %>
<%= prepare_for_github @page.description, @page.university %>
text: >
<%= prepare_for_github @page.text %>
<%= prepare_for_github @page.text, @page.university %>
---
<%= @page.github_frontmatter.content.html_safe %>
......@@ -13,8 +13,8 @@ categories:
image: "<%= @post.featured_image.blob.id %>"
<% end %>
description: >
<%= prepare_for_github @post.description %>
<%= prepare_for_github @post.description, @post.university %>
text: >
<%= prepare_for_github @post.text %>
<%= prepare_for_github @post.text, @post.university %>
---
<%= @post.github_frontmatter.content.html_safe %>
......@@ -3,5 +3,5 @@ title: "<%= "#{ @researcher }"%>"
first_name: "<%= @researcher.first_name %>"
last_name: "<%= @researcher.last_name %>"
biography: >
<%= prepare_for_github @researcher.biography %>
<%= prepare_for_github @researcher.biography, @researcher.university %>
---
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment