Skip to content
Snippets Groups Projects
Unverified Commit f5dbecb6 authored by Pierre-André Boissinot's avatar Pierre-André Boissinot Committed by GitHub
Browse files

Adjust extranet (#2285)

* adjust extranet

* prevent accessing an unactive extranet language

* fix schema

* fix annotate

* adjust

* better structure

* fix fixtures
parent 48af7588
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ class Extranet::ApplicationController < ApplicationController
layout 'extranet/layouts/application'
before_action :redirect_if_no_extranet!,
:redirect_if_language_not_active!,
:authorize_extranet_access!
def breadcrumb
......@@ -17,6 +18,10 @@ class Extranet::ApplicationController < ApplicationController
def redirect_if_no_extranet!
redirect_to admin_root_path(lang: current_university.default_language) unless current_extranet
end
def redirect_if_language_not_active!
redirect_to root_path(lang: nil) unless current_extranet.active_languages.include?(current_language)
end
def authorize_extranet_access!
raise CanCan::AccessDenied unless user_is_authorized?
......
......@@ -9,8 +9,8 @@ class Extranet::HomeController < Extranet::ApplicationController
end
def redirect_to_default_language
default_language = current_university.default_language
default_language = current_extranet.original_localization.language unless current_extranet.languages.include?(default_language)
default_language = current_user.language
default_language = current_extranet.default_language unless current_extranet.active_languages.include?(default_language)
redirect_to extranet_root_path(lang: default_language)
end
end
......@@ -22,7 +22,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# about_id :uuid indexed => [about_type]
# default_language_id :uuid indexed
# default_language_id :uuid not null, indexed
# university_id :uuid not null, indexed
#
# Indexes
......
......@@ -9,7 +9,7 @@
# header_cta :boolean
# header_cta_label :string
# header_cta_url :string
# header_text :string
# header_text :text
# meta_description :string
# migration_identifier :string
# published :boolean
......
<% content_for :title, @l10n %>
<%= render 'admin/application/l10n/widget', about: @category, l10n: @l10n, small: true %>
<%= render 'admin/communication/extranets/documents/list', documents: @documents %>
<%= paginate @documents %>
......
<% content_for :title, @l10n %>
<%= render 'admin/application/l10n/widget', about: @kind, l10n: @l10n, small: true %>
<%= render 'admin/communication/extranets/documents/list', documents: @documents %>
<%= paginate @documents %>
......
<% content_for :title, @l10n %>
<%= render 'admin/application/l10n/widget', about: @category, l10n: @l10n, small: true %>
<%= render 'admin/communication/extranets/posts/list', posts: @posts %>
<%= paginate @posts %>
......
......@@ -3,3 +3,4 @@ default_extranet_fr:
about: default_extranet
language: fr
university: default_university
published: true
......@@ -3,3 +3,4 @@ default_extranet:
feature_alumni: true
about: default_program (Education::Program)
university: default_university
default_language: fr
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment