Skip to content

Commit cff596e

Browse files
feature/show_event_day_view (#248)
* feature/show_event_day_view
1 parent f1f8ab3 commit cff596e

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

app/static/dayview.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,27 @@ html {
106106
background-color: var(--borders-variant);
107107
border-radius: 50px;
108108
box-shadow: 1px 1px 2px #999;
109+
}
110+
111+
.event-btn {
112+
font-size: 0.625rem;
113+
text-align: center;
114+
color: #fff;
115+
background-color:#30465D;
116+
border-radius: 0.938rem;
117+
border: 0.063rem solid #30465D;
118+
}
119+
120+
.add-event-icon {
121+
display: inline-block;
122+
}
123+
124+
.plus_image {
125+
width: 3rem;
126+
height: 3rem;
127+
}
128+
129+
.pb-1 {
130+
width: 1.2rem;
131+
height: 1.2rem;
109132
}

app/static/eventdisplay.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function scrollTo(element) {
2+
window.scroll({
3+
behavior: 'smooth',
4+
left: 0,
5+
top: element.offsetTop
6+
});
7+
}
8+
9+
document.addEventListener('DOMContentLoaded', () => {
10+
const chosen_button = document.getElementsByClassName('event-btn');
11+
for (let i = 0; i < chosen_button.length; i++) {
12+
chosen_button[i].addEventListener("click", function(e) {
13+
let clickedElem = e.target.id
14+
fetch('/event/edit')
15+
.then(function(response) {
16+
return response.text();
17+
})
18+
.then(function(body) {
19+
document.querySelector('#here').innerHTML = body;
20+
scrollTo(document.getElementById("here"));
21+
});
22+
});
23+
}
24+
});

app/static/images/icons/plus.svg

Lines changed: 1 addition & 0 deletions
Loading

app/static/images/icons/view.svg

Lines changed: 3 additions & 0 deletions
Loading

app/templates/dayview.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,18 @@
5353

5454
{% for event, attr in events %}
5555
<div class="d-flex flex-row justify-content-around align-items-end action-continer" style="grid-row: {{attr.grid_position}};">
56-
<a href="/edit/{{event.id}}" title="Edit event" class="action-icon"><img class="pb-1" src="{{ url_for('static', path='/images/icons/pencil.svg')}}" width="15em" height="15em"></a>
57-
<a href="/delete/{{event.id}}" title="Delete event" class="action-icon"><img class="pb-1" src="{{ url_for('static', path='/images/icons/trash-can.svg')}}" width="15em" height="15em"></a>
56+
<a href="/edit/{{event.id}}" title="Edit event" class="action-icon"><img class="pb-1" src="{{ url_for('static', path='/images/icons/pencil.svg')}}"></a>
57+
<a href="/delete/{{event.id}}" title="Delete event" class="action-icon"><img class="pb-1" src="{{ url_for('static', path='/images/icons/trash-can.svg')}}"></a>
58+
<a href="/event/{{event.id}}" title="See full event" class="action-icon"><img class="pb-1" src="{{ url_for('static', path='/images/icons/view.svg')}}"></a>
5859
</div>
5960
{% endfor %}
6061
</div>
6162
</div>
63+
<div>
64+
<button class="event-btn" title="Add Event" class="add-event-icon"><img class="plus_image" src="{{ url_for('static', path='/images/icons/plus.svg')}}"></a>
65+
</div>
66+
<div id="here">Have a nice day</div>
6267
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
68+
<script type="text/javascript" src="{{ url_for('static', path='/eventdisplay.js') }}"></script>
6369
</body>
6470
</html>

0 commit comments

Comments
 (0)