From c7a5b5f3fb440f849af6222409436e0552b12f6e Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Thu, 2 May 2024 13:58:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=A1(backend-demo)=20remove=20code=5Fed?= =?UTF-8?q?itor=20from=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We removed the template code_editor from app, so we redapt the demo to fit the old template. The field code_editor is not needed anymore. --- src/backend/demo/data/template/code.txt | 52 +-- .../demo/data/template/code_editor.json | 442 ------------------ src/backend/demo/data/template/css.txt | 132 ++---- .../demo/management/commands/create_demo.py | 4 - 4 files changed, 64 insertions(+), 566 deletions(-) delete mode 100644 src/backend/demo/data/template/code_editor.json diff --git a/src/backend/demo/data/template/code.txt b/src/backend/demo/data/template/code.txt index 3fca627f..a14aea90 100644 --- a/src/backend/demo/data/template/code.txt +++ b/src/backend/demo/data/template/code.txt @@ -1,37 +1,21 @@ - -
-
-
-
- -
-
-
- Direction
Interministérielle
du numérique -
-
-
-
-
-
La directrice
-
Réf: 12000001
-
-
-
Paris, le 28/09/2023
-
-
-
Note
à Monsieur Le Premier Ministre
-
Objet: Generated PDF
-
{{ body }}
+ +
+ +

Direction
Interministérielle
du numérique

+
+
+
+
La directrice
+

Réf: 1200001

+
Paris, le 28/09/2023
-
- Footer: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do - eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim - veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea - commodo consequat +
+

Note

