Skip to content

Commit 16bed12

Browse files
committed
Add new year flow
1 parent eaafd4d commit 16bed12

File tree

6 files changed

+107
-4
lines changed

6 files changed

+107
-4
lines changed

conditional/blueprints/member_management.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def introductory_project_submit():
549549
def get_member(uid):
550550
log = logger.new(user_name=request.headers.get("x-webauth-user"),
551551
request_id=str(uuid.uuid4()))
552-
log.info('api', action='submit introductory project results')
552+
log.info('api', action="get %s's information" & uid)
553553

554554
username = request.headers.get('x-webauth-user')
555555
account = ldap_get_member(username)
@@ -585,3 +585,19 @@ def clear_active_members():
585585
log.info('api', action='remove %s from active status' % account.uid)
586586
ldap_remove_member_from_group(account, 'active')
587587
return jsonify({"success": True}), 200
588+
589+
@member_management_bp.route('/manage/new', methods=['GET'])
590+
def new_year():
591+
log = logger.new(user_name=request.headers.get("x-webauth-user"),
592+
request_id=str(uuid.uuid4()))
593+
log.info('api', action='show new year page')
594+
595+
username = request.headers.get('x-webauth-user')
596+
account = ldap_get_member(username)
597+
598+
if not ldap_is_eval_director(account):
599+
return "must be eval director", 403
600+
601+
return render_template(request,
602+
'new_year.html',
603+
username=username)

conditional/templates/member_management.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ <h3 class="panel-title">Administration</h3>
2727
<div class="stat-title">Intro Accounts</div>
2828
</div>
2929
{% if is_eval_director %}
30-
<div class="col-xs-12 col-sm-4 align-center">
30+
<div class="col-xs-6 col-sm-2 align-center">
3131
<div class="material-switch">
3232
<div class="switch-label">Site Lockdown</div>
3333
<input type="checkbox" id="siteLockdownSwitch" name="siteLockdownSwitch" data-module="siteSettings" data-setting="siteLockdown"{% if site_lockdown %} checked{% endif %}>
3434
<label for="siteLockdownSwitch" class="label-primary"></label>
3535
</div>
3636
</div>
37+
<div class="col-xs-6 col-sm-2 align-center">
38+
<a href="/manage/new" class="btn btn-danger btn-sm btn-new-year"><span class="glyphicon glyphicon-repeat"></span> New Year</a>
39+
</div>
3740
{% endif %}
3841
</div>
3942
</div>

conditional/templates/new_year.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% extends "nav.html" %}
2+
{% block title %}
3+
New Year Guide
4+
{% endblock %}
5+
{% block body %}
6+
<div class="container main">
7+
<div id="new-welcome">
8+
<h3 class="page-title">Welcome!</h3>
9+
<p>Is it that time of year already? Before we get started, please <strong>be careful and ready everything before continuing</strong>. Some actions taken on the next few steps can be detrimental if followed in the middle of the year. Once you are ready to proceed, click 'Begin' below.</p>
10+
<a href="#" data-module="newYear" data-step="welcome" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-chevron-down"></span> Begin</a>
11+
</div>
12+
<div id="new-clear" style="display: none;">
13+
<h3 class="page-title">Clear Active Members and Floor Roster</h3>
14+
<p>This is the scary part. In order to get everything ready for next year, we need to clear everyone from Active status and then clear the housing board. Once we get a fresh start, we will forward you onto the housing page to fill out the new housing board.</p>
15+
<a href="#" data-module="newYear" data-step="clear" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-erase"></span> Clear Active Group and Housing Board</a>
16+
</div>
17+
<div id="new-housing" style="display: none;">
18+
<h3 class="page-title">That was easy!</h3>
19+
<p>The next and final step is to go through and populate the housing board, the button below will even take you there. Just a note: adding people will automatically mark them as active, since they will be charged dues.</p>
20+
<a href="/housing" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-ok"></span> Onward and Upward!</a>
21+
</div>
22+
</div>
23+
24+
<div class="modal fade" id="loadingModal" tabindex="-1" role="dialog" aria-hidden="true">
25+
<div class="vertical-alignment-helper">
26+
<div class="modal-dialog vertical-align-center">
27+
<div class="modal-content">
28+
SPIN...
29+
</div>
30+
</div>
31+
</div>
32+
</div>
33+
{% endblock %}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import FetchUtil from '../utils/fetchUtil';
2+
3+
export default class NewYear {
4+
constructor(link) {
5+
this.link = link;
6+
this.step = this.link.dataset.step;
7+
8+
this.endpoints = {
9+
housing: '/housing',
10+
active: '/manage/active'
11+
};
12+
13+
this.render();
14+
}
15+
render() {
16+
this.link.addEventListener('click', e => {
17+
e.preventDefault();
18+
19+
if (this.step === "welcome") {
20+
$('#new-welcome').fadeOut(function() {
21+
$("#new-clear").fadeIn();
22+
});
23+
} else if (this.step === "clear") {
24+
FetchUtil.fetchWithWarning(this.endpoints.active, {
25+
method: 'DELETE',
26+
warningText: "This will clear active members and room assignments!",
27+
successText: "Data successfully cleared."}, () => {
28+
fetch(this.endpoints.housing, {
29+
method: 'DELETE'
30+
})
31+
.then($('#new-clear').fadeOut(function() {
32+
$("#new-housing").fadeIn();
33+
})
34+
);
35+
});
36+
}
37+
});
38+
}
39+
}

frontend/stylesheets/pages/_management.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
.switch-label {
2-
display: inline-block;
3-
padding: 40px 10px;
2+
display: block;
3+
padding: 17px 10px 10px;
44
text-align: center;
55
}
66

7+
.btn-new-year {
8+
margin-top: 30px;
9+
}
10+
11+
.btn-new-next {
12+
margin: 30px 0;
13+
}
14+
715
.upload-title {
816
padding-top: 20px;
917
height: 55px;

frontend/stylesheets/partials/_global.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,7 @@ tr {
8888
float: none;
8989
vertical-align: middle;
9090
}
91+
92+
.hidden {
93+
display: none;
94+
}

0 commit comments

Comments
 (0)