70 lines
2.0 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocol Builder Mock</title>
2020-05-24 23:05:57 -04:00
<base href="/">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.typekit.net/kwp6dli.css">
{% assets 'app_scss' %}
2020-05-24 23:05:57 -04:00
<link href="{{ base_href + ASSET_URL }}" rel="stylesheet" type="text/css">
{% endassets %}
2020-05-24 23:05:57 -04:00
<link rel="shortcut icon" href="{{ base_href + url_for('static', filename='favicon.ico') }}">
</head>
<body>
<h2>Protocol Builder Mock</h2>
<p>
<a class="btn btn-primary" href="{{ url_for('.new_study') }}"> New Study </a>
</p>
<p>
<label>User Studies</label>
<select name="uva_id" id="uva_id" onchange="selectStudies()">
<option value="">Select User</option>
<option value="all">All Users</option>
{% if users %}
{% for user in users %}
<option value="{{ user }}">{{ user }}</option>
{% endfor %}
{% endif %}
</select>
</p>
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert {{ category }}">
<span class="btn-close" onclick="hideElement(this.parentElement);">&times;</span>
{{ message|safe }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<h3>Current Studies</h3>
{{ table }}
<script>
const hideElement = (el) => {
el.classList.add('fade-out');
setTimeout(() => el.classList.add('shrink'), 250);
};
const alerts = document.getElementsByClassName('alert');
for (const alert of alerts) {
setTimeout(() => hideElement(alert), 3000);
}
</script>
<script>
function selectStudies() {
let uva_id = document.getElementById('uva_id').value;
if (uva_id == 'all') {
window.location.href = "{{base_href}}/";
} else {
window.location.href = "{{base_href}}/user_studies/" + uva_id;
}
}
</script>
</body>
</html>