Procházet zdrojové kódy

Made carousel dynamic

joel
Simon Bowie před 3 roky
rodič
revize
f87dea6726
2 změnil soubory, kde provedl 8 přidání a 16 odebrání
  1. +3
    -1
      web/app/main.py
  2. +5
    -15
      web/app/templates/index.html

+ 3
- 1
web/app/main.py Zobrazit soubor

@@ -10,13 +10,15 @@
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from . import db
from .models import Tool

main = Blueprint('main', __name__)

# route for index page
@main.route('/')
def index():
return render_template('index.html')
tools = Tool.query.limit(3)
return render_template('index.html', tools=tools)

# route for profile page
@main.route('/profile')

+ 5
- 15
web/app/templates/index.html Zobrazit soubor

@@ -23,24 +23,14 @@

<!-- The slideshow/carousel -->
<div class="carousel-inner">
<div class="carousel-item active text-center">
<h2>Tool 1</h2>
{% for tool in tools %}
<div class="carousel-item {% if loop.index == 1 %} active {% endif %} text-center">
<h2>{{ tool['name'] }}</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus varius, justo a iaculis porta, ipsum nibh suscipit orci, at lobortis quam orci ac orci. In non consectetur ipsum. Suspendisse sodales tempor ullamcorper.
</p>
</div>
<div class="carousel-item text-center">
<h2>Tool 2</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus varius, justo a iaculis porta, ipsum nibh suscipit orci, at lobortis quam orci ac orci. In non consectetur ipsum. Suspendisse sodales tempor ullamcorper.
</p>
</div>
<div class="carousel-item text-center">
<h2>Tool 3</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus varius, justo a iaculis porta, ipsum nibh suscipit orci, at lobortis quam orci ac orci. In non consectetur ipsum. Suspendisse sodales tempor ullamcorper.
{{tool['description']|truncate(200) }}
</p>
</div>
{% endfor %}
</div>

<!-- Left and right controls/icons -->

Načítá se…
Zrušit
Uložit