Selaa lähdekoodia

added w-cards on index page

Bernadette Elena Hammerle 1 vuosi sitten
vanhempi
commit
c344ff5655
3 muutettua tiedostoa jossa 18 lisäystä ja 1 poistoa
  1. 2 1
      app.py
  2. 1 0
      database_contribute.json
  3. 15 0
      templates/index.html

+ 2 - 1
app.py

@@ -22,7 +22,8 @@ with open(f"{FOLDER}secret_key", "rb") as secretKeyFile:
 
 @app.route("/", methods=["GET"])
 def index():
-    return render_template("index.html")
+    welcome_cards = read_database("welcome")
+    return render_template("index.html", cards=welcome_cards)
 
 
 @app.route("/karte", methods=["GET"])

+ 1 - 0
database_contribute.json

@@ -0,0 +1 @@
+[]

+ 15 - 0
templates/index.html

@@ -3,4 +3,19 @@
 {% block content %}
 <h2>Herzlich Willkommen bei Nach & Nach </h2>
 
+{% for card in cards %}
+    <div class="card mb-2">
+      <div class="card-body">
+        <h5 class="card-title">{{card.title}}</h5>
+        {% if card.subtitle %}
+            <h6 class="card-subtitle mb-2 text-muted">{{card.subtitle}}</h6>
+        {% endif %}
+        <p class="card-text mb-0">{{card.text}}</p>
+        {% if card.url %}
+            <a href="{{card.url}}" class="card-link">{{card.url}}</a>
+        {% endif %}
+      </div>
+    </div>
+{% endfor %}
+
 {% endblock %}