From 13253a223cc1915295a578a8fe1078de305006f9 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Fri, 19 Nov 2021 11:24:40 +0100
Subject: [PATCH] wip export site

---
 app/helpers/admin/application_helper.rb               | 5 +++--
 app/services/github.rb                                | 2 +-
 app/views/admin/communication/websites/index.html.erb | 2 +-
 config/locales/communication/en.yml                   | 1 +
 config/locales/communication/fr.yml                   | 1 +
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb
index 461fadf88..9a6d98c6d 100644
--- a/app/helpers/admin/application_helper.rb
+++ b/app/helpers/admin/application_helper.rb
@@ -62,9 +62,10 @@ module Admin::ApplicationHelper
 
   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 br),
-                    attributes: %w(href alt title target rel src srcset width height)
+                    tags: %w(table figure figcaption strong em b i u p code pre tt samp kbd var sub sup dfn cite big small address hr br span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr acronym a img blockquote del ins),
+                    attributes: %w(rel  href src srcset width height alt cite datetime title class name xml:lang abbr style target)
     text.gsub! "\r", ''
     text.gsub! "\n", ' '
     text.gsub! "/rails/active_storage", "#{university.url}/rails/active_storage"
diff --git a/app/services/github.rb b/app/services/github.rb
index e47b9b4ec..c9729ee03 100644
--- a/app/services/github.rb
+++ b/app/services/github.rb
@@ -31,7 +31,7 @@ class Github
                             file: local_path,
                             sha: file_sha(path)
     true
-  rescue
+  rescue => e
     false
   end
 
diff --git a/app/views/admin/communication/websites/index.html.erb b/app/views/admin/communication/websites/index.html.erb
index bd4d631c6..5d2e263f6 100644
--- a/app/views/admin/communication/websites/index.html.erb
+++ b/app/views/admin/communication/websites/index.html.erb
@@ -16,7 +16,7 @@
       <td><%= link_to website, [:admin, website] %></td>
       <td><%= link_to website.domain_url, website.domain_url, target: :_blank %></td>
       <td><%= I18n.t("activerecord.attributes.communication/website.about_#{website.about_type}") %></td>
-      <td><%= website.about %></td>
+      <td><%= link_to website.about, [:admin, website.about] %></td>
       <td class="text-end">
         <div class="btn-group" role="group">
           <%= edit_link website %>
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index 3e9878905..7111456f7 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -51,6 +51,7 @@ en:
         all: All posts
     attributes:
       communication/website:
+        about: About
         about_: Independent website (no specific subject)
         about_Education::School: School website
         about_Research::Journal: Journal website
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index e65bb1027..1028e4588 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -51,6 +51,7 @@ fr:
         all: Toutes les actualités
     attributes:
       communication/website:
+        about: Sujet du site
         about_: Site indépendant (aucun sujet)
         about_Education::School: Site d'école
         about_Research::Journal: Site de revue scientifique
-- 
GitLab