-
Notifications
You must be signed in to change notification settings - Fork 31
New Year Flow #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Year Flow #143
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{% extends "nav.html" %} | ||
{% block title %} | ||
New Year Guide | ||
{% endblock %} | ||
{% block body %} | ||
<div class="container main"> | ||
<div id="new-welcome"> | ||
<h3 class="page-title">Welcome!</h3> | ||
<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> | ||
<a href="#" data-module="newYear" data-step="welcome" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-ok"></span> Begin</a> | ||
</div> | ||
<div id="new-clear" style="display: none;"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you added a |
||
<h3 class="page-title">Clear Active Members and Floor Roster</h3> | ||
<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> | ||
<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> | ||
</div> | ||
<div id="new-current" style="display: none;"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
<h3 class="page-title">Prune Current Students Group</h3> | ||
<p>Take a second and scroll down the list, remove anyone who has graduated. Anyone in this list who is in good standing can become active, so it is important it is correct.</p> | ||
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="0" data-sort-order="asc" data-length-changable="true"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Remove</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for student in current_students %} | ||
<tr> | ||
<td id="row-{{student.uid}}">{{student.displayName}}</td> | ||
<td width=100px> | ||
<a href="#" data-module="newYear" data-uid="{{student.uid}}"> | ||
<span id="rem-{{student.uid}}" class="glyphicon glyphicon-remove red align-center" style="width: 100%"></span> | ||
<span id="add-{{student.uid}}" class="glyphicon glyphicon-plus green align-center" style="width: 100%; display: none;"></span> | ||
</a> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<a href="#" data-module="newYear" data-step="current" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-ok"></span> Next Step</a> | ||
</div> | ||
<div id="new-housing" style="display: none;"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
<h3 class="page-title">That was easy!</h3> | ||
<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> | ||
<a href="/housing" class="btn btn-primary btn-new-next center-block"><span class="glyphicon glyphicon-ok"></span> Onward and Upward!</a> | ||
</div> | ||
</div> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import FetchUtil from '../utils/fetchUtil'; | ||
import Exception from "../exceptions/exception"; | ||
import FetchException from "../exceptions/fetchException"; | ||
import sweetAlert from "../../../node_modules/bootstrap-sweetalert/dev/sweetalert.es6.js"; // eslint-disable-line max-len | ||
|
||
export default class NewYear { | ||
constructor(link) { | ||
this.link = link; | ||
this.step = this.link.dataset.step; | ||
this.uid = this.link.dataset.uid; | ||
|
||
this.endpoints = { | ||
housing: '/housing', | ||
active: '/manage/active', | ||
current: '/manage/current/' | ||
}; | ||
|
||
this.render(); | ||
} | ||
render() { | ||
this.link.addEventListener('click', e => { | ||
e.preventDefault(); | ||
|
||
if (this.step === "welcome") { | ||
$('#new-welcome').fadeOut(() => { | ||
$("#new-clear").fadeIn(); | ||
}); | ||
} else if (this.step === "clear") { | ||
FetchUtil.fetchWithWarning(this.endpoints.active, { | ||
method: 'DELETE', | ||
warningText: "This will clear active members and room assignments!", | ||
successText: "Data successfully cleared."}, () => { | ||
fetch(this.endpoints.housing, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should have a |
||
method: 'DELETE' | ||
}) | ||
.then($('#new-clear').fadeOut(() => { | ||
$("#new-current").fadeIn(); | ||
}) | ||
).catch(error => { | ||
sweetAlert("Uh oh...", "We're having trouble submitting that " + | ||
"action right now. Please try again later.", "error"); | ||
throw new Exception(FetchException.REQUEST_FAILED, error); | ||
}); | ||
}); | ||
} else if (this.uid) { | ||
if ($('#rem-' + this.uid).is(":visible")) { | ||
fetch(this.endpoints.current + this.uid, { | ||
method: 'DELETE' | ||
}).then(() => { | ||
$('#rem-' + this.uid).hide(); | ||
$('#add-' + this.uid).show(); | ||
var userRow = $('#row-' + this.uid)[0]; | ||
userRow.style.setProperty("text-decoration", "line-through"); | ||
}).catch(error => { | ||
sweetAlert("Uh oh...", "We're having trouble submitting that " + | ||
"action right now. Please try again later.", "error"); | ||
throw new Exception(FetchException.REQUEST_FAILED, error); | ||
}); | ||
} else { | ||
fetch(this.endpoints.current + this.uid, { | ||
method: 'POST' | ||
}).then(() => { | ||
$('#add-' + this.uid).hide(); | ||
$('#rem-' + this.uid).show(); | ||
var lineRow = $('#row-' + this.uid)[0]; | ||
lineRow.style.setProperty("text-decoration", "none"); | ||
}).catch(error => { | ||
sweetAlert("Uh oh...", "We're having trouble submitting that " + | ||
"action right now. Please try again later.", "error"); | ||
throw new Exception(FetchException.REQUEST_FAILED, error); | ||
}); | ||
} | ||
} else if (this.step === "current") { | ||
$('#new-current').fadeOut(function() { | ||
$("#new-housing").fadeIn(); | ||
}); | ||
} | ||
}); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,7 @@ tr { | |
float: none; | ||
vertical-align: middle; | ||
} | ||
|
||
.hidden { | ||
display: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, please use Python 3 string formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this is merged I am going to be re-doing all of our logging...