diff --git a/app/assets/stylesheets/application/layout.sass b/app/assets/stylesheets/application/layout.sass index 0e14173e2d20b6a9e1a8a46d3fe31d86e4565c47..16af462e1104683757ccb592320adfcaa2c7799d 100644 --- a/app/assets/stylesheets/application/layout.sass +++ b/app/assets/stylesheets/application/layout.sass @@ -1,11 +1,3 @@ -.navbar - margin-bottom: 100px - .navbar-brand - img - max-width: 100px - -footer - margin-top: 100px .alert padding: .95rem @@ -13,12 +5,21 @@ footer color: #82322F .extranet + .navbar + margin-bottom: 100px + .navbar-brand + img + max-width: 100px header border-bottom: 1px solid border-top: 1px solid min-height: 160px h1, p padding-top: 3rem + footer + margin-top: 100px + .logo + width: 100px .breadcrumb font-size: 14px diff --git a/app/controllers/extranet/home_controller.rb b/app/controllers/extranet/home_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..6c097138065df7a0d5a018826bf23d7d86f05918 --- /dev/null +++ b/app/controllers/extranet/home_controller.rb @@ -0,0 +1,6 @@ +class Extranet::HomeController < Extranet::ApplicationController + def index + redirect_to admin_root_path unless current_extranet + @cohorts = current_university.education_cohorts.ordered.limit(2) + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb deleted file mode 100644 index 26e35e8c8978d80f3ef93d0797e1583d0853502e..0000000000000000000000000000000000000000 --- a/app/controllers/home_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class HomeController < ApplicationController - def index - redirect_to admin_root_path unless current_extranet - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index eb980caeec12a69438811ee5abecc3688d80e17e..caddfa3c68c1e0746ccab3d395c8dd7e56205918 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -11,4 +11,35 @@ module ApplicationHelper classes end + def social_website_to_url(string) + string = "https://#{string}" unless string.start_with?('http') + string.gsub('http://', 'https://') + end + + def social_website_to_s(string) + string.gsub('http://', '') + .gsub('https://', '') + end + + def social_linkedin_to_url(string) + string.gsub('http://', 'https://') + end + + def social_linkedin_to_s(string) + string.gsub('http://', 'https://') + .gsub('https://www.linkedin.com/in/', '') + end + + def social_twitter_to_url(string) + string = "https://twitter.com/#{string}" unless 'twitter.com'.in? string + string = "https://#{string}" unless string.start_with?('http') + string.gsub('http://', 'https://') + end + + def social_twitter_to_s(string) + string.gsub('http://', 'https://') + .gsub('twitter.com', 'https://twitter.com') + .gsub('https://www.twitter.com/', 'https://twitter.com/') + .gsub('https://twitter.com/', '') + end end diff --git a/app/views/extranet/application/_footer.html.erb b/app/views/extranet/application/_footer.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..309bb5e8b5f38c341ef30f3c17caec72efa0082b --- /dev/null +++ b/app/views/extranet/application/_footer.html.erb @@ -0,0 +1,27 @@ +<footer class="pt-5"> + <div class="container text-center"> + <div class="mb-5"> + <%= render 'logo' %> + </div> + <nav class="nav justify-content-center"> + <%= link_to t('terms_of_service'), + t('terms_of_service_url'), + class: 'nav-link', + target: '_blank', + rel: 'noreferrer' %> + <%= link_to t('privacy_policy'), + t('privacy_policy_url'), + class: 'nav-link', + target: '_blank', + rel: 'noreferrer' %> + <%= link_to t('cookies_policy'), + t('cookies_policy_url'), + class: 'nav-link', + target: '_blank', + rel: 'noreferrer' %> + <%= link_to t('cookies_consent_choice'), + '', + class: 'nav-link js-gdpr__cookie_consent__display_again' %> + </nav> + </div> +</footer> diff --git a/app/views/extranet/application/_logo.html.erb b/app/views/extranet/application/_logo.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..210b239329d5eae639d60c4a97cf3824e7549f65 --- /dev/null +++ b/app/views/extranet/application/_logo.html.erb @@ -0,0 +1,5 @@ +<% if current_context.logo.attached? %> + <%= image_tag current_context.logo, width: 200, alt: current_context.to_s, class: 'logo' %> +<% else %> + <%= current_context %> +<% end %> diff --git a/app/views/extranet/application/_nav.html.erb b/app/views/extranet/application/_nav.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..2263f5391bed540bafaa3eade05bbf71e31dc911 --- /dev/null +++ b/app/views/extranet/application/_nav.html.erb @@ -0,0 +1,8 @@ +<nav class="navbar navbar-light"> + <div class="container"> + <a class="navbar-brand" href="/"> + <%= render 'logo' %> + </a> + <%= render_navigation %> + </div> +</nav> diff --git a/app/views/extranet/home/index.html.erb b/app/views/extranet/home/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..d2c5b60451a61c62cf6f8a2e14feaaa97584e9cb --- /dev/null +++ b/app/views/extranet/home/index.html.erb @@ -0,0 +1,5 @@ +<% content_for :title, current_context %> + +<h2><%= Education::Cohort.model_name.human(count: 2) %></h2> +<p><%= link_to 'Voir toutes les promotions', education_cohorts_path %></p> +<%= render 'extranet/cohorts/list', cohorts: @cohorts %> diff --git a/app/views/extranet/layouts/application.html.erb b/app/views/extranet/layouts/application.html.erb index 1d50fec29506064e9324f1e8ab9b7dc9f317226e..74bf7b45c19e463fb5e223fc27223bc4536c7a61 100644 --- a/app/views/extranet/layouts/application.html.erb +++ b/app/views/extranet/layouts/application.html.erb @@ -11,12 +11,12 @@ <%= favicon_link_tag 'favicon.png' %> </head> <body class="extranet <%= body_classes %>"> - <%= render 'nav' %> + <%= render 'extranet/application/nav' %> <main class="container"> - <%= render_breadcrumbs builder: Appstack::BreadcrumbsOnRailsBuilder %> + <%= render_breadcrumbs builder: Appstack::BreadcrumbsOnRailsBuilder if breadcrumbs.any? %> <%= yield %> </main> - <%= render 'footer' %> + <%= render 'extranet/application/footer' %> <%= render 'gdpr/cookie_consent' %> <%= render 'bugsnag' %> </body> diff --git a/app/views/extranet/persons/show.html.erb b/app/views/extranet/persons/show.html.erb index fe745e11e75ad62333d129e973a5d73068df491f..9cedca1d9e3674e7d8de6f21188620fabfdf2f15 100644 --- a/app/views/extranet/persons/show.html.erb +++ b/app/views/extranet/persons/show.html.erb @@ -35,17 +35,25 @@ <% end %> <% if @person.url %> <dt><%= University::Person.human_attribute_name(:url) %></dt> - <dd><a href="<%= @person.url %>" target="_blank" rel="noreferrer"><%= @person.url %></a></dd> + <dd> + <a href="<%= social_website_to_url @person.url %>" target="_blank" rel="noreferrer"> + <%= social_website_to_s @person.url %> + </a> + </dd> <% end %> <% if @person.linkedin %> <dt><%= University::Person.human_attribute_name(:linkedin) %></dt> - <dd><a href="<%= @person.linkedin %>" target="_blank" rel="noreferrer"><%= @person.linkedin %></a></dd> + <dd> + <a href="<%= social_linkedin_to_url @person.linkedin %>" target="_blank" rel="noreferrer"> + <%= social_linkedin_to_s @person.linkedin %> + </a> + </dd> <% end %> <% if @person.twitter %> <dt><%= University::Person.human_attribute_name(:twitter) %></dt> <dd> - <a href="<%= @person.twitter %>" target="_blank" rel="noreferrer"> - <%= @person.twitter.gsub('https://twitter.com/', '') %> + <a href="<%= social_twitter_to_url @person.twitter %>" target="_blank" rel="noreferrer"> + <%= social_twitter_to_s @person.twitter %> </a> </dd> <% end %> diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb deleted file mode 100644 index 18a3f18dc2a5db7e90a76ac343be35d17a698676..0000000000000000000000000000000000000000 --- a/app/views/home/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -<% content_for :title, current_context %> diff --git a/config/routes.rb b/config/routes.rb index c6a0a9514d727e96014985a16e4bce7dc81dd2bb..5f10a141b009ccfa85992cf44ce2902944570d54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,10 +29,9 @@ Rails.application.routes.draw do root to: 'dashboard#index' end - draw 'extranet' - draw 'api' - get '/media/:signed_id/:filename_with_transformations' => 'media#show', as: :medium - root to: 'home#index' + draw 'api' + draw 'extranet' + # Root is in extranet end diff --git a/config/routes/extranet.rb b/config/routes/extranet.rb index 1fd34eb0fdf8a97c6a0d1bbd9883376f80251459..2afd7680ebcedda96ad114d75de3886ba2a5a66f 100644 --- a/config/routes/extranet.rb +++ b/config/routes/extranet.rb @@ -6,3 +6,4 @@ get 'persons' => 'extranet/persons#index', as: :university_persons get 'persons/:id' => 'extranet/persons#show', as: :university_person get 'years' => 'extranet/academic_years#index', as: :education_academic_years get 'years/:id' => 'extranet/academic_years#show', as: :education_academic_year +root to: 'extranet/home#index'