diff --git a/app/controllers/extranet/home_controller.rb b/app/controllers/extranet/home_controller.rb index a3b04c782c2bbc5517ac9cef8e515a0d89ebfc0a..e81263f39c530aa130b3a78a68d5dfc897f233c0 100644 --- a/app/controllers/extranet/home_controller.rb +++ b/app/controllers/extranet/home_controller.rb @@ -2,5 +2,6 @@ class Extranet::HomeController < Extranet::ApplicationController def index @cohorts = about&.education_cohorts.ordered.limit(5) @experiences = about&.university_person_experiences.recent + @posts = current_extranet.posts.published.ordered.limit(3) if current_extranet.feature_posts end end diff --git a/app/views/extranet/home/features/_alumni.html.erb b/app/views/extranet/home/features/_alumni.html.erb index ad51815a96763dfea249f76ef846e87747267afb..6197ca669cb010510ff6791beeb6009c77317ef3 100644 --- a/app/views/extranet/home/features/_alumni.html.erb +++ b/app/views/extranet/home/features/_alumni.html.erb @@ -1,55 +1,57 @@ -<div class="row"> - <div class="col-md-8"> - <h2><%= t('extranet.home.recent_experiences') %></h2> - <div class="experiences"> - <ul> - <% @experiences.ordered.each do |experience| %> - <li> - <div> - <%= link_to [:alumni, experience.person], class: "stretched-link" do %> - <% if experience.person.best_picture.attached? %> - <%= kamifusen_tag experience.person.best_picture, width: 400, class: 'img-fluid', sizes: { - '(max-width: 576px)': '400px', - '(max-width: 991px)': '200px' - } %> - <% else %> - <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> - <% end %> - <% end %> - </div> - <div> +<section class="mt-5"> + <div class="row"> + <div class="col-md-8"> + <h2><%= t('extranet.home.recent_experiences') %></h2> + <div class="experiences"> + <ul> + <% @experiences.ordered.each do |experience| %> + <li> <div> - <p class="mb-md-0"> - <%= experience.person.first_name %> <%= experience.person.last_name %> - <br> - <%= experience.description %> - <%= '—' if experience.description.present? && experience.organization.present? %> - <%= experience.organization %> - </p> - <small><%= l experience.created_at.to_date, format: :long %></small> + <%= link_to [:alumni, experience.person], class: "stretched-link" do %> + <% if experience.person.best_picture.attached? %> + <%= kamifusen_tag experience.person.best_picture, width: 400, class: 'img-fluid', sizes: { + '(max-width: 576px)': '400px', + '(max-width: 991px)': '200px' + } %> + <% else %> + <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> + <% end %> + <% end %> </div> - <% if experience.organization.present? %> - <% if experience.organization.logo.attached? %> - <%= link_to [:alumni, experience.organization] do %> - <%= kamifusen_tag experience.organization.logo, height: 80, class: 'img-fluid' %> - <% end %> + <div> + <div> + <p class="mb-md-0"> + <%= experience.person.first_name %> <%= experience.person.last_name %> + <br> + <%= experience.description %> + <%= '—' if experience.description.present? && experience.organization.present? %> + <%= experience.organization %> + </p> + <small><%= l experience.created_at.to_date, format: :long %></small> + </div> + <% if experience.organization.present? %> + <% if experience.organization.logo.attached? %> + <%= link_to [:alumni, experience.organization] do %> + <%= kamifusen_tag experience.organization.logo, height: 80, class: 'img-fluid' %> + <% end %> + <% end %> <% end %> - <% end %> - </div> + </div> + </li> + <% end %> + </ul> + </div> + </div> + <div class="col-md-4 mt-5 mt-md-0"> + <h2><%= t('extranet.home.recent_cohorts') %></h2> + <ul class="promotions"> + <% @cohorts.each do |cohort| %> + <li> + <%= link_to cohort.program.to_short_s, [:alumni, cohort] %> + <b><%= cohort.academic_year %></b> </li> <% end %> </ul> </div> </div> - <div class="col-md-4 mt-5 mt-md-0"> - <h2><%= t('extranet.home.recent_cohorts') %></h2> - <ul class="promotions"> - <% @cohorts.each do |cohort| %> - <li> - <%= link_to cohort.program.to_short_s, [:alumni, cohort] %> - <b><%= cohort.academic_year %></b> - </li> - <% end %> - </ul> - </div> -</div> \ No newline at end of file +</section> \ No newline at end of file diff --git a/app/views/extranet/home/features/_contacts.html.erb b/app/views/extranet/home/features/_contacts.html.erb index 402b78372777332b8df34a54b7b20673535a734f..0af2811f98f789041c0d2fa07a655ae9c2e672d7 100644 --- a/app/views/extranet/home/features/_contacts.html.erb +++ b/app/views/extranet/home/features/_contacts.html.erb @@ -1,4 +1,4 @@ <section class="mt-5"> - <h2>Chercher dans l'annuaire</h2> + <h2><%= t 'extranet.contacts.search.home' %></h2> <%= render 'extranet/contacts/search/form' %> </section> \ No newline at end of file diff --git a/app/views/extranet/home/features/_posts.html.erb b/app/views/extranet/home/features/_posts.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..093bbf4afc464921ed180557466523ea0faf95ce --- /dev/null +++ b/app/views/extranet/home/features/_posts.html.erb @@ -0,0 +1,6 @@ +<% if @posts.any? %> + <section class="mt-5"> + <h2><%= t('extranet.posts.home') %></h2> + <%= render 'extranet/posts/posts/list', posts: @posts %> + </section> +<% end %> \ No newline at end of file diff --git a/app/views/extranet/home/index.html.erb b/app/views/extranet/home/index.html.erb index 21e858b99b44486dc91e40c3503f6786c1da5c4c..6cd5f804587ddcd34b4c52ad301c15842ca52472 100644 --- a/app/views/extranet/home/index.html.erb +++ b/app/views/extranet/home/index.html.erb @@ -9,6 +9,7 @@ </h1> <% end %> +<%= render 'extranet/home/features/posts' if current_extranet.feature_posts %> <%= render 'extranet/home/features/alumni' if current_extranet.feature_alumni %> <%= render 'extranet/home/features/contacts' if current_extranet.feature_contacts %> diff --git a/config/locales/extranet/en.yml b/config/locales/extranet/en.yml index c23f2e0be53f714322aa35ce5eace50eb3ee0743..9f388ea654561e1ea7b44078af9299c0bb54248a 100644 --- a/config/locales/extranet/en.yml +++ b/config/locales/extranet/en.yml @@ -9,6 +9,7 @@ en: logout: Log out contacts: search: + home: Search in directory title: Search placeholder: Type your search here submit: Search @@ -33,3 +34,5 @@ en: edit: Edit title: My personal data updated: Your personal data has been updated! + posts: + home: Recent posts \ No newline at end of file diff --git a/config/locales/extranet/fr.yml b/config/locales/extranet/fr.yml index df7df1ccac8415b63a0208bef52dca5285b87a35..5035bd6f9c468a710e0be0076e34ef101236ca09 100644 --- a/config/locales/extranet/fr.yml +++ b/config/locales/extranet/fr.yml @@ -9,6 +9,7 @@ fr: logout: Déconnexion contacts: search: + home: Chercher dans l'annuaire title: Recherche placeholder: Entrez votre recherche ici submit: Chercher @@ -33,3 +34,5 @@ fr: edit: Modifier title: Mes données personnelles updated: Mise à jour des donnes personnelles effectuée ! + posts: + home: Actualités récentes \ No newline at end of file