diff --git a/app/assets/stylesheets/admin/links.sass b/app/assets/stylesheets/admin/links.sass new file mode 100644 index 0000000000000000000000000000000000000000..a17993199ed41a8f4065e03903843cb41660fe04 --- /dev/null +++ b/app/assets/stylesheets/admin/links.sass @@ -0,0 +1,12 @@ +a + &[target="_blank"] + &::after + content: "" + width: 0.8rem + height: 0.8rem + margin: 0 0.05rem 0 0.1rem + background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ij48cGF0aCBkPSJNOSAyTDkgMyAxMi4zIDMgNiA5LjMgNi43IDEwIDEzIDMuNyAxMyA3IDE0IDcgMTQgMlpNNCA0QzIuOSA0IDIgNC45IDIgNkwyIDEyQzIgMTMuMSAyLjkgMTQgNCAxNEwxMCAxNEMxMS4xIDE0IDEyIDEzLjEgMTIgMTJMMTIgNyAxMSA4IDExIDEyQzExIDEyLjYgMTAuNiAxMyAxMCAxM0w0IDEzQzMuNCAxMyAzIDEyLjYgMyAxMkwzIDZDMyA1LjQgMy40IDUgNCA1TDggNSA5IDRaIi8+PC9zdmc+) no-repeat + background-size: contain + display: inline-block + vertical-align: -1px + filter: invert(.5) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5de4f5fd2a890cf4aeaf91ae734877cdce2de180..e91846c9bf7ed7317a2a3961b2a07665bb4c04b0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,3 @@ class ApplicationController < ActionController::Base - include WithUniversity + include WithContext end diff --git a/app/controllers/application_controller/with_university.rb b/app/controllers/application_controller/with_context.rb similarity index 51% rename from app/controllers/application_controller/with_university.rb rename to app/controllers/application_controller/with_context.rb index e8a48d38fccb327e47da7091eb3f75637ffd8f0f..160385d904f0ca544627ae3fa96b769df2e83576 100644 --- a/app/controllers/application_controller/with_university.rb +++ b/app/controllers/application_controller/with_context.rb @@ -1,4 +1,4 @@ -module ApplicationController::WithUniversity +module ApplicationController::WithContext extend ActiveSupport::Concern included do @@ -8,5 +8,10 @@ module ApplicationController::WithUniversity end helper_method :current_university + def current_website + @current_website ||= Features::Websites::Site.with_host(request.host) + end + helper_method :current_website + end end diff --git a/app/models/features/websites/site.rb b/app/models/features/websites/site.rb index dda275d71e94b3edb4637df0b6a62140fb8b2260..ff511170d91a8973b194a0cea3c1923729fd11c0 100644 --- a/app/models/features/websites/site.rb +++ b/app/models/features/websites/site.rb @@ -20,12 +20,27 @@ class Features::Websites::Site < ApplicationRecord belongs_to :university + def self.with_host(host) + find_by domain: extract_domain_from(host) + end + + # Website domain + # Production with domain www.iut.u-bordeaux-montaigne.fr + # Production without www.iut.u-bordeaux-montaigne.fr.websites.osuny.org + # Staging www.iut.u-bordeaux-montaigne.fr.websites.osuny.dev + # Dev www.iut.u-bordeaux-montaigne.fr.websites.osuny + def self.extract_domain_from(host) + host.remove('.websites.osuny.org') + .remove('.websites.osuny.dev') + .remove('.websites.osuny') + end + def domain_url case Rails.env when 'development' - "http://#{domain}.#{university.identifier}.osuny:3000" + "http://#{domain}.websites.osuny:3000" when 'staging' - "https://#{domain}.#{university.identifier}.osuny.dev" + "https://#{domain}.websites.osuny.dev" when 'production' "https://#{domain}" end diff --git a/app/models/university/with_features.rb b/app/models/university/with_features.rb index e42e78f442658803198e9783f14d99b5c96a029d..ebbd99ef40d1ebcf7d414a74574163b063e4508c 100644 --- a/app/models/university/with_features.rb +++ b/app/models/university/with_features.rb @@ -2,8 +2,10 @@ module University::WithFeatures extend ActiveSupport::Concern included do - has_many :features_websites_sites, class_name: 'Features::Websites::Site', dependent: :destroy - + # Education has_many :features_education_programs, class_name: 'Features::Education::Program', dependent: :destroy + + # Websites + has_many :features_websites_sites, class_name: 'Features::Websites::Site', dependent: :destroy end end diff --git a/app/views/admin/features/websites/sites/index.html.erb b/app/views/admin/features/websites/sites/index.html.erb index 6982c94978b8d51eb896a5d084622977ad1067be..71b601807368535dca71aaf23a32185b69002630 100644 --- a/app/views/admin/features/websites/sites/index.html.erb +++ b/app/views/admin/features/websites/sites/index.html.erb @@ -12,7 +12,7 @@ <% @sites.each do |site| %> <tr> <td><%= link_to site, [:admin, site] %></td> - <td><%= site.domain %></td> + <td><%= link_to site.domain_url, site.domain_url, target: :_blank %></td> <td class="text-end"> <%= edit_link site %> <%= destroy_link site %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e12363aa2ec4fcd60334460d8f5707ccd89dbba3..e4f5be40e8f8b6b47101434ea38d652fe479da5f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -11,8 +11,11 @@ </head> <body> <nav> - <div class="container-fluid"> - <%= current_university %> + <div class="container-fluid text-center"> + <% if current_website %> + Site: <%= current_website %><br> + <% end %> + University: <%= current_university %> </div> </nav> <main class="container-fluid"> diff --git a/docs/benchmark.md b/docs/benchmark.md index 0c4dee01467f2d84f7d5f888ded5e5021a7fcc49..3f2a2a7bbf86f381199834235874cbfe2c552cb9 100644 --- a/docs/benchmark.md +++ b/docs/benchmark.md @@ -1,6 +1,12 @@ # Benchmark +## Excellent websites + - https://www.harvard.edu/ +- https://www.mit.edu/ + +## Other websites + - https://www.stanford.edu/ - https://www.brown.edu/ - https://www.columbia.edu/ @@ -8,7 +14,6 @@ - https://www.upenn.edu/ - https://www.princeton.edu/ - https://www.yale.edu/ -- https://www.mit.edu/ - https://www.ox.ac.uk/ - https://www.cam.ac.uk/ - https://www.caltech.edu/ diff --git a/docs/qualiopi/guide-lecture-referentiel-qualite.pdf b/docs/features/education/qualiopi/guide-lecture-referentiel-qualite.pdf similarity index 100% rename from docs/qualiopi/guide-lecture-referentiel-qualite.pdf rename to docs/features/education/qualiopi/guide-lecture-referentiel-qualite.pdf diff --git a/docs/qualiopi/qualiopi.md b/docs/features/education/qualiopi/qualiopi.md similarity index 100% rename from docs/qualiopi/qualiopi.md rename to docs/features/education/qualiopi/qualiopi.md diff --git a/docs/features/education/readme.md b/docs/features/education/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e9b95a08d24f80d54aedc309f3b4d089c846b070 --- /dev/null +++ b/docs/features/education/readme.md @@ -0,0 +1,60 @@ +# Education + +## education/Program + +Bachelor Universitaire de Technologie Métiers du Multimédia et de l'Internet + +- university:references +- name:string +- level:integer (enum) +- capacity:integer +- ects:integer +- continuing:boolean +- prerequisites:text +- objectives:text +- duration:text +- registration:text +- pedagogy:text +- evaluation:text +- accessibility:text ++ schools:habtm ++ campuses:habtm + +## education/Course + +30 heures d'histoire de l'art en année 1 + +- program:references +- year:references +- name:string +- syllabus:text +- hours:integer + +## education/Year + +- university:references +- program:references +- year:integer + +## education/Session + +- name:string +- university:references +- program:references +- from:date +- to:date + +## qualiopi/Criterion + +- number:integer +- name:text +- description:text + +## qualiopi/Indicator +- criterion:references +- number:integer +- name:text +- level_expected:text +- proof:text +- requirement:text +- non_conformity:text diff --git a/docs/features/websites/readme.md b/docs/features/websites/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..46e0080cda8e73c706db80124405b3dec542d93b --- /dev/null +++ b/docs/features/websites/readme.md @@ -0,0 +1,45 @@ +# Websites + +## websites/Site + +Attributes: +- university:references +- name:string +- domain:string + +## websites/Article + +Attributes: +- university:references +- title:string +- description:text +- data:json +- published_at:datetime + +## websites/Page + +Attributes: +- university:references +- title:string +- description:text +- data:json +- parent:references + +## websites/Document + +Est-ce vraiment dans ce namespace ? Peut-être un DAM ? + +1 document peut concerner : +- toute l'université (charte numérique) +- 1 école (règlement intérieur de l'école) +- 1 campus (règlement intérieur du campus) +- 1 formation (contrat d'alternance type) +- 1 session (calendrier pédagogique de l'année en cours) + +Attributes: +- university:references +- name:string +- school:references (optional) +- campus:references (optional) +- program:references (optional) +- session:references (optional) diff --git a/docs/models.md b/docs/models.md index f3933899b52d9118a2cc38878977e5c5f97ef3c2..9df28aff1c56747536c59644b03e5e7695cfab50 100644 --- a/docs/models.md +++ b/docs/models.md @@ -58,100 +58,3 @@ - user:references - program:references - -## Program - -Bachelor Universitaire de Technologie Métiers du Multimédia et de l'Internet - -- university:references -- name:string -- level:integer (enum) -- capacity:integer -- ects:integer -- continuing:boolean -- prerequisites:text -- objectives:text -- duration:text -- registration:text -- pedagogy:text -- evaluation:text -- accessibility:text -+ schools:habtm -+ campuses:habtm - -## program/Course - -30 heures d'histoire de l'art en année 1 - -- program:references -- year:references -- name:string -- syllabus:text -- hours:integer - -## program/Year - -- university:references -- program:references -- year:integer - -## program/Session - -- name:string -- university:references -- program:references -- from:date -- to:date - -## qualiopi/Criterion - -- number:integer -- name:text -- description:text - -## qualiopi/Indicator -- criterion:references -- number:integer -- name:text -- level_expected:text -- proof:text -- requirement:text -- non_conformity:text - -## Website - -- university:references -- name:string -- domain:string - -## website/Article - -- university:references -- title:string -- description:text -- data:json -- published_at:datetime - -## website/Page - -- university:references -- title:string -- description:text -- data:json -- parent:references - -## website/Document - -1 document peut concerner : -- toute l'université (charte numérique) -- 1 école (règlement intérieur de l'école) -- 1 campus (règlement intérieur du campus) -- 1 formation (contrat d'alternance type) -- 1 session (calendrier pédagogique de l'année en cours) - -- university:references -- name:string -- school:references (optional) -- campus:references (optional) -- program:references (optional) -- session:references (optional)