Cleanup
This commit is contained in:
@@ -1 +1,2 @@
|
||||
/static/bootstrap
|
||||
/static/css/bootstrap
|
||||
*.scss
|
||||
1
app.py
1
app.py
@@ -26,6 +26,7 @@ db.init_app(app)
|
||||
@app.route("/")
|
||||
def index():
|
||||
posts = Post.get_posts()
|
||||
print(posts[0].title)
|
||||
return render_template("main/index.html", posts=posts)
|
||||
|
||||
|
||||
|
||||
20
static/js/modal.js
Normal file
20
static/js/modal.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$('#detailModal').on('show.bs.modal', function (event) {
|
||||
let card = $(event.relatedTarget); // Button that triggered the modal
|
||||
let post_id = card.data('post_id');
|
||||
|
||||
$.post(`/api/post/${post_id}`, data => {
|
||||
|
||||
let post = data.post;
|
||||
console.log(post);
|
||||
|
||||
$('#details-title').text(post.title);
|
||||
$('#details-intro').text(post.intro);
|
||||
$('#details-description').text(post.description);
|
||||
|
||||
// $('#details-images').text('');
|
||||
// post.images.forEach(image => {
|
||||
// $('#details-images').append(`<img src=${image}>`)
|
||||
// });
|
||||
|
||||
});
|
||||
});
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Amatic+SC" rel="stylesheet">
|
||||
<!-- Bootstrap first, then custom style -->
|
||||
<link rel="stylesheet" href="/static/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css"
|
||||
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<footer class="small text-center text-muted">
|
||||
© 2019 Marijn Jansen
|
||||
© 2019 Marlous van Leeuwen & Marijn Jansen
|
||||
</footer>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<div class="card-img-overlay d-flex align-items-center justify-content-center">
|
||||
<div class="card-title-bg bg-dark w-100 d-flex align-items-center justify-content-center">
|
||||
<h5 class="card-text text-light">{{ post.title }}</h5>
|
||||
<h5 class="card-text text-light">{{ post.title|safe }}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,43 +2,20 @@
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-center" id="details-title">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{# <div class="modal-header">#}
|
||||
{# <h5 class="modal-title text-center" id="details-title">Modal title</h5>#}
|
||||
{# <button type="button" class="close" data-dismiss="modal" aria-label="Close">#}
|
||||
{# <span aria-hidden="true">×</span>#}
|
||||
{# </button>#}
|
||||
{# </div>#}
|
||||
<div class="modal-body">
|
||||
<div id="details-intro" class="font-weight-bold"></div>
|
||||
<div id="details-images"></div>
|
||||
<h5 id="details-title" class="text-center"></h5>
|
||||
<div id="details-intro" class="font-weight-bold text-center"></div>
|
||||
{# <div id="details-images"></div>#}
|
||||
<div id="details-description"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#detailModal').on('show.bs.modal', function (event) {
|
||||
let card = $(event.relatedTarget); // Button that triggered the modal
|
||||
let post_id = card.data('post_id');
|
||||
|
||||
$.post(`/api/post/${post_id}`, data => {
|
||||
|
||||
let post = data.post;
|
||||
console.log(post);
|
||||
|
||||
$('#details-title').text(post.title);
|
||||
$('#details-intro').text(post.intro);
|
||||
$('#details-description').text(post.description);
|
||||
|
||||
$('#details-images').text('');
|
||||
post.images.forEach(image => {
|
||||
$('#details-images').append(`<img src=${image}>`)
|
||||
});
|
||||
|
||||
});
|
||||
})
|
||||
.on('shown.bs.modal', function () {
|
||||
$('#detailModal').scrollTop(0);
|
||||
});
|
||||
</script>
|
||||
<script src="/static/js/modal.js"></script>
|
||||
Reference in New Issue
Block a user