Skip to content

Commit 5276f37

Browse files
committed
Created and styled intro evals slideshow
1 parent 820cbed commit 5276f37

File tree

11 files changed

+706
-159
lines changed

11 files changed

+706
-159
lines changed

.sass-lint.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ files:
44
include: 'frontend/stylesheets/**/*.s+(a|c)ss'
55
ignore:
66
- 'frontend/stylesheets/components/sweet-alert/**'
7+
- 'frontend/stylesheets/components/reveal/**'
8+
- 'frontend/stylesheets/presentations.scss'
79
rules:
810
# Extends
911
extends-before-mixins: 1
@@ -93,4 +95,4 @@ rules:
9395

9496
# Final Items
9597
trailing-semicolon: 1
96-
final-newline: 1
98+
final-newline: 1

conditional/blueprints/intro_evals.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ def get_fid_cm_count(member_id):
107107

108108
if freshman_data is None:
109109
continue
110+
elif freshman_data.freshman_eval_result != "Pending":
111+
continue
110112

111-
# Add continue for if freshman_data.status != Pending
112113
h_meetings = [m.meeting_id for m in
113114
MemberHouseMeetingAttendance.query.filter(
114115
MemberHouseMeetingAttendance.uid == uid

conditional/templates/intro_eval_slideshow.html

+97-152
Original file line numberDiff line numberDiff line change
@@ -3,162 +3,107 @@
33
Introductory 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>Eval Date:</h4>
33-
<p>{{m['eval_date']}}</p>
34-
<h4>Directorship Meetings Passed:</h4>
35-
<p>{{m['committee_meetings_passed']}}</p>
36-
<h4>House Meetings Missed:</h4>
37-
<p>{{m['house_meetings_missed']|length}}</p>
38-
<h4>Freshman Project Passed:</h4>
39-
<p>{{m['freshman_project']}}</p>
40-
<h4>Technical Seminars:</h4>
41-
<ul>
42-
{% for ts in m['technical_seminars'] %}
43-
<li>{{ts}}</li>
44-
{% endfor %}
45-
</ul>
46-
<h4>Signatures Missed</h4>
47-
<p>{{m['signatures_missed']}}</p>
48-
<h4>Social Events</h4>
49-
<p>{{m['social_events']}}</p>
50-
<h4>Comments</h4>
51-
<p>{{m['comments']}}</p>
52-
<button id="pass-{{m['uid']}}" type="button">Pass</button>
53-
<div class="popover-markup">
54-
<a href="#" class="trigger btn btn-default">Fail</a>
55-
<div class="head hide">Conditional Form</div>
56-
<div class="content hide">
57-
<input class="form-control" id="reason-{{m['uid']}}" type="text">
58-
<button id="conditional-{{m['uid']}}" type="button">Conditional</button>
59-
<button id="fail-{{m['uid']}}" type="button">Fail</button>
60-
<script>
61-
$("#fail-{{m['uid']}}").click(function (e) {
62-
e.preventDefault();
63-
64-
$.ajax({
65-
url: '/slideshow/intro/review',
66-
type: 'POST',
67-
contentType: "application/json; charset=utf-8",
68-
dataType: 'json',
69-
data: JSON.stringify({
70-
'uid': "{{m['uid']}}",
71-
'status': "Failed"
72-
}),
73-
success: function (res) {
74-
Reveal.next()
75-
alertify.success("Evaluation submitted successfully.");
76-
$("#slide-{{m['uid']}}").remove()
77-
Reveal.initialize();
78-
}
79-
});
80-
});
81-
$("#conditional-{{m['uid']}}").click(function (e) {
82-
e.preventDefault();
839

84-
$.ajax({
85-
url: '/slideshow/intro/review',
86-
type: 'POST',
87-
contentType: "application/json; charset=utf-8",
88-
dataType: 'json',
89-
data: JSON.stringify({
90-
'uid': "{{m['uid']}}",
91-
'status': "Failed"
92-
}),
93-
success: function (res) {
94-
Reveal.next()
95-
alertify.success("Evaluation submitted successfully.");
96-
$.ajax({
97-
url: '/conditionals/create',
98-
type: 'POST',
99-
contentType: "application/json; charset=utf-8",
100-
dataType: 'json',
101-
data: JSON.stringify({
102-
"uid": "{{m['uid']}}",
103-
"description": $("#reason-{{m['uid']}}").val(),
104-
"due_date": "2016-09-15"
105-
}),
106-
error: function () {
107-
alertify.error("Error adding conditional.");
108-
},
109-
success: function (res) {
110-
alertify.success("Conditional added successfully.");
111-
}
112-
});
113-
$("#slide-{{m['uid']}}").remove()
114-
Reveal.initialize();
115-
}
116-
});
117-
});
118-
</script>
119-
</div>
120-
<script>
121-
$("#pass-{{m['uid']}}").click(function (e) {
122-
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'] >= 10 %}
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 technical_seminars_passed = m['technical_seminars']|length >= 2 %}
35+
<div class="item{% if technical_seminars_passed %} passed{% endif %}">
36+
<span class="icon glyphicon glyphicon-{% if technical_seminars_passed %}ok passed{%else%}remove{% endif %}" aria-hidden="true"></span>
37+
<h3>{{m['technical_seminars']|length}}</h3>
38+
<p>Seminars</p>
39+
</div>
40+
</div>
41+
</div>
42+
{% set freshman_project_passed = m['freshman_project'] == 'Passed' %}
43+
<h4><span class="icon glyphicon glyphicon-{% if freshmen_project_passed %}ok passed{%else%}remove{% endif %}" aria-hidden="true"></span> Freshman Project</h4>
44+
45+
<div class="actions" data-uid="{{m['uid']}}" data-cn="{{m['name']}}">
46+
<button class="pass" type="button">Pass</button>
47+
<button class="fail" type="button">Fail</button>
48+
</div>
49+
50+
</section>
51+
<section>
52+
{% if m['house_meetings_missed']|length > 0 %}
53+
<section>
54+
<h2>House Meetings Missed</h2>
55+
<table>
56+
{% for hm in m['house_meetings_missed'] %}
57+
<tr>
58+
<td class="date">{{hm['date']}}</td>
59+
<td class="reason">{{hm['reason']}}</td>
60+
</tr>
61+
{% endfor %}
62+
</table>
63+
</section>
64+
{% endif %}
65+
<div class="row">
66+
<div class="col-xs-12 col-md-6 more" id="social">
67+
<h3>Social Events</h3>
68+
<p>{{m['social_events']}}</p>
69+
</div>
70+
<div class="col-xs-12 col-md-6 more" id="comments">
71+
<h3>Comments</h3>
72+
<p>{{m['comments']}}</p>
73+
</div>
74+
</div>
75+
</section>
76+
</section>
77+
{% endfor %}
78+
</div>
79+
</div>
12380

124-
$.ajax({
125-
url: '/slideshow/intro/review',
126-
type: 'POST',
127-
contentType: "application/json; charset=utf-8",
128-
dataType: 'json',
129-
data: JSON.stringify({
130-
'uid': "{{m['uid']}}",
131-
'status': "Passed"
132-
}),
133-
success: function (res) {
134-
Reveal.next()
135-
alertify.success("Evaluation submitted successfully.");
136-
$("#slide-{{m['uid']}}").remove()
137-
Reveal.initialize();
138-
}
139-
});
140-
});
141-
</script>
142-
</section>
143-
{% if m['house_meetings_missed']|length > 0 %}
144-
<section>
145-
<h2>Missed House Meetings</h2>
146-
<table>
147-
<tr>
148-
<th>Date</th>
149-
<th>Reason</th>
150-
</tr>
151-
{% for hm in m['house_meetings_missed'] %}
152-
<tr>
153-
<td>{{hm['date']}}</td>
154-
<td>{{hm['reason']}}</td>
155-
</tr>
156-
{% endfor %}
157-
</table>
158-
</section>
159-
{% endif %}
160-
</section>
161-
{% endfor %}
81+
<div class="modal fade" id="createConditional" tabindex="-1">
82+
<div class="vertical-alignment-helper">
83+
<div class="modal-dialog vertical-align-center">
84+
<div class="modal-content">
85+
<div class="modal-header">
86+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
87+
<h4 class="modal-title" id="editUserTitle">Conditional</h4>
88+
</div>
89+
<form data-module="conditionalForm" method="post" autocomplete="off">
90+
<div class="modal-body">
91+
<input type="hidden" name="uid">
92+
<div class="row user-edit-row">
93+
<label class="control-label" for="due_date">Due Date</label>
94+
<input type="text" id="due_date" name="due_date" class="form-control" data-module="datepicker" />
95+
</div>
96+
<div class="row user-edit-row">
97+
<label class="control-label" for="requirement">Requirement</label>
98+
<input type="text" class="form-control" id="requirement" name="description">
99+
</div>
100+
</div>
101+
<div class="modal-footer">
102+
<input type="submit" class="btn btn-primary" value="Create">
103+
</div>
104+
</form>
162105
</div>
163106
</div>
107+
</div>
108+
</div>
164109
{% endblock %}

frontend/javascript/modules/conditionalForm.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import FetchUtil from "../utils/fetchUtil";
2+
import reveal from 'reveal.js';
23

34
export default class ConditionalForm {
45
constructor(form) {
@@ -14,19 +15,21 @@ export default class ConditionalForm {
1415

1516
_submitForm(e) {
1617
e.preventDefault();
17-
1818
let payload = {
19-
uid: this.form.querySelector('select[name=uid]').value,
19+
uid: this.form.uid.value,
2020
description: this.form.querySelector('input[name=description]').value,
2121
dueDate: this.form.querySelector('input[name=due_date]').value
2222
};
23-
2423
FetchUtil.postWithWarning(this.endpoint, payload, {
2524
warningText: "Are you sure you want to create this conditional?",
2625
successText: "The conditional has been created."
2726
}, () => {
2827
$(this.form.closest('.modal')).modal('hide');
29-
location.reload();
28+
if (location.pathname.split('/')[1] === "slideshow") {
29+
reveal.right();
30+
} else {
31+
location.reload();
32+
}
3033
});
3134
}
3235
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import FetchUtil from '../utils/fetchUtil';
2+
import reveal from 'reveal.js';
3+
export default class Presentation {
4+
constructor(element) {
5+
this.element = element;
6+
this.endpoint = '/slideshow/intro/review';
7+
this.render();
8+
}
9+
render() {
10+
reveal.initialize();
11+
$('.reveal button.pass').click(e => {
12+
let uid = e.target.parentElement.dataset.uid; // Ex: ID of 'pass-ram' => 'ram'
13+
let cn = e.target.parentElement.dataset.cn;
14+
e.preventDefault();
15+
let payload = {
16+
uid: uid,
17+
status: "Passed"
18+
};
19+
FetchUtil.postWithWarning(this.endpoint, payload, {
20+
warningText: "Are you sure you want to pass " + cn + "?",
21+
successText: cn + " has been marked as passed."
22+
}, () => {
23+
$(e.target).text("Passed").off("click").addClass("disabled");
24+
$(e.target).next().hide();
25+
reveal.right();
26+
});
27+
});
28+
$('.reveal button.fail').click(e => {
29+
let uid = e.target.parentElement.dataset.uid; // Ex: ID of 'pass-ram' => 'ram'
30+
let cn = e.target.parentElement.dataset.cn;
31+
$(e.target).prev()
32+
.removeClass('pass')
33+
.addClass('conditional')
34+
.text('Conditional')
35+
.attr("id", "conditional-" + uid)
36+
.off('click')
37+
.click(e => {
38+
$('#createConditional').modal();
39+
$('#createConditional input[type="text"]').val('');
40+
$('#createConditional input[name="uid"]').val(uid);
41+
$('#createConditional').on('hidden.bs.modal', function() {
42+
$(e.target).text("Conditionaled").off("click").addClass("disabled");
43+
$(e.target).next().hide();
44+
});
45+
});
46+
$(e.target).click(e => {
47+
e.preventDefault();
48+
let payload = {
49+
uid: uid,
50+
status: "Failed"
51+
};
52+
FetchUtil.postWithWarning(this.endpoint, payload, {
53+
warningText: "Are you sure you want to fail " + cn + "?",
54+
successText: cn + " has been marked as failed."
55+
}, () => {
56+
$(e.target).text("Failed").off("click").addClass("disabled");
57+
$(e.target).prev().hide();
58+
reveal.right();
59+
});
60+
});
61+
});
62+
}
63+
}

frontend/stylesheets/app.scss

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
@import 'pages/housing';
2525
@import 'pages/management';
2626
@import 'pages/hm-attendance';
27+
@import 'components/reveal';

0 commit comments

Comments
 (0)