diff --git a/app/Gemfile b/app/Gemfile index 914793af..f999f9b8 100644 --- a/app/Gemfile +++ b/app/Gemfile @@ -87,3 +87,4 @@ gem 'omniauth-rails_csrf_protection', '~> 1.0' # prevents forged authentication # webpack gem 'pg' gem 'webpacker' +gem 'nokogiri' diff --git a/app/Gemfile.lock b/app/Gemfile.lock index 55de13c0..c6599cda 100644 --- a/app/Gemfile.lock +++ b/app/Gemfile.lock @@ -434,6 +434,7 @@ DEPENDENCIES image_processing (~> 1.2) importmap-rails jbuilder + nokogiri omniauth-auth0 (~> 3.0) omniauth-rails_csrf_protection (~> 1.0) pg diff --git a/app/app/views/assumptions/_assumption.html.erb b/app/app/views/assumptions/_assumption.html.erb index 80f553da..a43e16d3 100644 --- a/app/app/views/assumptions/_assumption.html.erb +++ b/app/app/views/assumptions/_assumption.html.erb @@ -6,7 +6,12 @@
Description: - <%= assumption.description %> + <% doc = Nokogiri::HTML.fragment(assumption.description.to_s) %> + <% doc.css('a').each do |link| %> + <% link.set_attribute('target', '_blank') %> + <% link.set_attribute('rel', 'noopener noreferrer') %> + <% end %> + <%= doc.to_html.html_safe %> <%= "No description provided" if assumption.description.empty? %>
diff --git a/app/app/views/assumptions/_form.html.erb b/app/app/views/assumptions/_form.html.erb index daba35bb..29177c45 100644 --- a/app/app/views/assumptions/_form.html.erb +++ b/app/app/views/assumptions/_form.html.erb @@ -12,39 +12,45 @@ <% end %> -Description: - <%= practice.description %> + <% doc = Nokogiri::HTML.fragment(practice.description.to_s) %> + <% doc.css('a').each do |link| %> + <% link.set_attribute('target', '_blank') %> + <% link.set_attribute('rel', 'noopener noreferrer') %> + <% end %> + <%= doc.to_html.html_safe %> + <%= "No description provided" if practice.description.empty? %>
diff --git a/app/app/views/theories/_form.html.erb b/app/app/views/theories/_form.html.erb index 68055872..4c9162d2 100644 --- a/app/app/views/theories/_form.html.erb +++ b/app/app/views/theories/_form.html.erb @@ -12,25 +12,28 @@Description: - <%= theory.description %> - <%= "No description provided" if theory.description.empty? %> + <% doc = Nokogiri::HTML.fragment(theory.description.to_s) %> + <% doc.css('a').each do |link| %> + <% link.set_attribute('target', '_blank') %> + <% link.set_attribute('rel', 'noopener noreferrer') %> + <% end %> + <%= doc.to_html.html_safe %> + <%= "No description provided" if theory.description.empty? %>
<% theory.assumptions.each do |assump| %> diff --git a/app/db/development.sqlite3 b/app/db/development.sqlite3 index 8dbad1e7..34f5dc29 100644 Binary files a/app/db/development.sqlite3 and b/app/db/development.sqlite3 differ