diff --git a/app/controllers/admin/education/schools_controller.rb b/app/controllers/admin/education/schools_controller.rb index 93593ffc8f4bde0b4071a911721c42150fcea930..ff0db0ab6328c4d383be180d81e0597b303846de 100644 --- a/app/controllers/admin/education/schools_controller.rb +++ b/app/controllers/admin/education/schools_controller.rb @@ -60,6 +60,6 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl def school_params params.require(:education_school) - .permit(:university_id, :name, :address, :zipcode, :city, :country, :phone, :logo, :logo_delete, program_ids: []) + .permit(:university_id, :name, :address, :zipcode, :city, :country, :url, :phone, :logo, :logo_delete, program_ids: []) end end diff --git a/app/models/education/school.rb b/app/models/education/school.rb index b98be91e95cdfe440cc1a17aac51e782080d4353..9fea2108abd250f362a2757e6b94811325ad0134 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -10,6 +10,7 @@ # longitude :float # name :string # phone :string +# url :string # zipcode :string # created_at :datetime not null # updated_at :datetime not null diff --git a/app/views/admin/education/schools/_form.html.erb b/app/views/admin/education/schools/_form.html.erb index 3ac9696e290e885e54eafb84452684f3e2a65e78..90e3d4368a990b38c7ee386b4350f9621bf4e836 100644 --- a/app/views/admin/education/schools/_form.html.erb +++ b/app/views/admin/education/schools/_form.html.erb @@ -17,6 +17,7 @@ </div> </div> <%= f.input :country, input_html: { class: 'form-select' } %> + <%= f.input :url %> <%= f.input :logo, as: :single_deletable_file, input_html: { accept: '.jpg,.jpeg,.png,.svg' }, diff --git a/app/views/admin/education/schools/show.html.erb b/app/views/admin/education/schools/show.html.erb index 0875e4b504c4e44c1ae7cee059fe0bbfcafc50cd..8fae9ac1ca65314010fbac5bde1050467c1b2ba5 100644 --- a/app/views/admin/education/schools/show.html.erb +++ b/app/views/admin/education/schools/show.html.erb @@ -10,8 +10,14 @@ <%= @school.zipcode %> <%= @school.city %><br> <%= @school.country %> </p> - <%= osuny_label Education::School.human_attribute_name('phone') %> - <p><%= @school.phone %></p> + <% if @school.phone.present? %> + <%= osuny_label Education::School.human_attribute_name('phone') %> + <p><%= @school.phone %></p> + <% end %> + <% if @school.url.present? %> + <%= osuny_label Education::School.human_attribute_name('url') %> + <p><%= link_to @school.url, @school.url, target: :_blank %></p> + <% end %> <% end %> </div> diff --git a/app/views/extranet/application/_footer.html.erb b/app/views/extranet/application/_footer.html.erb index 3768ffa80a5f15081802ba4a8e10d2b2ec77dbc8..90c6d199b9fba77c8d58b1e512e88671c735f37f 100644 --- a/app/views/extranet/application/_footer.html.erb +++ b/app/views/extranet/application/_footer.html.erb @@ -1,4 +1,7 @@ -<% hide_logo ||= false %> +<% +hide_logo ||= false +about = current_extranet.about +%> <footer class="pt-5"> <div class="container"> @@ -9,14 +12,17 @@ <% end %> <div class="row justify-space-between"> <div class="col-md-6"> - <% if current_extranet.about.is_a?(Education::School) %> + <% if about.is_a?(Education::School) %> <address itemscope itemtype="https://schema.org/CollegeOrUniversity"> - <span itemprop="name"><%= current_extranet.about.name %></span> + <span itemprop="name"><%= about.name %></span> <div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"> - <span itemprop="streetAddress"><%= current_extranet.about.address %></span><br> - <span itemprop="postalCode"><%= current_extranet.about.zipcode %></span> - <span itemprop="addressLocality"><%= current_extranet.about.city %></span><br> + <span itemprop="streetAddress"><%= about.address %></span><br> + <span itemprop="postalCode"><%= about.zipcode %></span> + <span itemprop="addressLocality"><%= about.city %></span><br> </div> + <% if about.url.present? %> + <a href="<%= social_website_to_url about.url %>" target="_blank" property="url"><%= social_website_to_s about.url %></a> + <% end %> </address> <% elsif current_extranet.about.is_a?(Education::Program) %> <div itemscope itemtype="https://schema.org/EducationalOccupationalCredential"> diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 16fd9aa73dc2bb0aca1e80c495d559bb7b42156e..dfd4c369afe61c0ab0183e43a73ca2592fec2af5 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -79,6 +79,7 @@ en: phone: Phone programs: Programs provided roles: Team Members + url: Website websites: Linked websites zipcode: Zipcode admin: diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index dcf3e47d01f945f5da95aaf87caa58aebe8cc7b8..73b87aa91267510676b1d9f11a5cd7a1ce285f4e 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -82,6 +82,7 @@ fr: phone: Téléphone programs: Formations dispensées roles: Membres de l'équipe + url: Site Web websites: Sites Web associés zipcode: Code postal university/person/teacher: diff --git a/db/migrate/20230320125138_add_url_to_education_school.rb b/db/migrate/20230320125138_add_url_to_education_school.rb new file mode 100644 index 0000000000000000000000000000000000000000..92ab554852357fbab3d7afbd4ec42bdd1ab9bc42 --- /dev/null +++ b/db/migrate/20230320125138_add_url_to_education_school.rb @@ -0,0 +1,5 @@ +class AddUrlToEducationSchool < ActiveRecord::Migration[7.0] + def change + add_column :education_schools, :url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 7786c69dc1b5be455e4686ef50e7ec5e3853e24f..61b664759abad49dedad4660b95e5a347b4d5248 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_03_17_160229) do +ActiveRecord::Schema[7.0].define(version: 2023_03_20_125138) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -643,6 +643,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_17_160229) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "phone" + t.string "url" t.index ["university_id"], name: "index_education_schools_on_university_id" end diff --git a/test/fixtures/education/schools.yml b/test/fixtures/education/schools.yml index e0f957684160759345546501322ce012c2156cb4..fce634f27a350704a40420834e959f0cf72af1e5 100644 --- a/test/fixtures/education/schools.yml +++ b/test/fixtures/education/schools.yml @@ -10,6 +10,7 @@ # longitude :float # name :string # phone :string +# url :string # zipcode :string # created_at :datetime not null # updated_at :datetime not null @@ -29,4 +30,4 @@ default_school: zipcode: 33080 city: Bordeaux country: FR - university: default_university \ No newline at end of file + university: default_university