Skip to content

Commit c5972d2

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 22fc668 + 826a4aa commit c5972d2

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

static/js/timeline.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ $(document).ready(function () {
8585
stopTime = startTime + 30 * 24 * 60 * 60 * 1000;
8686

8787
$.get("/events/list/json", function (data) {
88-
data = JSON.parse(data).filter(function(item) { return item.approved == true; });
88+
data = JSON.parse(data).filter(function(item) { return item.approved == true && item.endTime > now; });
8989

9090
var daysBetween = 1;
9191
var time = new Date(startTime);
@@ -111,7 +111,8 @@ $(document).ready(function () {
111111
var ctfs = [];
112112
lane.map(function (ctf) {
113113
ctfs.push(renderCTF(ctf));
114-
$("#upcoming_ctfs").append("<tr><td><a href='/events/" + ctf.id + "'>" + ctf.name + "</a></td><td><time class='timeago' datetime='" + ctf.startTimeFormat + "'>" + ctf.startTimeFormat + "</time></td></tr>");
114+
var running = now > ctf.startTime && now < ctf.endTime;
115+
$("#upcoming_ctfs").append("<tr><td><a href='/events/" + ctf.id + "'>" + ctf.name + "</a>" + (running ? " <div class='label label-info'>RUNNING</div>" : "") + "</td><td><time class='timeago' datetime='" + ctf.startTimeFormat + "'>" + ctf.startTimeFormat + "</time></td></tr>");
115116
});
116117
$("#ctf_schedule .dragscroll").append("<div class='ctfline'>" + ctfs.join("") + "</div>");
117118
});

templates/events/list.html

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<th>Name</th>
3333
<th>Description</th>
3434
<th>Date</th>
35+
<th>Duration</th>
3536
<th>Website</th>
3637
{% if enabled_actions %}
3738
<th>Actions</th>
@@ -43,6 +44,7 @@
4344
<td><a href="{{ url_for('events.events_detail', event_id=event.id) }}">{{ event.title }}</a></td>
4445
<td>{{ event.description }}</td>
4546
<td><time class="timeago" datetime="{{ event.start_time_format }}">{{ event.start_time_format }}</time></td>
47+
<td>{{ event.duration / 24 }} days</td>
4648
<td><a href="{{ event.link }}" target="_blank">Website</a></td>
4749
{% if enabled_actions %}
4850
<td>

templates/layout.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<html>
33
<head>
44
<title>{% block title %}{% endblock %} - CTF Calendar</title>
5-
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/yeti/bootstrap.min.css" rel="stylesheet"
6-
integrity="sha384-yxFy3Tt84CcGRj9UI7RA25hoUMpUPoFzcdPtK3hBdNgEGnh9FdKgMVM+lbAZTKN2" crossorigin="anonymous">
5+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/flatly/bootstrap.min.css" integrity="sha384-XYCjB+hFAjSbgf9yKUgbysEjaVLOXhCgATTEBpCqT1R3jvG5LGRAK5ZIyRbH5vpX" crossorigin="anonymous">
76
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"
87
integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
98
<link rel="stylesheet" href="{{ url_for('static', filename='/css/calendar.css') }}"/>

views/events.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import time
23

34
from flask import abort, Blueprint, redirect, render_template, url_for, flash
45
from flask_login import current_user, login_required
@@ -98,11 +99,11 @@ def events_detail(event_id):
9899
def events_approve(event_id):
99100
event = Event.query.get_or_404(event_id)
100101
if event.approved:
101-
flash('Event %d already approved!' % event_id)
102+
flash('\'%s\' already approved!' % event.title)
102103
else:
103104
event.approved = True
104105
db.session.commit()
105-
flash('Event %d approved!' % event_id)
106+
flash('\'%s\' approved!' % event.title)
106107
return redirect(url_for('.events_unapproved'))
107108

108109

0 commit comments

Comments
 (0)