Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
7edb4672
Commit
7edb4672
authored
Nov 18, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comments to explain routing system
parent
9bc66657
Pipeline
#1462
passed with stage
in 1 minute 28 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
members-space.js
members_space/static/js/members-space.js
+4
-0
urls.py
members_space/urls.py
+2
-2
views.py
members_space/views.py
+10
-0
No files found.
members_space/static/js/members-space.js
View file @
7edb4672
...
...
@@ -68,6 +68,10 @@ function goto(page) {
/**
* Define which html content to load from server depending on the window location
*
* WARNING: For the routing system to work,
* public urls (those the users will see & navigate to) must be different than the server urls used to fetch resources
* (ex: public url: /members_space/mes-info ; server url: /members_space/my_info)
*/
function
update_dom
()
{
$
(
".nav_item"
).
removeClass
(
'active'
);
...
...
members_space/urls.py
View file @
7edb4672
...
...
@@ -5,11 +5,11 @@ from . import views
urlpatterns
=
[
url
(
r'^$'
,
views
.
index
),
url
(
r'^homepage$'
,
views
.
home
),
url
(
r'^homepage$'
,
views
.
home
),
# These endpoints must be different than in-app url
url
(
r'^my_info$'
,
views
.
my_info
),
url
(
r'^my_shifts$'
,
views
.
my_shifts
),
url
(
r'^shifts_exchange$'
,
views
.
shifts_exchange
),
url
(
r'^no_content$'
,
views
.
no_content
),
url
(
r'^get_shifts_history$'
,
views
.
get_shifts_history
),
url
(
'/*$'
,
views
.
index
),
url
(
'/*$'
,
views
.
index
),
# Urls unknown from the server will redirect to index
]
members_space/views.py
View file @
7edb4672
...
...
@@ -138,6 +138,12 @@ def index(request, exception=None):
return
_get_response_according_to_credentials
(
request
,
credentials
,
context
,
template
)
def
home
(
request
):
"""
Endpoint the front-end will call to load the "home" page.
Consequently, the front-end url should be unknown from the server so the user is redirected to the index,
then the front-end index will call this endpoint to load the home page
"""
template
=
loader
.
get_template
(
'members_space/home.html'
)
context
=
{
'title'
:
'Espace Membres'
,
...
...
@@ -151,6 +157,7 @@ def home(request):
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
my_info
(
request
):
""" Endpoint the front-end will call to load the "My info" page. """
template
=
loader
.
get_template
(
'members_space/my_info.html'
)
context
=
{
'title'
:
'Mes Infos'
,
...
...
@@ -158,6 +165,7 @@ def my_info(request):
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
my_shifts
(
request
):
""" Endpoint the front-end will call to load the "My shifts" page. """
template
=
loader
.
get_template
(
'members_space/my_shifts.html'
)
context
=
{
'title'
:
'Mes Services'
,
...
...
@@ -165,6 +173,7 @@ def my_shifts(request):
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
shifts_exchange
(
request
):
""" Endpoint the front-end will call to load the "Shifts exchange" page. """
template
=
loader
.
get_template
(
'members_space/shifts_exchange.html'
)
context
=
{
'title'
:
'Échange de Services'
,
...
...
@@ -172,6 +181,7 @@ def shifts_exchange(request):
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
no_content
(
request
):
""" Endpoint the front-end will call to load the "No content" page. """
template
=
loader
.
get_template
(
'members_space/no_content.html'
)
context
=
{
'title'
:
'Contenu non trouvé'
,
...
...
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