From d74fcb415fe18f315b1c5dfda3d543c2b6b42999 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Wed, 2 Mar 2022 16:37:46 +0100 Subject: [PATCH] extranet --- app/controllers/home_controller.rb | 5 +++++ app/views/application/_logo.html.erb | 5 +++++ app/views/application/_nav.html.erb | 6 +----- app/views/home/index.html.erb | 0 app/views/layouts/devise.html.erb | 6 +----- config/routes.rb | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 app/controllers/home_controller.rb create mode 100644 app/views/application/_logo.html.erb create mode 100644 app/views/home/index.html.erb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 000000000..26e35e8c8 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,5 @@ +class HomeController < ApplicationController + def index + redirect_to admin_root_path unless current_extranet + end +end diff --git a/app/views/application/_logo.html.erb b/app/views/application/_logo.html.erb new file mode 100644 index 000000000..e98dff780 --- /dev/null +++ b/app/views/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 %> +<% else %> + <%= current_context %> +<% end %> diff --git a/app/views/application/_nav.html.erb b/app/views/application/_nav.html.erb index e36e224d7..8d4c112e4 100644 --- a/app/views/application/_nav.html.erb +++ b/app/views/application/_nav.html.erb @@ -1,11 +1,7 @@ <nav class="navbar navbar-light"> <div class="container"> <a class="navbar-brand" href="/"> - <% if current_website %> - <%= current_website %><br> - <% else %> - <%= current_university %> - <% end %> + <%= render 'logo' %> </a> </div> </nav> diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/layouts/devise.html.erb b/app/views/layouts/devise.html.erb index da32f8c68..e8bd46176 100644 --- a/app/views/layouts/devise.html.erb +++ b/app/views/layouts/devise.html.erb @@ -16,11 +16,7 @@ <div class="col-sm-10 mx-auto"> <h1 class="my-5 py-5 text-center"> <%= link_to root_path do %> - <% if current_context.logo.attached? %> - <%= image_tag current_context.logo, width: 200, alt: current_context.to_s %> - <% else %> - <%= current_context %> - <% end %> + <%= render 'logo' %> <% end %> </h1> <div class="card"> diff --git a/config/routes.rb b/config/routes.rb index c6ef30561..f58bf5c2a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,5 +31,5 @@ Rails.application.routes.draw do get '/media/:signed_id/:filename_with_transformations' => 'media#show', as: :medium - root to: 'admin/dashboard#index' + root to: 'home#index' end -- GitLab