Skip to content

Commit eed5e4b

Browse files
committed
Created spring evals slideshow
1 parent 5276f37 commit eed5e4b

File tree

4 files changed

+98
-140
lines changed

4 files changed

+98
-140
lines changed

conditional/blueprints/spring_evals.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def get_cm_count(member_id):
5353
db.session.commit()
5454
# something bad happened to get here
5555
print("User did not have existing spring eval data")
56+
elif spring_entry.status != "Pending":
57+
continue
5658

5759
eval_data = None
5860
if internal:

conditional/templates/spring_eval_slideshow.html

Lines changed: 90 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -3,148 +3,100 @@
33
Membership Evaluations Slideshow
44
{% endblock %}
55
{% block extraHeader %}
6-
<script src="../static/js/libraries/jquery.min.js"></script>
7-
<link rel="stylesheet" href="/css/reveal.css">
8-
<link rel="stylesheet" href="/css/white.css">
9-
{% endblock %}
10-
{% block extraFooter %}
11-
<script src="/js/reveal.js"></script>
12-
<script>
13-
Reveal.initialize();
14-
$('.popover-markup>.trigger').popover({
15-
html: true,
16-
title: function () {
17-
return $(this).parent().find('.head').html();
18-
},
19-
content: function () {
20-
return $(this).parent().find('.content').html();
21-
}
22-
});
23-
</script>
6+
<link href="/static/css/presentations.css" rel="stylesheet">
247
{% endblock %}
258
{% block body %}
26-
<div class="reveal">
27-
<div class="slides">
28-
{% for m in members %}
29-
<section id="slide-{{m['uid']}}">
30-
<section>
31-
<h2>{{m['name']}}</h2>
32-
<h4>Directorship Meetings Attended:</h4>
33-
<p>{{m['committee_meetings']}}</p>
34-
<h4>House Meetings Missed:</h4>
35-
<p>{{m['house_meetings_missed']|length}}</p>
36-
<h4>Major Project Passed:</h4>
37-
<p>{{m['major_project_passed']}}</p>
38-
<button id="pass-{{m['uid']}}" type="button">Pass</button>
39-
<div class="popover-markup">
40-
<a href="#" class="trigger btn btn-default">Fail</a>
41-
<div class="head hide">Conditional Form</div>
42-
<div class="content hide">
43-
<input class="form-control" id="reason-{{m['uid']}}" type="text">
44-
<button id="conditional-{{m['uid']}}" type="button">Conditional</button>
45-
<button id="fail-{{m['uid']}}" type="button">Fail</button>
46-
<script>
47-
$("#fail-{{m['uid']}}").click(function (e) {
48-
e.preventDefault();
49-
50-
$.ajax({
51-
url: '/slideshow/spring/review',
52-
type: 'POST',
53-
contentType: "application/json; charset=utf-8",
54-
dataType: 'json',
55-
data: JSON.stringify({
56-
'uid': "{{m['uid']}}",
57-
'status': "Failed"
58-
}),
59-
success: function (res) {
60-
Reveal.next()
61-
alertify.success("Evaluation submitted successfully.");
62-
$("#slide-{{m['uid']}}").remove()
63-
Reveal.initialize();
64-
}
65-
});
66-
});
67-
$("#conditional-{{m['uid']}}").click(function (e) {
68-
e.preventDefault();
699

70-
$.ajax({
71-
url: '/slideshow/spring/review',
72-
type: 'POST',
73-
contentType: "application/json; charset=utf-8",
74-
dataType: 'json',
75-
data: JSON.stringify({
76-
'uid': "{{m['uid']}}",
77-
'status': "Failed"
78-
}),
79-
success: function (res) {
80-
Reveal.next()
81-
alertify.success("Evaluation submitted successfully.");
82-
$.ajax({
83-
url: '/conditionals/create',
84-
type: 'POST',
85-
contentType: "application/json; charset=utf-8",
86-
dataType: 'json',
87-
data: JSON.stringify({
88-
"uid": "{{m['uid']}}",
89-
"description": $("#reason-{{m['uid']}}").val(),
90-
"due_date": "2016-09-15"
91-
}),
92-
error: function () {
93-
alertify.error("Error adding conditional.");
94-
},
95-
success: function (res) {
96-
alertify.success("Conditional added successfully.");
97-
}
98-
});
99-
$("#slide-{{m['uid']}}").remove()
100-
Reveal.initialize();
101-
}
102-
});
103-
});
104-
</script>
105-
</div>
106-
<script>
107-
$("#pass-{{m['uid']}}").click(function (e) {
108-
e.preventDefault();
10+
<div class="reveal" data-module="presentation">
11+
<div class="slides">
12+
{% for m in members %}
13+
<section id="slide-{{m['uid']}}">
14+
<section>
15+
<h1>{{m['name']}}</h1>
16+
<div class="row">
17+
<div class="col-xs-12 col-md-4">
18+
{% set committee_meetings_passed = m['committee_meetings'] >= 25 %}
19+
<div class="item{% if committee_meetings_passed %} passed{% endif %}" >
20+
<span class="icon glyphicon glyphicon-{% if committee_meetings_passed %}ok passed{%else%}remove{% endif %}" aria-hidden="true"></span>
21+
<h3>{{m['committee_meetings']}}</h3>
22+
<p>Meetings</p>
23+
</div>
24+
</div>
25+
<div class="col-xs-12 col-md-4">
26+
{% set house_meetings_passed = m['house_meetings_missed']|length == 0 %}
27+
<div class="item{% if house_meetings_passed %} passed{% endif %}">
28+
<span class="icon glyphicon glyphicon-{% if house_meetings_passed %}ok passed{%else%}remove{% endif %}" aria-hidden="true"></span>
29+
<h3>{{m['house_meetings_missed']|length}}</h3>
30+
<p>Absences</p>
31+
</div>
32+
</div>
33+
<div class="col-xs-12 col-md-4">
34+
{% set major_projects_passed = m['major_projects_len'] >= 1 %}
35+
<div class="item{% if major_projects_passed %} passed{% endif %}">
36+
<span class="icon glyphicon glyphicon-{% if major_projects_passed %}ok passed{%else%}remove{% endif %}" aria-hidden="true"></span>
37+
<h3>{{m['major_projects_len']}}</h3>
38+
<p>Major Projects</p>
39+
</div>
40+
</div>
41+
</div>
42+
<h4>Major Projects:
43+
{% for i in range(m['major_projects_len']) %}
44+
{{ m['major_projects'][i]['name'] }}{% if i < m['major_projects_len'] - 1 %}, {% endif %}
45+
{% endfor %}
46+
</h4>
47+
48+
<div class="actions" data-uid="{{m['uid']}}" data-cn="{{m['name']}}">
49+
<button class="pass" type="button">Pass</button>
50+
<button class="fail" type="button">Fail</button>
51+
</div>
52+
53+
</section>
54+
{% if m['house_meetings_missed']|length > 0 %}
55+
<section>
56+
<section>
57+
<h2>House Meetings Missed</h2>
58+
<table>
59+
{% for hm in m['house_meetings_missed'] %}
60+
<tr>
61+
<td class="date">{{hm['date']}}</td>
62+
<td class="reason">{{hm['reason']}}</td>
63+
</tr>
64+
{% endfor %}
65+
</table>
66+
</section>
67+
</section>
68+
{% endif %}
69+
</section>
70+
{% endfor %}
71+
</div>
72+
</div>
10973

110-
$.ajax({
111-
url: '/slideshow/spring/review',
112-
type: 'POST',
113-
contentType: "application/json; charset=utf-8",
114-
dataType: 'json',
115-
data: JSON.stringify({
116-
'uid': "{{m['uid']}}",
117-
'status': "Passed"
118-
}),
119-
success: function (res) {
120-
Reveal.next()
121-
alertify.success("Evaluation submitted successfully.");
122-
$("#slide-{{m['uid']}}").remove()
123-
Reveal.initialize();
124-
}
125-
});
126-
});
127-
</script>
128-
</section>
129-
{% if m['house_meetings_missed']|length > 0 %}
130-
<section>
131-
<h2>Missed House Meetings</h2>
132-
<table>
133-
<tr>
134-
<th>Date</th>
135-
<th>Reason</th>
136-
</tr>
137-
{% for hm in m['house_meetings_missed'] %}
138-
<tr>
139-
<td>{{hm['date']}}</td>
140-
<td>{{hm['reason']}}</td>
141-
</tr>
142-
{% endfor %}
143-
</table>
144-
</section>
145-
{% endif %}
146-
</section>
147-
{% endfor %}
74+
<div class="modal fade" id="createConditional" tabindex="-1">
75+
<div class="vertical-alignment-helper">
76+
<div class="modal-dialog vertical-align-center">
77+
<div class="modal-content">
78+
<div class="modal-header">
79+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
80+
<h4 class="modal-title" id="editUserTitle">Conditional</h4>
81+
</div>
82+
<form data-module="conditionalForm" method="post" autocomplete="off">
83+
<div class="modal-body">
84+
<input type="hidden" name="uid">
85+
<div class="row user-edit-row">
86+
<label class="control-label" for="due_date">Due Date</label>
87+
<input type="text" id="due_date" name="due_date" class="form-control" data-module="datepicker" />
88+
</div>
89+
<div class="row user-edit-row">
90+
<label class="control-label" for="requirement">Requirement</label>
91+
<input type="text" class="form-control" id="requirement" name="description">
92+
</div>
93+
</div>
94+
<div class="modal-footer">
95+
<input type="submit" class="btn btn-primary" value="Create">
96+
</div>
97+
</form>
14898
</div>
14999
</div>
100+
</div>
101+
</div>
150102
{% endblock %}

frontend/javascript/modules/presentation.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import reveal from 'reveal.js';
33
export default class Presentation {
44
constructor(element) {
55
this.element = element;
6-
this.endpoint = '/slideshow/intro/review';
6+
if (location.pathname.split('/')[2] === "intro") {
7+
this.endpoint = '/slideshow/intro/review';
8+
} else {
9+
this.endpoint = '/slideshow/spring/review';
10+
}
711
this.render();
812
}
913
render() {

frontend/stylesheets/components/reveal/_white.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ body {
212212
width: 75%;
213213
border-collapse: collapse;
214214
border-spacing: 0;
215-
font-size: .8em;
215+
font-size: 1em;
216216
& .date {
217217
text-align: left;
218218
}

0 commit comments

Comments
 (0)