Add footer in page
This commit is contained in:
@@ -73,17 +73,24 @@ class DataSite:
|
|||||||
if not page.exists():
|
if not page.exists():
|
||||||
raise FileNotFoundError(f"Le fichier page.json n'existe pas : {page}")
|
raise FileNotFoundError(f"Le fichier page.json n'existe pas : {page}")
|
||||||
|
|
||||||
datas = json.loads(page.read_text())
|
datas = json.loads(page.read_text())['blocs']
|
||||||
else:
|
else:
|
||||||
datas = self.datas
|
datas = self.datas['blocs'].copy()
|
||||||
|
if 'footer' in datas.keys():
|
||||||
|
del datas['footer']
|
||||||
|
|
||||||
|
|
||||||
return datas
|
return datas
|
||||||
|
|
||||||
|
def get_footer(self):
|
||||||
|
datas = self.datas['blocs']
|
||||||
|
if 'footer' in datas.keys():
|
||||||
|
return datas['footer']
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def update_bloc(self, bloc, form, files=None):
|
def update_bloc(self, bloc, form, files=None):
|
||||||
print (form)
|
|
||||||
for field in form():
|
|
||||||
print(field)
|
|
||||||
|
|
||||||
if files != None:
|
if files != None:
|
||||||
f = files['image']
|
f = files['image']
|
||||||
@@ -239,7 +246,6 @@ class DataSite:
|
|||||||
serverInfos['Address'])
|
serverInfos['Address'])
|
||||||
test_login = subprocess.check_output(test_connect, shell=True, stderr=subprocess.STDOUT)
|
test_login = subprocess.check_output(test_connect, shell=True, stderr=subprocess.STDOUT)
|
||||||
if "Login incorrect" in str(test_login) :
|
if "Login incorrect" in str(test_login) :
|
||||||
print ("Mauvais login")
|
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
@@ -248,15 +254,13 @@ class DataSite:
|
|||||||
|
|
||||||
def publish(self, serverInfos=dict(), password=str()):
|
def publish(self, serverInfos=dict(), password=str()):
|
||||||
userDir = Path(PurePosixPath(self.user_folder))
|
userDir = Path(PurePosixPath(self.user_folder))
|
||||||
|
upload = "lftp -u \"{}\",\"{}\" -p {} {}:{} -e 'mirror -R ./public ./; bye;'".format(serverInfos['username'],
|
||||||
|
|
||||||
upload = "lftp -u \"{}\",\"{}\" -p {} {} -e ' mirror -R public {}; chmod -R o+rx ./; bye;'".format(serverInfos['username'],
|
|
||||||
password,
|
password,
|
||||||
serverInfos['Port'],
|
serverInfos['Port'],
|
||||||
serverInfos['Address'],
|
serverInfos['Address'],
|
||||||
serverInfos['folder'])
|
serverInfos['folder'])
|
||||||
|
|
||||||
set_permissions = "lftp -u \"{}\",\"{}\" -p {} {} -e 'chmod -R o+rx ./; bye;'".format(serverInfos['username'],
|
set_permissions = "lftp -u \"{}\",\"{}\" -p {} {}:{} -e 'chmod -R o+rx ./; bye;'".format(serverInfos['username'],
|
||||||
password,
|
password,
|
||||||
serverInfos['Port'],
|
serverInfos['Port'],
|
||||||
serverInfos['Address'],
|
serverInfos['Address'],
|
||||||
|
|||||||
4
app/templates/_print_colors-footer.css
Normal file
4
app/templates/_print_colors-footer.css
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{% if footer.fg_color != footer.bg_color %}
|
||||||
|
color: {{ footer.fg_color }}; background-color: {{ footer.bg_color }};
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
<div id="myblocs" class="myblocs">
|
<div id="myblocs" class="myblocs">
|
||||||
{% for item in myblocs.keys() %}
|
{% for item in myblocs.keys() %}
|
||||||
|
{% if item != 'footer' %}
|
||||||
<div class="bloc" id="bloc-{{ item }}" style="margin-top: 10px;">
|
<div class="bloc" id="bloc-{{ item }}" style="margin-top: 10px;">
|
||||||
<button class="btn"> {{ item }} - {{ myblocs[item]['type'] }} </button>
|
<button class="btn"> {{ item }} - {{ myblocs[item]['type'] }} </button>
|
||||||
<input class="input-menu" id="bloc-{{ item }}" name="{{ item }}" value="" style="display:none;">
|
<input class="input-menu" id="bloc-{{ item }}" name="{{ item }}" value="" style="display:none;">
|
||||||
<button class="btn btn-danger" onclick="deleteItem(this)"> x </button>
|
<button class="btn btn-danger" onclick="deleteItem(this)"> x </button>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,17 +20,46 @@
|
|||||||
{% include 'admin/_menu-admin.html' %}
|
{% include 'admin/_menu-admin.html' %}
|
||||||
|
|
||||||
{% macro print_colors() %}
|
{% macro print_colors() %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% set bloc = header %}
|
||||||
|
|
||||||
|
{% include 'themes/'+config.theme+'/header.html' ignore missing %}
|
||||||
|
{% if bloc is defined %}
|
||||||
|
<button class="btn btn-danger btn-xl pull-right"
|
||||||
|
id="close-edit-{{bloc.name}}"
|
||||||
|
onclick="hideBtn()"
|
||||||
|
hx-get="{% if page %}/{{ page }}{% endif %}/view/{{ bloc.name }}"
|
||||||
|
hx-swap="outerHTML"
|
||||||
|
hx-target="#{{ bloc.name }}" > X </button>
|
||||||
|
|
||||||
|
|
||||||
|
<button class="btn btn-success btn-xl btn-modify pull-right"
|
||||||
|
id="modify-{{ bloc.name }}"
|
||||||
|
style="margin-top:-7rem; margin-right:1rem;"
|
||||||
|
hx-get="{% if page %}/{{ page }}{% endif %}/edit/{{ bloc.name }}"
|
||||||
|
hx-target="#{{bloc.name}}"
|
||||||
|
hx-swap="oob"> Modifier </button>
|
||||||
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% for bloc in myblocs.values() %}
|
{% for bloc in myblocs.values() %}
|
||||||
|
|
||||||
{% if blocEdit == bloc.name %}
|
{% if blocEdit == bloc.name %}
|
||||||
|
{% include 'themes/'+config.theme+'/blocs/edit/'+bloc.type+'.html' %}
|
||||||
{% include 'themes/'+config.theme+'/blocs/edit/_'+bloc.type+'.html' %}
|
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% include 'themes/'+config.theme+'/blocs/'+bloc.type+'.html' %}
|
||||||
|
<button class="btn btn-danger pull-right"
|
||||||
|
id="close-edit-{{bloc.name}}"
|
||||||
|
style="margin-top:-4rem; position:relative; z-index:999; margin-right:1rem; visibility: hidden;"
|
||||||
|
onclick="enableModBtn()"
|
||||||
|
hx-get="{% if page %}/{{ page }}{% endif %}/view/{{ bloc.name }}"
|
||||||
|
hx-swap="outerHTML"
|
||||||
|
hx-target="#{{ bloc.name }}" > X </button>
|
||||||
|
|
||||||
{% include 'themes/'+config.theme+'/blocs/_'+bloc.type+'.html' %}
|
|
||||||
|
|
||||||
<button class="btn btn-success btn-xl btn-modify pull-right"
|
<button class="btn btn-success btn-xl btn-modify pull-right"
|
||||||
id="modify-{{ bloc.name }}"
|
id="modify-{{ bloc.name }}"
|
||||||
@@ -39,13 +68,35 @@
|
|||||||
hx-target="#{{bloc.name}}"
|
hx-target="#{{bloc.name}}"
|
||||||
hx-swap="oob"> Modifier </button>
|
hx-swap="oob"> Modifier </button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% include '_flash_msgs.html' %}
|
{% include '_flash_msgs.html' %}
|
||||||
|
{% set bloc = footer %}
|
||||||
|
{% include 'themes/'+config.theme+'/blocs/footer.html' ignore missing %}
|
||||||
|
{% if bloc.name %}
|
||||||
|
<button class="btn btn-danger btn-xl pull-right"
|
||||||
|
id="close-edit-{{bloc.name}}"
|
||||||
|
onclick="enableModBtn()"
|
||||||
|
hx-get="{% if page %}/{{ page }}{% endif %}/view/{{ bloc.name }}"
|
||||||
|
hx-swap="outerHTML"
|
||||||
|
hx-target="#{{ bloc.name }}" > X </button>
|
||||||
|
|
||||||
|
|
||||||
|
<button class="btn btn-success btn-xl btn-modify pull-right"
|
||||||
|
id="modify-{{ bloc.name }}"
|
||||||
|
style="margin-top:-7rem; margin-right:1rem;"
|
||||||
|
hx-get="{% if page %}/{{ page }}{% endif %}/edit/{{ bloc.name }}"
|
||||||
|
hx-target="#{{bloc.name}}"
|
||||||
|
hx-swap="oob"> Modifier </button>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
|
<script>
|
||||||
|
</script>
|
||||||
<!-- Include the Quill library -->
|
<!-- Include the Quill library -->
|
||||||
<!-- Bootstrap core JavaScript -->
|
<!-- Bootstrap core JavaScript -->
|
||||||
<script src="/static/vendors/jquery/jquery.min.js"></script>
|
<script src="/static/vendors/jquery/jquery.min.js"></script>
|
||||||
|
|||||||
@@ -16,9 +16,12 @@
|
|||||||
{% include 'themes/'+config.theme+'/_nav.html' %}
|
{% include 'themes/'+config.theme+'/_nav.html' %}
|
||||||
|
|
||||||
{% for bloc in myblocs.values() %}
|
{% for bloc in myblocs.values() %}
|
||||||
{% include 'themes/'+config.theme+'/blocs/_'+bloc.type+'.html' %}
|
{% include 'themes/'+config.theme+'/blocs/'+bloc.type+'.html' %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% set bloc = footer %}
|
||||||
|
{% include 'themes/'+config.theme+'/blocs/footer.html' %}
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
15
app/templates/themes/chocolate/blocs/edit/footer.html
Normal file
15
app/templates/themes/chocolate/blocs/edit/footer.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<form method='POST' action='/edit-footer' >
|
||||||
|
{{ form.csrf_token }}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 mx-auto text-center">
|
||||||
|
{% include 'edit-tools/_form-base.html' %}
|
||||||
|
{% include 'edit-tools/_editor-wysiwyg.html' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% include 'edit-tools/_btn-save-cancel.html' %}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% include 'edit-tools/_disable-modify-button.html' %}
|
||||||
4
app/templates/themes/chocolate/blocs/footer.html
Normal file
4
app/templates/themes/chocolate/blocs/footer.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<footer class="{{ bloc.property }}" id="{{ bloc.name }}" style="{% include '_print_colors.css' %}">
|
||||||
|
{{ bloc.text|safe }}
|
||||||
|
|
||||||
|
</footer>
|
||||||
Reference in New Issue
Block a user