Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
7fef9c56
Commit
7fef9c56
authored
Apr 28, 2017
by
cynddl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for client i18n (and fix language navigation)
parent
05a73122
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
8 deletions
+35
-8
project/settings/base.py
project/settings/base.py
+1
-0
project/urls.py
project/urls.py
+2
-0
static/src/components/navigation.css
static/src/components/navigation.css
+14
-3
templates/base.html
templates/base.html
+18
-5
No files found.
project/settings/base.py
View file @
7fef9c56
...
...
@@ -21,6 +21,7 @@ ALLOWED_HOSTS = []
MIDDLEWARE
=
[
"django.middleware.security.SecurityMiddleware"
,
"django.contrib.sessions.middleware.SessionMiddleware"
,
"django.middleware.locale.LocaleMiddleware"
,
"django.middleware.common.CommonMiddleware"
,
"django.middleware.csrf.CsrfViewMiddleware"
,
"django.contrib.auth.middleware.AuthenticationMiddleware"
,
...
...
project/urls.py
View file @
7fef9c56
...
...
@@ -16,6 +16,8 @@ router.extend(rp_router)
urlpatterns
=
[
url
(
r
"^admin/"
,
admin
.
site
.
urls
),
url
(
r
'^i18n/'
,
include
(
'django.conf.urls.i18n'
)),
url
(
r
"^api/"
,
include
(
router
.
urls
,
namespace
=
"api"
)),
url
(
r
"^rp/"
,
include
(
"rp.urls"
,
namespace
=
"rp"
)),
url
(
r
'^accounts/'
,
include
(
'allauth.urls'
)),
...
...
static/src/components/navigation.css
View file @
7fef9c56
/* Navigation */
@custom-selector
:
--enter
:
hover
,
:
focus
;
@custom-selector
:
--link
a
,
.
btn-link
;
@custom-selector
:
--navbar-blue
.
navbar
.
dark-blue-bg
,
.
navbar
.
medium-blue-bg
;
.navbar-sm
{
font-size
:
13px
;
font-weight
:
600
;
}
.navbar
a
{
.navbar
:--link
{
color
:
var
(
--color-medium-blue
);
line-height
:
1.5rem
;
font-size
:
13px
;
font-weight
:
600
;
border
:
0
;
padding
:
0.5em
1em
;
&:--enter
{
color
:
var
(
--color-dark-blue
);
}
...
...
@@ -19,10 +28,12 @@
position
:
absolute
;
}
.navbar.dark-blue-bg
a
,
.navbar.medium-blue-bg
a
{
:--navbar-blue
:--link
{
color
:
var
(
--color-white
);
&:--enter
{
color
:
var
(
--color-medium-gray
);
text-decoration
:
none
;
cursor
:
pointer
;
}
}
...
...
@@ -53,7 +64,7 @@ ul.nav.nav-integrated li {
background-color
:
var
(
--color-white
);
}
&
a
{
&
:--link
{
padding
:
1rem
;
font-weight
:
bold
;
text-align
:
center
;
...
...
templates/base.html
View file @
7fef9c56
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<!-- Header -->
<html>
...
...
@@ -26,15 +27,27 @@
<ul
class=
"navbar-nav ml-auto"
>
{% if user.is_authenticated %}
{% comment %}
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_profile' %}"
>
Mon profile
</a></li>
{% endcomment %}
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_logout' %}"
>
Déconnexion
</a></li>
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_logout' %}"
>
{% trans "Logout" %}
</a></li>
{% else %}
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_signup' %}"
>
Créer un compte
</a></li>
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_login' %}"
>
Se connecter
</a></li>
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_signup' %}"
>
{% trans "Register" %}
</a></li>
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"{% url 'account_login' %}"
>
{% trans "Login" %}
</a></li>
{% endif %}
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"https://soutien.laquadrature.net"
>
[FR]
</a></li>
<li
class=
"nav-item"
><a
class=
"nav-link"
href=
"https://support.laquadrature.net"
>
[EN]
</a></li>
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<li
class=
"nav-item"
>
<form
action=
"{% url 'set_language' %}"
method=
"post"
>
{% csrf_token %}
<input
name=
"next"
type=
"hidden"
value=
"{{ redirect_to }}"
/>
<input
name=
"language"
type=
"hidden"
value=
"{{ language.code }}"
/>
<button
class=
"btn btn-link"
type=
"submit"
>
[{{ language.code }}]
</button>
</form>
</li>
{% endfor %}
</ul>
</div>
</nav>
<nav
class=
"navbar navbar-toggleable-md"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment