Skip to content

Commit

Permalink
Merge pull request #19 from Devlowave-Org/beta-editor
Browse files Browse the repository at this point in the history
Beta editor
  • Loading branch information
Timtonix authored Jun 29, 2024
2 parents b1aaae0 + 5946be5 commit 9a36bb8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
18 changes: 10 additions & 8 deletions App/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def index():
return render_template('home/index.html')



def editeur():
json_site = json.loads(open(f"tmp/{session['ja_id']}/site.json").read())
print(json_site)
Expand Down Expand Up @@ -35,38 +36,39 @@ def v1():
return render_template("editor/v1/editeur.html", data=json_site)



def parametres_theme(devlobdd):
if request.method == 'POST':
devlobdd.change_theme(session['ja'], request.form.get('theme'))
return render_template('home/parametres_theme.html', data=devlobdd.get_site_by_ja(session['ja']))
devlobdd.change_theme(session['ja_id'], request.form.get('theme'))
return render_template('home/parametres_theme.html', data=devlobdd.get_site_by_ja(session['ja_id']))

def site_verification(devlobdd):
return render_template('home/verification.html', data=devlobdd.get_site_by_ja(session['ja']))
return render_template('home/verification.html', data=devlobdd.get_site_by_ja(session['ja_id']))

def domaine(devlobdd):
if request.method == 'POST':
name = request.form.get('name')
domain = request.form.get('domain')
data=devlobdd.get_site_by_ja(session['ja'])
data=devlobdd.get_site_by_ja(session['ja_id'])
if data[1] == f"{name.lower()}.{domain.lower()}":
flash("Rien n'as changé !")
data=devlobdd.get_site_by_ja(session['ja'])
data=devlobdd.get_site_by_ja(session['ja_id'])
return render_template('home/domaine.html', data=data)

if cloudflare.subdomain_exist(name, domain) == False:
# Fonction magique
test = cloudflare.create_subdomain(name, "1.2.3.4", domain)
if test == True:
cloudflare.delete_subdomain({data[1]}, {data[2]})
devlobdd.change_domain(session['ja'], name.lower(), domain.lower())
devlobdd.change_domain(session['ja_id'], name.lower(), domain.lower())
flash("Votre domaine a été enregistré ! ")
data=devlobdd.get_site_by_ja(session['ja'])
data=devlobdd.get_site_by_ja(session['ja_id'])
return render_template('home/domaine.html', data=data)
else:
flash("Erreur : " + str(test))
else:
flash("Erreur : ce nom de domaine existe de déjà !")
data=devlobdd.get_site_by_ja(session['ja'])
data=devlobdd.get_site_by_ja(session['ja_id'])
return render_template('home/domaine.html', data=data)

def add_page():
Expand Down
2 changes: 2 additions & 0 deletions App/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

app.which = "devlotest"
os.system("rm -rf ~/PycharmProjects/devloweb/devlotest.db")
os.system("rm -rf ~/PycharmProjects/devloweb/App/tests/devlotest.db")


@pytest.fixture
def client():
Expand Down
Binary file removed App/tests/devlotest.db
Binary file not shown.
4 changes: 0 additions & 4 deletions App/tests/test_editeur.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import json
import os
import pytest
from test_inscription import devlobdd, req_connection, req_code_verif
from flask import session


def setup_account(client, devlobdd):
Expand Down Expand Up @@ -41,7 +38,6 @@ def test_modify_site(client, devlobdd):
"valider": ""
})


json_site = json.loads(open(f"tmp/8166/site.json").read())

assert response.status_code == 200
Expand Down
2 changes: 1 addition & 1 deletion App/tests/test_inscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import pytest



@pytest.fixture()
def devlobdd():
return DevloBDD("devlotest")


def test_mauvais_id(client, devlobdd):
devlobdd.delete_ja("[email protected]") # Dans l'execution des test, le compte existe deja mdr
response = client.post('/inscription', data={
"email": "[email protected]",
"ja_id": "azerty?",
Expand Down
Binary file modified devlotest.db
Binary file not shown.
2 changes: 1 addition & 1 deletion tmp/8166/site.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"header-title": "Your Nonprofit Name", "nav-link-1": "About Us", "nav-link-2": "Programs", "nav-link-3": "Events", "nav-link-4": "Donate", "nav-link-5": "Contact", "hero-headline": "Making a Difference, One Step at a Time", "hero-subheadline": "Join us in our mission to create a better world for everyone.", "hero-cta": "Donate Now", "about-title": "About Us", "about-description": "Your Nonprofit Name is dedicated to [your mission]. We strive to [explain your goals and vision].", "programs-title": "Our Programs", "program-title-1": "Program 1", "program-description-1": "Description of your first program.", "program-title-2": "Program 2", "program-description-2": "Description of your second program.", "program-title-3": "Program 3", "program-description-3": "Description of your third program.", "events-title": "Upcoming Events", "event-title-1": "Event 1", "event-description-1": "Date and details of your first event.", "event-title-2": "Event 2", "event-description-2": "Date and details of your second event.", "event-title-3": "Event 3", "event-description-3": "Date and details of your third event.", "donate-title": "Support Us", "donate-description": "Your donation helps us continue our mission. Thank you for your generosity.", "donate-cta": "Donate Now", "contact-title": "Contact Us", "contact-description": "Have questions or want to get involved? Reach out to us!", "footer-copyright": "\u00a9 2024 Your Nonprofit Name. All rights reserved.", "social-link-1": "Facebook", "social-link-2": "Twitter", "social-link-3": "Instagram", "enregistrer": ""}
{"titre": "", "valeur1": "", "valider": ""}

0 comments on commit 9a36bb8

Please sign in to comment.