Init "join" and "dashboard" pages

This commit is contained in:
Cara Salter 2024-03-03 20:29:35 -05:00
parent 670dd34856
commit d6302ea673
No known key found for this signature in database
GPG key ID: A8A3A601440EADA5
7 changed files with 78 additions and 2 deletions

View file

@ -45,5 +45,8 @@ def create_app():
from .auth import bp as auth_bp
app.register_blueprint(auth_bp)
from .dashboard import bp as dash_bp
app.register_blueprint(dash_bp)
return app

View file

@ -0,0 +1,9 @@
from flask import Blueprint, render_template
bp = Blueprint('dashboard', __name__, url_prefix='/dashboard')
@bp.route("/")
def home():
return render_template('dashboard.html')

View file

@ -29,3 +29,12 @@ class PwResetRequest(db.Model):
id = Column(String, primary_key=True)
user_id = Column(String, ForeignKey('acm_users.id'), nullable=False)
expires = Column(DateTime, nullable=False)
class Event(db.Model):
__tablename__ = "acm_events"
id = Column(String, primary_key=True)
name = Column(String, nullable=False)
description = Column(String, nullable=True)
location = Column(String, nullable=False)
start_time=Column(DateTime, nullable=False)
end_time=Column(DateTime, nullable=False)

View file

@ -0,0 +1,16 @@
{% extends "layout.html" %}
{% block app_content %}
<h1>Welcome back, {{ current_user.first_name }}!</h1>
<p>For a list of upcoming events, take a look at our <a href="{{
url_for('main.events')
}}">events
listing</a>.
Otherwise, there's not
a whole lot here
unless you're an
officer!</p>
{% endblock app_content %}

View file

@ -3,6 +3,9 @@
{% block app_content %}
<h1>Join ACM</h1>
<p>Want to join us? Show up to our GBMs and events every week!</p>
<p>Our upcoming events are:</p>
{% endblock %}

View file

@ -34,9 +34,9 @@
</ul>
<ul class="nav navbar-nav">
{% if current_user.is_authenticated %}
{{ render_nav_item('main.homepage', 'Dashboard') }}
{{ render_nav_item('dashboard.home', 'Dashboard') }}
{% if current_user.is_admin %}
{{ render_nav_item('main.homepage', 'Admin Dash') }}
{{ render_nav_item('dashboard.home', 'Admin Dash') }}
{% endif %}
{{ render_nav_item('auth.logout', 'Logout') }}
{% else %}

View file

@ -0,0 +1,36 @@
"""Create event table
Revision ID: 6d239e987242
Revises: 7cdd046a2abf
Create Date: 2024-03-03 20:20:57.235877
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6d239e987242'
down_revision = '7cdd046a2abf'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('acm_events',
sa.Column('id', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('description', sa.String(), nullable=True),
sa.Column('location', sa.String(), nullable=False),
sa.Column('start_time', sa.DateTime(), nullable=False),
sa.Column('end_time', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('acm_events')
# ### end Alembic commands ###