Merge pull request #853 from MITx/feature/tomg/style-polishing
numerous style tweaks and user management page
This commit is contained in:
@@ -65,24 +65,26 @@ class CMS.Views.UnitEdit extends Backbone.View
|
||||
showNewComponentForm: (event) =>
|
||||
event.preventDefault()
|
||||
@$newComponentItem.addClass('adding')
|
||||
$(event.target).slideUp(150)
|
||||
$(event.target).fadeOut(150)
|
||||
@$newComponentItem.css('height', @$newComponentTypePicker.outerHeight())
|
||||
@$newComponentTypePicker.slideDown(250)
|
||||
|
||||
showComponentTemplates: (event) =>
|
||||
event.preventDefault()
|
||||
|
||||
type = $(event.currentTarget).data('type')
|
||||
@$newComponentTypePicker.slideUp(250)
|
||||
@$(".new-component-#{type}").slideDown(250)
|
||||
@$newComponentTypePicker.fadeOut(250)
|
||||
@$(".new-component-#{type}").fadeIn(250)
|
||||
|
||||
closeNewComponent: (event) =>
|
||||
event.preventDefault()
|
||||
|
||||
@$newComponentTypePicker.slideUp(250)
|
||||
@$newComponentTemplatePickers.slideUp(250)
|
||||
@$newComponentButton.slideDown(250)
|
||||
@$newComponentButton.fadeIn(250)
|
||||
@$newComponentItem.removeClass('adding')
|
||||
@$newComponentItem.find('.rendered-component').remove()
|
||||
@$newComponentItem.css('height', @$newComponentButton.outerHeight())
|
||||
|
||||
saveNewComponent: (event) =>
|
||||
event.preventDefault()
|
||||
|
||||
BIN
cms/static/img/html-icon.png
Normal file
BIN
cms/static/img/html-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
cms/static/img/white-drag-handles.png
Normal file
BIN
cms/static/img/white-drag-handles.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 952 B |
@@ -5,6 +5,7 @@
|
||||
padding-left: 14px;
|
||||
background-position: 8px center;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.videosequence-icon {
|
||||
|
||||
@@ -65,6 +65,7 @@ input.courseware-unit-search-input {
|
||||
.expand-collapse-icon {
|
||||
float: left;
|
||||
margin: 16px 6px 16px 16px;
|
||||
@include transition(none);
|
||||
}
|
||||
|
||||
.drag-handle {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
height: 11px;
|
||||
margin-right: 10px;
|
||||
background: url(../img/expand-collapse-icons.png) no-repeat;
|
||||
@include transition(none);
|
||||
|
||||
&.expand {
|
||||
top: 1px;
|
||||
@@ -204,6 +205,14 @@
|
||||
background: url(../img/large-slide-icon.png) center no-repeat;
|
||||
}
|
||||
|
||||
.large-html-icon {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
margin-right: 5px;
|
||||
background: url(../img/html-icon.png) center no-repeat;
|
||||
}
|
||||
|
||||
.large-textbook-icon {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
|
||||
@@ -77,4 +77,15 @@
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#login_error,
|
||||
#register_error {
|
||||
display: none;
|
||||
margin-bottom: 30px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
background: $error-red;
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@
|
||||
height: 100%;
|
||||
border-radius: 0 3px 3px 0;
|
||||
border: 1px solid #d1ddec;
|
||||
background: url(../img/drag-handles.png) center no-repeat #d1ddec;
|
||||
background: url(../img/white-drag-handles.png) center no-repeat #d1ddec;
|
||||
cursor: move;
|
||||
@include transition(all .15s);
|
||||
}
|
||||
@@ -209,7 +209,10 @@
|
||||
.new-component,
|
||||
.new-component-templates {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
@include clearfix;
|
||||
|
||||
.cancel-button {
|
||||
@include blue-button;
|
||||
@@ -379,26 +382,44 @@
|
||||
@include box-shadow(none);
|
||||
}
|
||||
|
||||
.draft-tag,
|
||||
.hidden-tag,
|
||||
.private-tag,
|
||||
.has-new-draft-tag {
|
||||
font-size: 8px;
|
||||
}
|
||||
|
||||
.window-contents > ol {
|
||||
@include tree-view;
|
||||
|
||||
.section-item {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
padding: 2px 8px 4px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
@include box-sizing(border-box);
|
||||
}
|
||||
|
||||
ol {
|
||||
.section-item {
|
||||
padding-left: 30px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.new-unit-item {
|
||||
margin-left: 30px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
ol ol {
|
||||
.section-item {
|
||||
padding-left: 50px;
|
||||
padding-left: 34px;
|
||||
}
|
||||
|
||||
.new-unit-item {
|
||||
margin: 0 0 15px 50px;
|
||||
margin: 0 0 10px 41px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
83
cms/static/sass/_users.scss
Normal file
83
cms/static/sass/_users.scss
Normal file
@@ -0,0 +1,83 @@
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
@import "unit";
|
||||
@import "assets";
|
||||
@import "static-pages";
|
||||
@import "users";
|
||||
@import "course-info";
|
||||
@import "landing";
|
||||
@import "graphics";
|
||||
|
||||
@@ -30,36 +30,37 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
function getCookie(name) {
|
||||
return $.cookie(name);
|
||||
}
|
||||
function postJSON(url, data, callback) {
|
||||
$.ajax({type:'POST',
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: callback,
|
||||
headers : {'X-CSRFToken':getCookie('csrftoken')}
|
||||
});
|
||||
}
|
||||
function getCookie(name) {
|
||||
return $.cookie(name);
|
||||
}
|
||||
function postJSON(url, data, callback) {
|
||||
$.ajax({type:'POST',
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: callback,
|
||||
headers : {'X-CSRFToken':getCookie('csrftoken')}
|
||||
});
|
||||
}
|
||||
|
||||
$('form#login_form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var submit_data = $('#login_form').serialize();
|
||||
$('form#login_form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var submit_data = $('#login_form').serialize();
|
||||
|
||||
postJSON('/login_post',
|
||||
submit_data,
|
||||
function(json) {
|
||||
if(json.success) {
|
||||
location.href="${reverse('index')}";
|
||||
postJSON('/login_post',
|
||||
submit_data,
|
||||
function(json) {
|
||||
if(json.success) {
|
||||
location.href = "${reverse('index')}";
|
||||
} else if($('#login_error').length == 0) {
|
||||
$('#login_form').prepend('<div id="login_error">Email or password is incorrect.</div>');
|
||||
$('#login_form').prepend('<div id="login_error">Email or password is incorrect.</div>');
|
||||
$('#login_error').slideDown(150);
|
||||
} else {
|
||||
$('#login_error').stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000);
|
||||
$('#login_error').stop().slideDown(150);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
})(this)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,65 +1,93 @@
|
||||
<%inherit file="base.html" />
|
||||
<%block name="title">Course Staff Manager</%block>
|
||||
<%block name="bodyclass">users</%block>
|
||||
<%include file="widgets/header.html"/>
|
||||
|
||||
<%block name="content">
|
||||
<section class="main-container">
|
||||
<div class="main-wrapper">
|
||||
<div class="inner-wrapper">
|
||||
<h1>Users</h1>
|
||||
|
||||
<h2>Course Staff</h2>
|
||||
<div>
|
||||
<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>
|
||||
<article class="user-overview">
|
||||
<div class="details">
|
||||
<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>
|
||||
</div>
|
||||
<div class="list-header">
|
||||
<a href="#" class="new-user-button wip-box">
|
||||
<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>
|
||||
<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: </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>
|
||||
</div>
|
||||
</%block>
|
||||
|
||||
<%block name="jsextra">
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#add_user").click(function() {
|
||||
$.ajax({
|
||||
url: "${add_user_postback_url}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data:JSON.stringify({ 'email': $('#email').val()}),
|
||||
}).done(function(data) {
|
||||
if (data.ErrMsg != undefined)
|
||||
$("#result").empty().append(data.ErrMsg);
|
||||
else
|
||||
location.reload();
|
||||
})
|
||||
})
|
||||
var $newUserForm;
|
||||
|
||||
$(".remove-user").click(function() {
|
||||
$.ajax({
|
||||
url: "${remove_user_postback_url}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data:JSON.stringify({ 'email': $(this).data('id')}),
|
||||
}).done(function() {
|
||||
location.reload();
|
||||
})
|
||||
});
|
||||
function showNewUserForm(e) {
|
||||
e.preventDefault();
|
||||
$newUserForm.slideDown(150);
|
||||
}
|
||||
|
||||
function hideNewUserForm(e) {
|
||||
e.preventDefault();
|
||||
$newUserForm.slideUp(150);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$newUserForm = $('.new-user-form');
|
||||
$newUserForm.find('.cancel-button').bind('click', hideNewUserForm);
|
||||
|
||||
$('.new-user-button').bind('click', showNewUserForm);
|
||||
|
||||
$('#add_user').click(function() {
|
||||
$.ajax({
|
||||
url: '${add_user_postback_url}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
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() {
|
||||
$.ajax({
|
||||
url: '${remove_user_postback_url}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data:JSON.stringify({ 'email': $(this).data('id')}),
|
||||
}).done(function() {
|
||||
location.reload();
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
@@ -81,7 +81,7 @@
|
||||
if(json.success) {
|
||||
$('#register').html(json.value);
|
||||
} else {
|
||||
$('#register_error').html(json.value).stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000);
|
||||
$('#register_error').html(json.value).stop().slideDown(150);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user