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 %> -
+
<%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> + <%= form.text_field :name, class: 'form-control' %>
-
+
-
+
<%= form.label :description, style: "display: block" %> <%= form.rich_text_area :description %>
-
- -
- <%= form.label :theory_ids, "Select Theory" %>
- <% Theory.all.each do |theory| %> - <%= check_box_tag "assumption[theory_ids][]", theory.id, @assumption.theories.include?(theory), id: "theory_#{theory.id}" %> - <%= label_tag "theory_#{theory.id}", theory.name, for: "theory_#{theory.id}" %>
- <% end %> -
- -
+
+ +
+ <%= form.label :theory_ids, "Select Theory" %> + <% Theory.all.each do |theory| %> +
+ <%= check_box_tag "assumption[theory_ids][]", theory.id, @assumption.theories.include?(theory), + id: "theory_#{theory.id}", class: 'form-check-input' %> + <%= label_tag "theory_#{theory.id}", theory.name, for: "theory_#{theory.id}", class: 'form-check-label' %> +
+ <% end %> +
-
- <%= form.label :practice_ids, "Select Practice" %>
- <% Practice.all.each do |practice| %> - <%= check_box_tag "assumption[practice_ids][]", practice.id, @assumption.practices.include?(practice), id: "practice_#{practice.id}" %> - <%= label_tag "practice_#{practice.id}", practice.name, for: "practice_#{practice.id}" %>
- <% end %> -
+
+ +
+ <%= form.label :practice_ids, "Select Practice" %> + <% Practice.all.each do |practice| %> +
+ <%= check_box_tag "assumption[practice_ids][]", practice.id, @assumption.practices.include?(practice), + id: "practice_#{practice.id}", class: 'form-check-input' %> + <%= label_tag "practice_#{practice.id}", practice.name, for: "practice_#{practice.id}", class: 'form-check-label' %> +
+ <% end %> +
-
+
<%= form.submit %> diff --git a/app/app/views/practices/_form.html.erb b/app/app/views/practices/_form.html.erb index aae548c4..c0eaf7fb 100644 --- a/app/app/views/practices/_form.html.erb +++ b/app/app/views/practices/_form.html.erb @@ -13,15 +13,23 @@ <% end %>
- <%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> +
+ <%= form.label :name, style: "display: block" %> + <%= form.text_field :name, class: 'form-control' %> +
+
+
<%= form.label :description, style: "display: block" %> <%= form.rich_text_area :description %>
+
+ +
+
<%= form.submit %>
diff --git a/app/app/views/practices/_practice.html.erb b/app/app/views/practices/_practice.html.erb index 766abd3a..00d8956a 100644 --- a/app/app/views/practices/_practice.html.erb +++ b/app/app/views/practices/_practice.html.erb @@ -5,7 +5,13 @@

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 @@
<% end %> -
+
<%= form.label :name, style: "display: block" %> - <%= form.text_field :name %> + <%= form.text_field :name, class: 'form-control' %>

-
+
<%= form.label :description, style: "display: block" %> <%= form.rich_text_area :description %>

-
+
<%= form.label :assumption_ids, "Select Assumptions" %>
<% Assumption.all.each do |assumption| %> - <%= check_box_tag "theory[assumption_ids][]", assumption.id, @theory.assumptions.include?(assumption), id: "assumption_#{assumption.id}" %> - <%= label_tag "assumption_#{assumption.id}", assumption.name, for: "assumption_#{assumption.id}" %>
+
+ <%= check_box_tag "theory[assumption_ids][]", assumption.id, @theory.assumptions.include?(assumption), + id: "assumption_#{assumption.id}", class: 'form-check-input' %> + <%= label_tag "assumption_#{assumption.id}", assumption.name, for: "assumption_#{assumption.id}", class: 'form-check-label' %> +
<% end %>
diff --git a/app/app/views/theories/_theory.html.erb b/app/app/views/theories/_theory.html.erb index 11032ada..debad646 100644 --- a/app/app/views/theories/_theory.html.erb +++ b/app/app/views/theories/_theory.html.erb @@ -5,8 +5,13 @@

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