+
à Monsieur le Premier Ministre
- +
+
Objet: Generated PDF
+
{{ body }}
+
+ \ No newline at end of file diff --git a/src/backend/demo/data/template/code_editor.json b/src/backend/demo/data/template/code_editor.json deleted file mode 100644 index b6fc8f2e..00000000 --- a/src/backend/demo/data/template/code_editor.json +++ /dev/null @@ -1,442 +0,0 @@ -{ - "pages": [ - { - "id": "VlXkJzAStsYTLhwJ", - "type": "main", - "frames": [ - { - "id": "FZ0aEvTxwtxsFeIQ", - "component": { - "type": "wrapper", - "stylable": [ - "background", - "background-color", - "background-image", - "background-repeat", - "background-attachment", - "background-position", - "background-size" - ], - "attributes": { "id": "iubr" }, - "components": [ - { - "name": "Row", - "classes": [{ "name": "gjs-row", "private": 1 }], - "droppable": ".gjs-cell", - "resizable": { - "bl": 0, - "br": 0, - "cl": 0, - "cr": 0, - "tc": 0, - "tl": 0, - "tr": 0, - "minDim": 1 - }, - "attributes": { "id": "ix1a" }, - "components": [ - { - "name": "Cell", - "classes": [{ "name": "gjs-cell", "private": 1 }], - "draggable": ".gjs-row", - "resizable": { - "bc": 0, - "bl": 0, - "br": 0, - "cl": 0, - "cr": 1, - "tc": 0, - "tl": 0, - "tr": 0, - "step": 0.2, - "minDim": 1, - "currentUnit": 1 - }, - "attributes": { "id": "iqey" }, - "components": [ - { - "name": "Row", - "classes": [{ "name": "gjs-row", "private": 1 }], - "droppable": ".gjs-cell", - "resizable": { - "bl": 0, - "br": 0, - "cl": 0, - "cr": 0, - "tc": 0, - "tl": 0, - "tr": 0, - "minDim": 1 - }, - "attributes": { "id": "ip2l" }, - "components": [ - { - "name": "Cell", - "classes": [{ "name": "gjs-cell", "private": 1 }], - "draggable": ".gjs-row", - "resizable": { - "bc": 0, - "bl": 0, - "br": 0, - "cl": 0, - "cr": 1, - "tc": 0, - "tl": 0, - "tr": 0, - "step": 0.2, - "minDim": 1, - "currentUnit": 1 - }, - "attributes": { "id": "i9ps" }, - "components": [ - { - "type": "image", - "resizable": { "ratioDefault": 1 }, - "attributes": { - "id": "ioje", - "src": "https://upload.wikimedia.org/wikipedia/fr/7/72/Logo_du_Gouvernement_de_la_R%C3%A9publique_fran%C3%A7aise_%282020%29.svg" - } - } - ] - }, - { - "name": "Cell", - "classes": [{ "name": "gjs-cell", "private": 1 }], - "draggable": ".gjs-row", - "resizable": { - "bc": 0, - "bl": 0, - "br": 0, - "cl": 0, - "cr": 1, - "tc": 0, - "tl": 0, - "tr": 0, - "step": 0.2, - "minDim": 1, - "currentUnit": 1 - }, - "attributes": { "id": "ifn8" }, - "components": [ - { - "type": "text", - "attributes": { "id": "i1v9" }, - "components": [ - { - "type": "textnode", - "content": "Direction\n" - }, - { "void": true, "tagName": "br" }, - { - "type": "textnode", - "content": "Interministérielle\n" - }, - { "void": true, "tagName": "br" }, - { - "type": "textnode", - "content": "du numérique" - } - ] - } - ] - } - ], - "custom-name": "header" - }, - { - "name": "Row", - "classes": [{ "name": "gjs-row", "private": 1 }], - "droppable": ".gjs-cell", - "resizable": { - "bl": 0, - "br": 0, - "cl": 0, - "cr": 0, - "tc": 0, - "tl": 0, - "tr": 0, - "minDim": 1 - }, - "attributes": { "id": "ipfx3" }, - "components": [ - { - "name": "Cell", - "classes": [{ "name": "gjs-cell", "private": 1 }], - "draggable": ".gjs-row", - "resizable": { - "bc": 0, - "bl": 0, - "br": 0, - "cl": 0, - "cr": 1, - "tc": 0, - "tl": 0, - "tr": 0, - "step": 0.2, - "minDim": 1, - "currentUnit": 1 - }, - "attributes": { "id": "isc8e" }, - "components": [ - { - "type": "text", - "attributes": { "id": "ix7wo" }, - "components": [ - { - "type": "textnode", - "content": "La directrice" - } - ] - }, - { - "type": "text", - "attributes": { "id": "ij1wk" }, - "components": [ - { - "type": "textnode", - "content": "Réf: 12000001" - } - ] - } - ] - }, - { - "name": "Cell", - "classes": [{ "name": "gjs-cell", "private": 1 }], - "draggable": ".gjs-row", - "resizable": { - "bc": 0, - "bl": 0, - "br": 0, - "cl": 0, - "cr": 1, - "tc": 0, - "tl": 0, - "tr": 0, - "step": 0.2, - "minDim": 1, - "currentUnit": 1 - }, - "attributes": { "id": "iei3g" }, - "components": [ - { - "type": "text", - "attributes": { "id": "iwp89" }, - "components": [ - { - "type": "textnode", - "content": "Paris, le 28/09/2023" - } - ] - } - ] - } - ], - "custom-name": "sub-header" - }, - { - "type": "text", - "attributes": { "id": "i59gh" }, - "components": [ - { - "type": "text", - "tagName": "b", - "components": [ - { "type": "textnode", "content": "Note" } - ] - }, - { "void": true, "tagName": "br" }, - { - "type": "textnode", - "content": "à Monsieur Le Premier Ministre" - } - ], - "custom-name": "note" - }, - { - "type": "text", - "attributes": { "id": "i2egv" }, - "components": [ - { - "type": "textnode", - "content": "Objet: Generated PDF" - } - ], - "custom-name": "object" - }, - { - "type": "text", - "attributes": { "id": "icpsv" }, - "components": [ - { "type": "textnode", "content": "{{body}}" }, - { "void": true, "tagName": "br" } - ], - "custom-name": "body" - } - ] - } - ] - }, - { - "type": "text", - "attributes": { "id": "iqn81" }, - "components": [ - { - "type": "textnode", - "content": "Footer: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat" - } - ] - } - ], - "custom-name": "Body" - } - } - ] - } - ], - "assets": [ - { - "src": "https://upload.wikimedia.org/wikipedia/fr/7/72/Logo_du_Gouvernement_de_la_R%C3%A9publique_fran%C3%A7aise_%282020%29.svg", - "type": "image", - "width": 0, - "height": 0, - "unitDim": "px" - } - ], - "styles": [ - { - "style": { - "width": "100%", - "display": "table", - "padding-top": "10px", - "padding-left": "10px", - "padding-right": "10px", - "padding-bottom": "10px" - }, - "selectors": [{ "name": "gjs-row", "private": 1 }] - }, - { - "style": { "width": "100%", "display": "block" }, - "mediaText": "(max-width: 768px)", - "selectors": [{ "name": "gjs-cell", "private": 1 }], - "atRuleType": "media" - }, - { - "style": { "width": "100%", "display": "block" }, - "mediaText": "(max-width: 768px)", - "selectors": ["gjs-cell30"], - "atRuleType": "media" - }, - { - "style": { "width": "100%", "display": "block" }, - "mediaText": "(max-width: 768px)", - "selectors": ["gjs-cell70"], - "atRuleType": "media" - }, - { - "style": { "width": "8%", "height": "75px", "display": "table-cell" }, - "selectors": [{ "name": "gjs-cell", "private": 1 }] - }, - { - "style": { "height": "100%", "padding": "0px 0px 0px 0px" }, - "selectors": ["#ix1a"] - }, - { - "style": { - "color": "black", - "width": "214px", - "height": "128px", - "margin": "0px 0px 0px -12px" - }, - "selectors": ["#ioje"] - }, - { - "style": { - "top": "-5px", - "float": "right", - "margin": "-13px 0px 0px 0px", - "display": "block", - "padding": "0px 10px 0px 0px", - "position": "relative", - "font-size": "19px", - "text-align": "right", - "font-family": "Arial Black, Gadget, sans-serif", - "font-weight": "800", - "line-height": "26px", - "letter-spacing": "0px" - }, - "selectors": ["#i1v9"] - }, - { "style": { "margin": "60px 0px 0px 0px" }, "selectors": ["#ipfx3"] }, - { - "style": { - "padding": "10px 10px 3px 0px", - "font-family": "Georgia, serif" - }, - "selectors": ["#ix7wo"] - }, - { - "style": { - "padding": "0px 10px 10px 0px", - "font-size": "12px", - "font-family": "Georgia, serif" - }, - "selectors": ["#ij1wk"] - }, - { - "style": { - "padding": "10px 0px 3px 10px", - "font-size": "14px", - "text-align": "right", - "font-family": "Georgia, serif" - }, - "selectors": ["#iwp89"] - }, - { - "style": { - "padding": "10px", - "font-size": "15px", - "font-family": "Georgia, serif" - }, - "selectors": ["#i59gh"] - }, - { - "style": { - "padding": "29px 10px 10px 10px", - "font-size": "20px", - "font-family": "Georgia, serif", - "font-weight": "900" - }, - "selectors": ["#i2egv"] - }, - { - "style": { - "padding": "30px 10px 10px 10px", - "font-family": "Georgia, serif" - }, - "selectors": ["#icpsv"] - }, - { "style": { "padding": "0px 0px 0px 0px" }, "selectors": ["#ifn8"] }, - { "style": { "padding": "0px 0px 0px 0px" }, "selectors": ["#ip2l"] }, - { - "style": { - "bottom": "0px", - "padding": "10px 10px 0px 10px", - "position": "fixed", - "font-size": "12px", - "font-family": "Georgia, serif" - }, - "selectors": ["#iqn81"] - }, - { - "style": { - "color": "#000000", - "border": "0px solid #f6f6f6", - "font-size": "15px", - "font-family": "\"Mercury SSm A\", \"Mercury SSm B\", Georgia, Times, \"Times New Roman\", \"Microsoft YaHei New\", \"Microsoft Yahei\", 微软雅黑, 宋体, SimSun, STXihei, 华文细黑, serif", - "background-color": "#fbfbfb" - }, - "selectors": ["#ilke6"] - } - ] -} diff --git a/src/backend/demo/data/template/css.txt b/src/backend/demo/data/template/css.txt index 41f2897e..2d536e2c 100644 --- a/src/backend/demo/data/template/css.txt +++ b/src/backend/demo/data/template/css.txt @@ -1,95 +1,55 @@ -* { - box-sizing: border-box; -} body { + background: white; + font-family: arial +} +img { + width: 5cm; + margin-left: -0.4cm; +} +.header { + display: flex; + justify-content: space-between; +} +.header-title { + text-align: right; + margin-top: 3rem; + font-size: 1.2rem; +} +.second-row { + display: flex; + justify-content: space-between; + margin-top: 1.2cm; +} +.ref { + margin-top: 0; +} +.who { + font-weight: medium; +} +.date, .ref { + font-size: 12px; +} +.title, .subtitle { margin: 0; } -.gjs-row { - width: 100%; - display: table; - padding-top: 10px; - padding-left: 10px; - padding-right: 10px; - padding-bottom: 10px; +.subtitle { + font-weight: normal; } -.gjs-cell { - width: 8%; - height: 75px; - display: table-cell; +.object { + font-weight: bold; + margin-bottom: 1.2cm; + margin-top: 3rem } -#ix1a { - height: 100%; - padding: 0px 0px 0px 0px; +.body{ + margin-top: 1.5rem } -#ioje { - color: black; - width: 214px; - height: 128px; - margin: 0px 0px 0px -12px; +h1 { + font-size: 18px; } -#i1v9 { - top: -5px; - float: right; - margin: -13px 0px 0px 0px; - display: block; - padding: 0px 10px 0px 0px; - position: relative; - font-size: 19px; - text-align: right; - font-family: Arial Black, Gadget, sans-serif; - font-weight: 800; - line-height: 26px; - letter-spacing: 0px; -} -#ipfx3 { - margin: 60px 0px 0px 0px; -} -#ix7wo { - padding: 10px 10px 3px 0px; - font-family: Georgia, serif; -} -#ij1wk { - padding: 0px 10px 10px 0px; - font-size: 12px; - font-family: Georgia, serif; -} -#iwp89 { - padding: 10px 0px 3px 10px; +h2 { font-size: 14px; - text-align: right; - font-family: Georgia, serif; -} -#i59gh { - padding: 10px; - font-size: 15px; - font-family: Georgia, serif; -} -#i2egv { - padding: 29px 10px 10px 10px; - font-size: 20px; - font-family: Georgia, serif; - font-weight: 900; -} -#icpsv { - padding: 30px 10px 10px 10px; - font-family: Georgia, serif; -} -#ifn8 { - padding: 0px 0px 0px 0px; -} -#ip2l { - padding: 0px 0px 0px 0px; -} -#iqn81 { - bottom: 0px; - padding: 10px 10px 0px 10px; - position: fixed; - font-size: 12px; - font-family: Georgia, serif; -} -@media (max-width: 768px) { - .gjs-cell { - width: 100%; - display: block; - } } +p { + text-align: justify; + ligne-height: 0.8; +} \ No newline at end of file diff --git a/src/backend/demo/management/commands/create_demo.py b/src/backend/demo/management/commands/create_demo.py index e78b4dcc..8a26343e 100644 --- a/src/backend/demo/management/commands/create_demo.py +++ b/src/backend/demo/management/commands/create_demo.py @@ -110,9 +110,6 @@ def create_demo(stdout): queue = BulkQueue(stdout) with Timeit(stdout, "Creating Template"): - with open("demo/data/template/code_editor.json", "r") as file: - json_data = json.load(file) - with open("demo/data/template/code.txt", "r") as text_file: code_data = text_file.read() @@ -123,7 +120,6 @@ def create_demo(stdout): models.Template( title="Demo Template", description="This is the demo template", - code_editor=json_data, code=code_data, css=css_data, is_public=True,