Skip to content

Commit 058eb63

Browse files
authored
Merge pull request #90 from OdeChan/event_view_page
Event View Area
2 parents 53d226d + 2608f6a commit 058eb63

File tree

9 files changed

+182
-8
lines changed

9 files changed

+182
-8
lines changed

app/routers/event.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from app.dependencies import templates
44

5-
65
router = APIRouter(
76
prefix="/event",
87
tags=["event"],
@@ -12,4 +11,11 @@
1211

1312
@router.get("/edit")
1413
async def eventedit(request: Request):
15-
return templates.TemplateResponse("eventedit.html", {"request": request})
14+
return templates.TemplateResponse("event/eventedit.html",
15+
{"request": request})
16+
17+
18+
@router.get("/view/{id}")
19+
async def eventview(request: Request, id: int):
20+
return templates.TemplateResponse("event/eventview.html",
21+
{"request": request, "event_id": id})

app/static/eventedit.css renamed to app/static/event/eventedit.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
html,
22
body {
33
height: 100%;
4-
min-width: max-content;
4+
min-width: min-content;
55
max-width: -moz-available;
66
max-width: -webkit-fill-available;
77
max-width: fill-available;
@@ -13,7 +13,6 @@ body {
1313
}
1414

1515
#event_edit_tabs {
16-
height: 100%;
1716
flex: 1;
1817
}
1918

@@ -35,6 +34,15 @@ form {
3534
display: flex
3635
}
3736

37+
.form_row_start,
38+
.form_row_end {
39+
flex: 1;
40+
}
41+
42+
.form_row_end {
43+
justify-content: flex-end;
44+
}
45+
3846
.form_row {
3947
flex: 1;
4048
min-height: 2.25em;

app/static/event/eventview.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
html,
2+
body {
3+
height: 100%;
4+
min-width: min-content;
5+
max-width: -moz-available;
6+
max-width: -webkit-fill-available;
7+
max-width: fill-available;
8+
}
9+
10+
body {
11+
display: flex;
12+
flex-direction: column;
13+
}
14+
15+
.event_view_wrapper {
16+
display: flex;
17+
flex-direction: column;
18+
height: 100%;
19+
}
20+
21+
#event_view_tabs {
22+
flex: 1;
23+
}
24+
25+
.tab-pane {
26+
height: 100%;
27+
display: flex;
28+
flex-direction: column;
29+
}
30+
31+
.event_info_row,
32+
.event_info_row_start,
33+
.event_info_row_end {
34+
display: flex
35+
}
36+
37+
.event_info_row_start,
38+
.event_info_row_end {
39+
flex: 1;
40+
}
41+
42+
.event_info_row_end {
43+
justify-content: flex-end;
44+
}
45+
46+
div.event_info_row,
47+
.event_info_buttons_row {
48+
align-items: center;
49+
margin-block-start: 0.2em;
50+
margin-block-end: 0.2em;
51+
}
52+
53+
.title {
54+
border-bottom: 4px solid blue;
55+
}
56+
57+
.title h1 {
58+
white-space: nowrap;
59+
margin-block-start: 0.2em;
60+
margin-block-end: 0.2em;
61+
padding-right: 0.5em;
62+
}
63+
64+
.icon {
65+
padding-right: 1em;
66+
}
67+
68+
.event_info_buttons_row {
69+
min-height: 2.25em;
70+
max-height: 3.25em;
71+
}
72+
73+
button {
74+
height: 100%;
75+
}

app/templates/eventedit.html renamed to app/templates/event/eventedit.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Edit Event</title>
6-
<link href="{{ url_for('static', path='/eventedit.css') }}" rel="stylesheet">
6+
<link href="{{ url_for('static', path='event/eventedit.css') }}" rel="stylesheet">
77
</head>
88
<body>
99
<form name="eventeditform" method="POST">
@@ -25,7 +25,7 @@
2525
</ul>
2626
<div class="tab-content" id="event_edit_tabs">
2727
<div class="tab-pane fade show active" id="eventdetails" role="tabpanel" aria-labelledby="eventdetails-tab">
28-
{% include "event_details_form_tab.html" %}
28+
{% include "event/partials/edit_event_details_tab.html" %}
2929
</div>
3030
<!-- Copy commented section to add another tab-->
3131
<!-- <div class="tab-pane fade" id="(CHANGE_ME)" role="tabpanel" aria-labelledby="(CHANGE_ME)-tab">-->

app/templates/event/eventview.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>View Event</title>
6+
<link href="{{ url_for('static', path='event/eventview.css') }}" rel="stylesheet">
7+
</head>
8+
<body>
9+
<div class = "event_view_wrapper">
10+
<!-- Temporary nav layout based on bootstrap -->
11+
<ul class="nav nav-tabs" id="event_view_nav" role="tablist">
12+
<li class="nav-item">
13+
<a class="nav-link active" id="eventdetails-tab" data-toggle="tab" href="#eventdetails" role="tab"
14+
aria-controls="eventdetails" aria-selected="true">
15+
Event Details
16+
</a>
17+
</li>
18+
<!-- Copy commented section to add another navigation item -->
19+
<!-- <li class="nav-item">-->
20+
<!-- <a class="nav-link" id="(CHANGE_ME)-tab" data-toggle="tab" href="#(CHANGE_ME)" role="tab"-->
21+
<!-- aria-controls="(CHANGE_ME)" aria-selected="true">-->
22+
<!-- (CHANGE_ME)-->
23+
<!-- </a>-->
24+
<!-- </li>-->
25+
</ul>
26+
<div class="tab-content" id="event_view_tabs">
27+
<div class="tab-pane fade show active" id="eventdetails" role="tabpanel" aria-labelledby="eventdetails-tab">
28+
{% include "event/partials/view_event_details_tab.html" %}
29+
</div>
30+
<!-- Copy commented section to add another tab-->
31+
<!-- <div class="tab-pane fade" id="(CHANGE_ME)" role="tabpanel" aria-labelledby="(CHANGE_ME)-tab">-->
32+
<!-- ADD INCLUDE HERE -->
33+
<!-- </div>-->
34+
</div>
35+
<div class="event_info_buttons_row event_info_row_end">
36+
<!-- Buttons could and should be replaced with button-like anchors if need so -->
37+
<button type="button">Duplicate</button>
38+
<button type="button">Edit</button>
39+
</div>
40+
</div>
41+
</body>
42+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div class="event_info_row title">
2+
<div class="event_info_row_start">
3+
<h1>EVENT TITLE</h1>
4+
</div>
5+
<div class="event_info_row_end">
6+
<span class="icon">AVAILABILITY</span>
7+
<span class="icon">PRIVACY</span>
8+
</div>
9+
</div>
10+
<div class="event_info_row">
11+
<span class="icon">ICON</span>
12+
<time datetime="DD/MM/YYYY HH:MI">DAY, DD/MM/YYYY HH:MI</time>
13+
-
14+
<time datetime="DD/MM/YYYY HH:MI">HH:Mi</time>
15+
</div>
16+
17+
<div class="event_info_row">
18+
<span class="icon">ICON</span>
19+
<span>Repeats every INTERVAL</span>
20+
</div>
21+
22+
<div class="event_info_row">
23+
<span class="icon">ICON</span>
24+
<address>LOCATION / <a href="#">VC URL</a></address>
25+
</div>
26+
27+
<p class="event_info_row">
28+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus consectetur quis ex ac molestie. Fusce libero
29+
ligula, dictum ac sollicitudin sed, consequat in nisi. Suspendisse feugiat diam quis efficitur aliquet. Duis purus
30+
mauris, luctus ultrices dictum id, fermentum et ex. Nunc in elementum mauris. Maecenas at tincidunt lorem. Sed quis
31+
ante commodo, tincidunt tortor at, tristique nisl. Donec at velit ultricies, viverra tellus at, ultrices ligula.
32+
</p>

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ pydantic==1.7.3
2626
pyparsing==2.4.7
2727
pytest==6.2.1
2828
pytest-cov==2.10.1
29-
python-multipart==0.0.5
29+
python-dateutil==2.8.1
3030
python-dotenv==0.15.0
31+
python-multipart==0.0.5
3132
PyYAML==5.3.1
32-
python-dateutil==2.8.1
3333
requests==2.25.1
3434
six==1.15.0
3535
SQLAlchemy==1.3.22

tests/test_event.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ def test_eventedit():
99
response = client.get("/event/edit")
1010
assert response.status_code == 200
1111
assert b"Edit Event" in response.content
12+
13+
14+
def test_eventview_with_id():
15+
response = client.get("/event/view/1")
16+
assert response.status_code == 200
17+
assert b"View Event" in response.content
18+
19+
20+
def test_eventview_without_id():
21+
response = client.get("/event/view")
22+
assert response.status_code == 404

0 commit comments

Comments
 (0)