Commit f74ab6fb by François COLOMBIER

Ajout d'un bandeau avec bouton de connexion pour la boutique de précommande

parent 2ec97ba3
Pipeline #3867 failed with stage
in 1 minute 20 seconds
...@@ -187,12 +187,14 @@ def home(request): ...@@ -187,12 +187,14 @@ def home(request):
Consequently, the front-end url should be unknown from the server so the user is redirected to the index, 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 then the front-end index will call this endpoint to load the home page
""" """
if 'id' in request.COOKIES:
partner_id = request.COOKIES['id']
template = loader.get_template(getattr(settings, 'MEMBERS_SPACE_HOME_TEMPLATE', 'members_space/home.html')) template = loader.get_template(getattr(settings, 'MEMBERS_SPACE_HOME_TEMPLATE', 'members_space/home.html'))
coop_can_change_shift_template = getattr(settings, 'COOP_CAN_CHANGE_SHIFT_TEMPLATE', False) coop_can_change_shift_template = getattr(settings, 'COOP_CAN_CHANGE_SHIFT_TEMPLATE', False)
if coop_can_change_shift_template is True: if coop_can_change_shift_template is True:
# make further investigation only if COOP_CAN_CHANGE_SHIFT_TEMPLATE is True # make further investigation only if COOP_CAN_CHANGE_SHIFT_TEMPLATE is True
if 'id' in request.COOKIES:
partner_id = request.COOKIES['id']
cs = CagetteShift() cs = CagetteShift()
partnerData = cs.get_data_partner(partner_id) partnerData = cs.get_data_partner(partner_id)
if partnerData['cooperative_state'] == "unsubscribed": if partnerData['cooperative_state'] == "unsubscribed":
...@@ -205,6 +207,16 @@ def home(request): ...@@ -205,6 +207,16 @@ def home(request):
'coop_can_change_shift_template': coop_can_change_shift_template, 'coop_can_change_shift_template': coop_can_change_shift_template,
'max_begin_hour': settings.MAX_BEGIN_HOUR, 'max_begin_hour': settings.MAX_BEGIN_HOUR,
} }
if getattr(settings, 'PREORDERS_AVAILABLE', False) is True:
if 'partnerData' not in locals() and 'partner_id' in locals():
cs = CagetteShift()
partnerData = cs.get_data_partner(partner_id)
preorders_connect_url = getattr(settings, 'PREORDER_SERVER_URL', '')
if len(preorders_connect_url) > 0:
preorders_connect_url += "?email=%s&coop=%s&FirstName=&LastName=%s"%(partnerData['email'], str(partnerData['id']), partnerData['display_name'])
context['preorders_connect_url'] = preorders_connect_url
# Get messages to display # Get messages to display
msettings = MConfig.get_settings('members') msettings = MConfig.get_settings('members')
if 'msg_accueil' in msettings: if 'msg_accueil' in msettings:
......
...@@ -474,6 +474,16 @@ ...@@ -474,6 +474,16 @@
By defaut, True. Show "Gestion des binômes" in bdm admin By defaut, True. Show "Gestion des binômes" in bdm admin
### Précommandes
- PREORDERS_AVAILABLE=True
If True and PREODER_SERVER_URL is not empty, a message is displayed in members space home, allowing member to access preorder server
- PREORDER_SERVER_URL='https://precommandes.xxxxx.tld/'
A wordpress server url, type of "Rayons fantomes" of La Louve
### Miscellious ### Miscellious
- EXPORT_COMPTA_FORMAT = 'Quadratus' - EXPORT_COMPTA_FORMAT = 'Quadratus'
......
<div id="home"> <div id="home">
<div class="page_title txtcenter">
{% if preorders_connect_url %}
<style type="text/css">
#preoders_message {
background: #f2dd9e;
padding:1em;
font-weight:bold;
}
#preoders_message span {
display:block;
width:520px;
margin:0 auto;
}
#preoders_message a {
margin-left: 1em; text-decoration: none;
}
#preoders_message a:hover, #preoders_message a:visited {
color: #FFF;
}
</style>
<div id="preoders_message">
<span>La boutique de précommandes est ouverte !
<a href="{{preorders_connect_url|safe}}" class="btn btn--primary">J'y vais</a>
</span>
</div>
{% endif %}
<div class="page_title txtcenter"{% if preorders_connect_url %}style="margin-top: 0;"{% endif %}>
<h1>Espace Membre</h1> <h1>Espace Membre</h1>
</div> </div>
<div class="tiles_container"> <div class="tiles_container">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment