add campaigns to homepage
This commit is contained in:
parent
528d62010b
commit
bdde079e43
2 changed files with 41 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
from app import db
|
from app import db
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.users.models import User
|
from app.users.models import User
|
||||||
|
from app.campaigns.models import Campaign
|
||||||
# from forms import LoginForm, RequestResetForm, ResetPasswordForm, EditUserForm, AddUserForm
|
# from forms import LoginForm, RequestResetForm, ResetPasswordForm, EditUserForm, AddUserForm
|
||||||
from flask import render_template, redirect, url_for, flash, request
|
from flask import render_template, redirect, url_for, flash, request
|
||||||
from flask_login import login_required, login_user, current_user, logout_user
|
from flask_login import login_required, login_user, current_user, logout_user
|
||||||
|
|
@ -13,5 +14,6 @@ import os
|
||||||
|
|
||||||
@main.route('/homepage')
|
@main.route('/homepage')
|
||||||
def homepage():
|
def homepage():
|
||||||
|
active_campaigns = Campaign.query.filter_by(active=True).all()
|
||||||
return render_template('homepage.html')
|
return render_template('homepage.html',
|
||||||
|
active_campaigns=active_campaigns)
|
||||||
|
|
@ -1,2 +1,37 @@
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block title %}Customer Search{% endblock title %}
|
{% block title %}Homepage{% endblock title %}
|
||||||
|
|
||||||
|
{% block stylesheet %}
|
||||||
|
<style>
|
||||||
|
.custom-table {
|
||||||
|
border-radius: 15px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
overflow: hidden; /* Ensures rounded corners apply to the entire table */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock stylesheet %}
|
||||||
|
{% block content %}
|
||||||
|
<main>
|
||||||
|
<div class="container my-4 px-5">
|
||||||
|
<h2 class="text-center">Visit Campaigns</h2>
|
||||||
|
|
||||||
|
<table class="table table-bordered table-striped custom-table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Campaign Link</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for campaign in active_campaigns %}
|
||||||
|
<tr>
|
||||||
|
<td>{{campaign.title}}</td>
|
||||||
|
<td><a href="{{url_for('campaigns.campaign_page', campaign_id=campaign.id)}}">See campaign details</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
{% endblock content %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue