diff --git a/app/controllers/application_controller/with_context.rb b/app/controllers/application_controller/with_context.rb index 160385d904f0ca544627ae3fa96b769df2e83576..869b626611bdc3511d4d977654680404959c168d 100644 --- a/app/controllers/application_controller/with_context.rb +++ b/app/controllers/application_controller/with_context.rb @@ -4,12 +4,16 @@ module ApplicationController::WithContext included do def current_university - @current_university ||= University.with_host(request.host) + unless @current_university + @current_university = current_website ? current_website.university + : University.with_host(request.host) + end + @current_university end helper_method :current_university def current_website - @current_website ||= Features::Websites::Site.with_host(request.host) + @current_website ||= Features::Websites::Site.with_host(request.host) end helper_method :current_website diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index b98bccfb74bcad4b142482009a63f86bc2e74b50..b8ba504d6ff7fade36449639785f824c031616f2 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -7,21 +7,21 @@ module Admin::ApplicationHelper def show_link(object, **options) link_to_if can?(:read, object), - options.delete(:label) || 'Voir', + options.delete(:label) || t('show'), polymorphic_url_param(object, **options), class: button_classes end def edit_link(object, **options) return unless can?(:update, object) - link_to options.delete(:label) || 'Modifier', + link_to options.delete(:label) || t('edit'), polymorphic_url_param(object, prefix: :edit, **options), class: button_classes end def destroy_link(object, **options) return unless can?(:destroy, object) - link_to options.delete(:label) || 'Supprimer', + link_to options.delete(:label) || t('delete'), polymorphic_url_param(object, **options), method: :delete, data: { confirm: 'Êtes-vous certain ?' }, @@ -32,7 +32,7 @@ module Admin::ApplicationHelper return unless can?(:create, object_class) object_class_sym = object_class.name.underscore.gsub('/', '_').to_sym - link_to options.delete(:label) || 'Créer', + link_to options.delete(:label) || t('create'), polymorphic_url_param(object_class_sym, prefix: :new, **options), class: button_classes end diff --git a/app/views/adminserver/universities/index.html.erb b/app/views/adminserver/universities/index.html.erb index f9a3759412116308b4c29cf9d1e57fa9d92b1123..41ae9547191367ce55b67e0307604dda4f900670 100644 --- a/app/views/adminserver/universities/index.html.erb +++ b/app/views/adminserver/universities/index.html.erb @@ -24,5 +24,5 @@ </table> <% content_for :buttons do %> - <%= create_link University %> + <%= link_to t('create'), new_adminserver_university_path, class: button_classes %> <% end %> diff --git a/app/views/application/_footer.html.erb b/app/views/application/_footer.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3eacc69e9e7addf317ad66a32c6fd9e3bcc022dc --- /dev/null +++ b/app/views/application/_footer.html.erb @@ -0,0 +1,5 @@ +<footer> + <div class="container small"> + <%= current_university %> + </div> +</footer> diff --git a/app/views/application/_nav.html.erb b/app/views/application/_nav.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e36e224d71176e04c82cc538fd2857d1ffb35e7f --- /dev/null +++ b/app/views/application/_nav.html.erb @@ -0,0 +1,11 @@ +<nav class="navbar navbar-light"> + <div class="container"> + <a class="navbar-brand" href="/"> + <% if current_website %> + <%= current_website %><br> + <% else %> + <%= current_university %> + <% end %> + </a> + </div> +</nav> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e4f5be40e8f8b6b47101434ea38d652fe479da5f..7981d2b483dc340e98fd8fd98f8def4ba2cc9bed 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,17 +10,11 @@ <%= javascript_include_tag 'application' %> </head> <body> - <nav> - <div class="container-fluid text-center"> - <% if current_website %> - Site: <%= current_website %><br> - <% end %> - University: <%= current_university %> - </div> - </nav> - <main class="container-fluid"> + <%= render 'nav' %> + <main class="container"> <%= render_breadcrumbs builder: Appstack::BreadcrumbsOnRailsBuilder %> <%= yield %> </main> + <%= render 'footer' %> </body> </html> diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 93c8c1875d23c87c78c0d67daac6384ebe80a9dc..9e129820fb573493ce05fb60321908b3afc73997 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -2,6 +2,8 @@ fr: true: Oui false: Non dashboard: Tableau de bord + show: Voir + create: Créer edit: Modifier delete: Supprimer activerecord: