Commit 07ac0d06 by Tom Giannattasio

styled/tweaked users page

parent 2efe4cf6
.users {
.user-overview {
@extend .window;
padding: 30px 40px;
.details {
margin-bottom: 20px;
font-size: 14px;
}
}
.new-user-button {
@include grey-button;
margin: 5px 8px;
padding: 3px 10px 4px 10px;
font-size: 12px;
.plus-icon {
position: relative;
top: 1px;
}
}
.list-header {
@include linear-gradient(top, transparent, rgba(0, 0, 0, .1));
background-color: #ced2db;
border-radius: 3px 3px 0 0;
}
.new-user-form {
display: none;
padding: 15px 20px;
background: $mediumGrey;
label {
display: inline-block;
margin-right: 10px;
}
.email-input {
width: 350px;
padding: 8px 8px 10px;
border-color: $darkGrey;
}
.add-button {
@include blue-button;
}
.cancel-button {
@include white-button;
}
}
.user-list {
border: 1px solid $mediumGrey;
border-top: none;
background: $lightGrey;
li {
position: relative;
padding: 10px 20px;
border-bottom: 1px solid $mediumGrey;
&:last-child {
border-bottom: none;
}
span {
display: inline-block;
}
.user-name {
width: 30%;
font-weight: 700;
}
.item-actions {
top: 9px;
}
}
}
}
\ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
@import "unit"; @import "unit";
@import "assets"; @import "assets";
@import "static-pages"; @import "static-pages";
@import "users";
@import "course-info"; @import "course-info";
@import "landing"; @import "landing";
@import "graphics"; @import "graphics";
......
<%inherit file="base.html" /> <%inherit file="base.html" />
<%block name="title">Course Staff Manager</%block> <%block name="title">Course Staff Manager</%block>
<%block name="bodyclass">users</%block>
<%include file="widgets/header.html"/> <%include file="widgets/header.html"/>
<%block name="content"> <%block name="content">
<section class="main-container"> <div class="main-wrapper">
<div class="inner-wrapper">
<h1>Users</h1>
<h2>Course Staff</h2> <article class="user-overview">
<div> <div class="details">
<p> <p>The following list of users have been designated as course staff. This means that these users will have permissions to modify course content. You may add additional source staff below. Please note that they must have already registered and verified their account.</p>
The following list of users have been designated as course staff. This means that these users will </div>
have permissions to modify course content. You may add additional source staff below. Please note that they <div class="list-header">
must have already registered and verified their account. <a href="#" class="new-user-button wip-box">
</p> <span class="plus-icon"></span>New User
</a>
</div>
<div class="new-user-form">
<label>email: </label><input type="text" id="email" class="email-input" autocomplete="off" placeholder="email@example.com">
<a href="#" id="add_user" class="add-button">save</a>
<a href="#" class="cancel-button">cancel</a>
</div>
<div>
<ol class="user-list">
% for user in staff:
<li>
<span class="user-name">${user.username}</span>
<span class="user-email">${user.email}</span>
<div class="item-actions">
<a href="#" class="delete-button"><span class="delete-icon"></span></a>
</div>
</li>
% endfor
</ol>
</div>
<div id="result"></div>
</article>
</div> </div>
<div> </div>
<ol>
% for user in staff:
<li>${user.email} (${user.username}) <a href='#' class='remove-user' data-id='${user.email}'>remove</a></li>
% endfor
</ol>
</div>
<label>email:&nbsp;</label><input type="text" id="email" autocomplete="Off" placeholder="email@example.com..." size="40"/>
<a href="#" id="add_user" class="button" />add as course staff</a>
<div id="result"></div>
</section>
</%block> </%block>
<%block name="jsextra"> <%block name="jsextra">
<script type="text/javascript"> <script type="text/javascript">
var $newUserForm;
function showNewUserForm(e) {
e.preventDefault();
$newUserForm.slideDown(150);
}
function hideNewUserForm(e) {
e.preventDefault();
$newUserForm.slideUp(150);
}
$(document).ready(function() { $(document).ready(function() {
$("#add_user").click(function() { $newUserForm = $('.new-user-form');
$.ajax({ $newUserForm.find('.cancel-button').bind('click', hideNewUserForm);
url: "${add_user_postback_url}",
type: "POST", $('.new-user-button').bind('click', showNewUserForm);
dataType: "json",
contentType: "application/json", $('#add_user').click(function() {
data:JSON.stringify({ 'email': $('#email').val()}), $.ajax({
}).done(function(data) { url: '${add_user_postback_url}',
if (data.ErrMsg != undefined) type: 'POST',
$("#result").empty().append(data.ErrMsg); dataType: 'json',
else contentType: 'application/json',
location.reload(); data:JSON.stringify({ 'email': $('#email').val()}),
}) }).done(function(data) {
if (data.ErrMsg != undefined)
$('#result').empty().append(data.ErrMsg);
else
location.reload();
}) })
});
$(".remove-user").click(function() { $('.remove-user').click(function() {
$.ajax({ $.ajax({
url: "${remove_user_postback_url}", url: '${remove_user_postback_url}',
type: "POST", type: 'POST',
dataType: "json", dataType: 'json',
contentType: "application/json", contentType: 'application/json',
data:JSON.stringify({ 'email': $(this).data('id')}), data:JSON.stringify({ 'email': $(this).data('id')}),
}).done(function() { }).done(function() {
location.reload(); location.reload();
}) })
}); });
}); });
</script> </script>
</%block> </%block>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment