Commit dc062f56 by Calen Pennington

Make edit and delete buttons show up on cms unit editing page

parent f53217e5
...@@ -131,7 +131,6 @@ def edit_item(request, location): ...@@ -131,7 +131,6 @@ def edit_item(request, location):
raise Http404 # TODO (vshnayder): better error raise Http404 # TODO (vshnayder): better error
item = modulestore().get_item(location) item = modulestore().get_item(location)
item.get_html = wrap_xmodule(item.get_html, item, "xmodule_edit.html")
if settings.LMS_BASE is not None: if settings.LMS_BASE is not None:
lms_link = "{lms_base}/courses/{course_id}/jump_to/{location}".format( lms_link = "{lms_base}/courses/{course_id}/jump_to/{location}".format(
...@@ -322,8 +321,18 @@ def load_preview_module(request, preview_id, descriptor, instance_state, shared_ ...@@ -322,8 +321,18 @@ def load_preview_module(request, preview_id, descriptor, instance_state, shared_
error_msg=exc_info_to_str(sys.exc_info()) error_msg=exc_info_to_str(sys.exc_info())
).xmodule_constructor(system)(None, None) ).xmodule_constructor(system)(None, None)
module.get_html = wrap_xmodule(module.get_html, module, "xmodule_display.html")
module.get_html = wrap_xmodule(module.get_html, module, "editable_preview.html") module.get_html = wrap_xmodule(
module.get_html,
module,
"xmodule_edit.html",
{
'editor_content': descriptor.get_html(),
# TODO (cpennington): Make descriptors know if they have data that can be editng
'editable_data': descriptor.definition.get('data'),
'editable_class': 'editable' if descriptor.definition.get('data') else '',
}
)
module.get_html = replace_static_urls( module.get_html = replace_static_urls(
module.get_html, module.get_html,
module.metadata.get('data_dir', module.location.course) module.metadata.get('data_dir', module.location.course)
......
...@@ -17,7 +17,7 @@ $(document).ready(function() { ...@@ -17,7 +17,7 @@ $(document).ready(function() {
$('.expand-collapse-icon').bind('click', toggleSubmodules); $('.expand-collapse-icon').bind('click', toggleSubmodules);
$('.visibility-options').bind('change', setVisibility); $('.visibility-options').bind('change', setVisibility);
$body.delegate('.components .edit-button', 'click', editComponent); $body.delegate('.xmodule_edit .edit-button', 'click', editComponent);
$body.delegate('.component-editor .save-button, .component-editor .cancel-button', 'click', closeComponentEditor); $body.delegate('.component-editor .save-button, .component-editor .cancel-button', 'click', closeComponentEditor);
$newComponentButton.bind('click', showNewComponentForm); $newComponentButton.bind('click', showNewComponentForm);
...@@ -45,12 +45,12 @@ function setVisibility(e) { ...@@ -45,12 +45,12 @@ function setVisibility(e) {
function editComponent(e) { function editComponent(e) {
e.preventDefault(); e.preventDefault();
$(this).closest('li').addClass('editing').find('.component-editor').slideDown(150); $(this).closest('.xmodule_edit').addClass('editing').find('.component-editor').slideDown(150);
} }
function closeComponentEditor(e) { function closeComponentEditor(e) {
e.preventDefault(); e.preventDefault();
$(this).closest('li').removeClass('editing').find('.component-editor').slideUp(150); $(this).closest('.xmodule_edit').removeClass('editing').find('.component-editor').slideUp(150);
} }
function showNewComponentForm(e) { function showNewComponentForm(e) {
......
...@@ -33,132 +33,132 @@ $error-red: rgb(253, 87, 87); ...@@ -33,132 +33,132 @@ $error-red: rgb(253, 87, 87);
// ------------------------------------- // -------------------------------------
// //
// Universal // Universal
// //
// ------------------------------------- // -------------------------------------
body { body {
min-width: 980px; min-width: 980px;
background: #f3f4f5; background: #f3f4f5;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: 16px; font-size: 16px;
line-height: 1.6; line-height: 1.6;
color: #3c3c3c; color: #3c3c3c;
} }
a { a {
text-decoration: none; text-decoration: none;
color: $blue; color: $blue;
-webkit-transition: color .15s; -webkit-transition: color .15s;
&:hover { &:hover {
color: #cb9c40; color: #cb9c40;
} }
} }
h1 { h1 {
font-size: 28px; font-size: 28px;
margin: 36px 6px; margin: 36px 6px;
} }
.main-wrapper { .main-wrapper {
position: relative; position: relative;
margin: 0 40px; margin: 0 40px;
} }
.inner-wrapper { .inner-wrapper {
position: relative; position: relative;
max-width: 1280px; max-width: 1280px;
margin: auto; margin: auto;
} }
.window { .window {
background: #fff; background: #fff;
border: 1px solid #8891a1; border: 1px solid #8891a1;
border-radius: 3px; border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
} }
.sidebar { .sidebar {
float: right; float: right;
width: 28%; width: 28%;
} }
footer { footer {
clear: both; clear: both;
height: 100px; height: 100px;
} }
input[type="text"] { input[type="text"] {
padding: 6px 8px 8px; padding: 6px 8px 8px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #b0b6c2; border: 1px solid #b0b6c2;
border-radius: 2px; border-radius: 2px;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, .3)) #edf1f5; background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, .3)) #edf1f5;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1) inset; box-shadow: 0 1px 2px rgba(0, 0, 0, .1) inset;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: 11px; font-size: 11px;
color: #3c3c3c; color: #3c3c3c;
outline: 0; outline: 0;
&::-webkit-input-placeholder { &::-webkit-input-placeholder {
color: #979faf; color: #979faf;
} }
} }
input.search { input.search {
padding: 6px 15px 8px 30px; padding: 6px 15px 8px 30px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #b0b6c2; border: 1px solid #b0b6c2;
border-radius: 20px; border-radius: 20px;
background: url(../img/search-icon.png) no-repeat 8px 7px #edf1f5; background: url(../img/search-icon.png) no-repeat 8px 7px #edf1f5;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
color: #3c3c3c; color: #3c3c3c;
outline: 0; outline: 0;
&::-webkit-input-placeholder { &::-webkit-input-placeholder {
color: #979faf; color: #979faf;
} }
} }
label { label {
font-size: 12px; font-size: 12px;
} }
@mixin blue-button { @mixin blue-button {
display: inline-block; display: inline-block;
padding: 4px 20px 6px; padding: 4px 20px 6px;
border: 1px solid #437fbf; border: 1px solid #437fbf;
border-radius: 3px; border-radius: 3px;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) $blue; background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) $blue;
box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
color: #fff; color: #fff;
} }
@mixin white-button { @mixin white-button {
display: inline-block; display: inline-block;
padding: 4px 20px 6px; padding: 4px 20px 6px;
border: 1px solid #8891a1; border: 1px solid #8891a1;
border-radius: 3px; border-radius: 3px;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%) #dfe5eb; background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%) #dfe5eb;
box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
color: #8891a1; color: #8891a1;
} }
@mixin orange-button { @mixin orange-button {
display: inline-block; display: inline-block;
padding: 4px 20px 6px; padding: 4px 20px 6px;
border: 1px solid #3c3c3c; border: 1px solid #3c3c3c;
border-radius: 3px; border-radius: 3px;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 60%) #edbd3c; background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 60%) #edbd3c;
box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
color: #3c3c3c; color: #3c3c3c;
} }
...@@ -167,7 +167,7 @@ label { ...@@ -167,7 +167,7 @@ label {
// ------------------------------------- // -------------------------------------
// //
// Courseware // Courseware
// //
// ------------------------------------- // -------------------------------------
...@@ -180,276 +180,276 @@ label { ...@@ -180,276 +180,276 @@ label {
} }
input.courseware-unit-search-input { input.courseware-unit-search-input {
position: absolute; position: absolute;
right: 0; right: 0;
top: 5px; top: 5px;
width: 260px; width: 260px;
background-color: #fff; background-color: #fff;
} }
.courseware-overview { .courseware-overview {
.new-courseware-section-button { .new-courseware-section-button {
display: block; display: block;
padding: 12px 0; padding: 12px 0;
border-radius: 3px; border-radius: 3px;
border: 1px solid #8891a1; border: 1px solid #8891a1;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) #d1dae3; background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) #d1dae3;
font-size: 14px; font-size: 14px;
font-weight: 700; font-weight: 700;
text-align: center; text-align: center;
color: #6d788b; color: #6d788b;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
} }
} }
.courseware-section { .courseware-section {
position: relative; position: relative;
background: #fff; background: #fff;
border: 1px solid #8891a1; border: 1px solid #8891a1;
border-radius: 3px; border-radius: 3px;
margin: 10px 0; margin: 10px 0;
padding-bottom: 12px; padding-bottom: 12px;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
&.collapsed { &.collapsed {
padding-bottom: 0; padding-bottom: 0;
header { header {
height: 47px; height: 47px;
} }
h4 { h4 {
display: none; display: none;
} }
} }
&.collapsed > ol, &.collapsed > ol,
.collapsed > ol { .collapsed > ol {
display: none; display: none;
} }
.publish-date { .publish-date {
position: absolute; position: absolute;
left: -60px; left: -60px;
top: 0; top: 0;
width: 40px; width: 40px;
height: 40px; height: 40px;
background: url(../img/date-circle.png) no-repeat; background: url(../img/date-circle.png) no-repeat;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
.month, .month,
.day { .day {
position: absolute; position: absolute;
display: block; display: block;
width: 40px; width: 40px;
line-height: 0; line-height: 0;
} }
.month { .month {
top: 10px; top: 10px;
font-size: 9px; font-size: 9px;
font-weight: 700; font-weight: 700;
color: #f3f4f5; color: #f3f4f5;
} }
.day { .day {
top: 25px; top: 25px;
font-size: 16px; font-size: 16px;
font-weight: 700; font-weight: 700;
color: #b0b6c2; color: #b0b6c2;
} }
} }
header { header {
height: 67px; height: 67px;
.item-actions { .item-actions {
margin-top: 11px; margin-top: 11px;
margin-right: 12px; margin-right: 12px;
.edit-button, .edit-button,
.delete-button { .delete-button {
margin-top: -3px; margin-top: -3px;
} }
} }
.expand-collapse-icon { .expand-collapse-icon {
float: left; float: left;
margin: 16px 6px 16px 16px; margin: 16px 6px 16px 16px;
} }
.drag-handle { .drag-handle {
margin-left: 19px; margin-left: 19px;
} }
} }
h3 { h3 {
font-size: 16px; font-size: 16px;
font-weight: 700; font-weight: 700;
color: $blue; color: $blue;
} }
h4 { h4 {
font-size: 12px; font-size: 12px;
color: #878e9d; color: #878e9d;
strong { strong {
font-weight: 700; font-weight: 700;
} }
} }
> ol { > ol {
margin: 0 12px; margin: 0 12px;
border: 1px solid #ced2db; border: 1px solid #ced2db;
} }
ol { ol {
.section-item { .section-item {
display: block; display: block;
padding: 6px 8px 8px 16px; padding: 6px 8px 8px 16px;
background: #edf1f5; background: #edf1f5;
font-size: 13px; font-size: 13px;
&:hover { &:hover {
background: #fffcf1; background: #fffcf1;
.item-actions { .item-actions {
display: block; display: block;
} }
} }
&.new-unit-item { &.new-unit-item {
font-weight: 700; font-weight: 700;
color: #6d788b; color: #6d788b;
&:hover { &:hover {
background: #d1dae3; background: #d1dae3;
} }
} }
.draft-item { .draft-item {
color: #a4aab7; color: #a4aab7;
} }
.item-actions { .item-actions {
display: none; display: none;
} }
} }
a { a {
color: #2c2e33; color: #2c2e33;
} }
} }
ol ol { ol ol {
.section-item { .section-item {
padding-left: 56px; padding-left: 56px;
} }
} }
ol ol ol { ol ol ol {
.section-item { .section-item {
padding-left: 96px; padding-left: 96px;
} }
} }
} }
.item-actions { .item-actions {
float: right; float: right;
.edit-button, .edit-button,
.delete-button { .delete-button {
float: left; float: left;
margin-right: 6px; margin-right: 6px;
color: #a4aab7; color: #a4aab7;
} }
} }
.item-details { .item-details {
float: left; float: left;
padding: 10px 0; padding: 10px 0;
} }
.unit-library { .unit-library {
float: right; float: right;
width: 28%; width: 28%;
padding-bottom: 12px; padding-bottom: 12px;
border: 1px solid #8891a1; border: 1px solid #8891a1;
border-radius: 3px; border-radius: 3px;
background: #fff; background: #fff;
box-shadow: 0 1px 2px rgba(0, 0, 0, .1); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
h2 { h2 {
font-weight: 700; font-weight: 700;
margin: 14px; margin: 14px;
} }
.list-search { .list-search {
margin: 0 12px 8px; margin: 0 12px 8px;
} }
.list-search-input { .list-search-input {
width: 100%; width: 100%;
padding: 6px 15px 8px 30px; padding: 6px 15px 8px 30px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #b0b6c2; border: 1px solid #b0b6c2;
border-radius: 20px; border-radius: 20px;
background: url(../img/search-icon.png) no-repeat 8px 7px #edf1f5; background: url(../img/search-icon.png) no-repeat 8px 7px #edf1f5;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
color: #3c3c3c; color: #3c3c3c;
outline: 0; outline: 0;
&::-webkit-input-placeholder { &::-webkit-input-placeholder {
color: #979faf; color: #979faf;
} }
} }
.list-wrapper { .list-wrapper {
height: 500px; height: 500px;
margin: 0 12px; margin: 0 12px;
border: 1px solid #ced2db; border: 1px solid #ced2db;
overflow-y: scroll; overflow-y: scroll;
} }
ul { ul {
.section-item { .section-item {
display: block; display: block;
padding: 6px 8px 8px 10px; padding: 6px 8px 8px 10px;
background: #edf1f5; background: #edf1f5;
font-size: 13px; font-size: 13px;
&:hover { &:hover {
background: #fffcf1; background: #fffcf1;
.item-actions { .item-actions {
display: block; display: block;
} }
} }
&.new-unit-item { &.new-unit-item {
font-weight: 700; font-weight: 700;
color: #6d788b; color: #6d788b;
&:hover { &:hover {
background: #d1dae3; background: #d1dae3;
} }
} }
.item-actions { .item-actions {
display: none; display: none;
} }
} }
a { a {
color: #2c2e33; color: #2c2e33;
} }
} }
} }
...@@ -458,341 +458,339 @@ input.courseware-unit-search-input { ...@@ -458,341 +458,339 @@ input.courseware-unit-search-input {
// ------------------------------------- // -------------------------------------
// //
// Unit Editor // Unit Editor
// //
// ------------------------------------- // -------------------------------------
.unit .main-wrapper { .unit .main-wrapper {
margin: 40px; margin: 40px;
} }
.unit-body { .unit-body {
float: left; float: left;
width: 70%; width: 70%;
.breadcrumbs { .breadcrumbs {
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
border-bottom: 1px solid #cbd1db; border-bottom: 1px solid #cbd1db;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 70%) #edf1f5; background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 70%) #edf1f5;
box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
@include clearfix; @include clearfix;
li { li {
float: left; float: left;
} }
a, a,
.current-page { .current-page {
display: block; display: block;
padding: 15px 35px 15px 30px; padding: 15px 35px 15px 30px;
font-size: 14px; font-size: 14px;
background: url(../img/breadcrumb-arrow.png) no-repeat right center; background: url(../img/breadcrumb-arrow.png) no-repeat right center;
} }
} }
h2 { h2 {
margin: 30px 40px; margin: 30px 40px;
color: #646464; color: #646464;
font-size: 19px; font-size: 19px;
font-weight: 300; font-weight: 300;
letter-spacing: 1px; letter-spacing: 1px;
text-transform: uppercase; text-transform: uppercase;
} }
.components { .edit-pane {
> li { .xmodule_edit.editable {
position: relative; position: relative;
z-index: 10; border: 1px solid transparent;
margin: 20px 40px; z-index: 10;
border: 1px solid #d1ddec;
border-radius: 3px; &:hover {
background: #fff; border-color: #6696d7;
-webkit-transition: border-color .15s; border: 1px solid #d1ddec;
border-radius: 3px;
&:hover { -webkit-transition: border-color .15s;
border-color: #6696d7;
> .component-actions {
.drag-handle, opacity: 1;
.component-actions { }
opacity: 1; }
}
} &.editing {
border-color: #6696d7;
&.editing {
border-color: #6696d7; &:hover {
.drag-handle,
&:hover { .component-actions {
.drag-handle, opacity: 0;
.component-actions { }
opacity: 0; }
} }
}
} .rendered-component {
padding: 20px;
.rendered-component { }
padding: 20px;
} .component-actions {
position: absolute;
.component-actions { top: 4px;
position: absolute; right: 4px;
top: 4px; opacity: 0;
right: 4px; -webkit-transition: opacity .15s;
opacity: 0; }
-webkit-transition: opacity .15s;
} .edit-button,
.delete-button {
.edit-button, float: left;
.delete-button { padding: 3px 10px 4px;
float: left; margin-left: 3px;
padding: 3px 10px 4px; border: 1px solid #fff;
margin-left: 3px; border-radius: 3px;
border: 1px solid #fff; background: $blue;
border-radius: 3px; font-size: 12px;
background: $blue; color: #fff;
font-size: 12px; -webkit-transition: all .15s;
color: #fff;
-webkit-transition: all .15s; &:hover {
background-color: $blue;
&:hover { color: #fff;
background-color: $blue; }
color: #fff;
} .edit-icon,
.delete-icon {
.edit-icon, margin-right: 4px;
.delete-icon { }
margin-right: 4px; }
}
} .drag-handle {
position: absolute;
.drag-handle { display: block;
position: absolute; top: -1px;
display: block; right: -16px;
top: -1px; z-index: -1;
right: -16px; width: 15px;
z-index: -1; height: 100%;
width: 15px; border-radius: 0 3px 3px 0;
height: 100%; border: 1px solid $blue;
border-radius: 0 3px 3px 0; background: url(../img/drag-handles.png) center no-repeat $blue;
border: 1px solid $blue; cursor: move;
background: url(../img/drag-handles.png) center no-repeat $blue; opacity: 0;
cursor: move; -webkit-transition: opacity .15s;
opacity: 0; }
-webkit-transition: opacity .15s;
} &.new-component-item {
padding: 0;
&.new-component-item { border: 1px solid #8891a1;
padding: 0; border-radius: 3px;
border: 1px solid #8891a1; background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) #d1dae3;
border-radius: 3px; box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)) #d1dae3; -webkit-transition: background-color .15s, border-color .15s;
box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset;
-webkit-transition: background-color .15s, border-color .15s; &.adding {
background-color: $blue;
&.adding { border-color: #437fbf;
background-color: $blue; }
border-color: #437fbf;
} .new-component-button {
display: block;
.new-component-button { padding: 20px;
display: block; text-align: center;
padding: 20px; color: #6d788b;
text-align: center; }
color: #6d788b;
} h5 {
margin-bottom: 8px;
h5 { color: #fff;
margin-bottom: 8px; font-weight: 700;
color: #fff; }
font-weight: 700;
} .rendered-component {
display: none;
.rendered-component { background: #fff;
display: none; border-radius: 3px 3px 0 0;
background: #fff; }
border-radius: 3px 3px 0 0;
} .new-component-type {
@include clearfix;
.new-component-type {
@include clearfix; a {
position: relative;
a { float: left;
position: relative; width: 100px;
float: left; height: 100px;
width: 100px; margin-right: 10px;
height: 100px; border-radius: 8px;
margin-right: 10px; font-size: 13px;
border-radius: 8px; line-height: 14px;
font-size: 13px; color: #fff;
line-height: 14px; text-align: center;
color: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 1px 0 rgba(255, 255, 255, .4) inset;
text-align: center; -webkit-transition: background-color .15s;
box-shadow: 0 1px 1px rgba(0, 0, 0, .4), 0 1px 0 rgba(255, 255, 255, .4) inset;
-webkit-transition: background-color .15s; &:hover {
background-color: rgba(255, 255, 255, .2);
&:hover { }
background-color: rgba(255, 255, 255, .2);
} .name {
position: absolute;
.name { bottom: 5px;
position: absolute; left: 0;
bottom: 5px; width: 100%;
left: 0; padding: 10px;
width: 100%; box-sizing: border-box;
padding: 10px; }
box-sizing: border-box; }
} }
}
} .new-component-step-1,
.new-component-step-2 {
.new-component-step-1, display: none;
.new-component-step-2 { padding: 20px;
display: none; }
padding: 20px; }
} }
}
} .video-unit img,
.discussion-unit img {
.video-unit img, width: 100%;
.discussion-unit img { }
width: 100%; }
}
} .component-editor,
.new-component-step-2 {
.component-editor, display: none;
.new-component-step-2 { padding: 20px;
display: none; background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .1)) $blue;
padding: 20px;
background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .1)) $blue; h5 {
margin-bottom: 8px;
h5 { color: #fff;
margin-bottom: 8px; font-weight: 700;
color: #fff; }
font-weight: 700;
} textarea {
width: 100%;
textarea { min-height: 80px;
width: 100%; padding: 10px;
min-height: 80px; box-sizing: border-box;
padding: 10px; border: 1px solid #3c3c3c;
box-sizing: border-box; font-family: Monaco, monospace;
border: 1px solid #3c3c3c; }
font-family: Monaco, monospace;
} .save-button {
@include orange-button;
.save-button { margin-right: 8px;
@include orange-button; }
margin-right: 8px;
} .cancel-button {
@include blue-button;
.cancel-button { border-color: #30649c;
@include blue-button; }
border-color: #30649c; }
}
}
} }
.unit-properties, .unit-properties,
.unit-history { .unit-history {
margin-bottom: 20px; margin-bottom: 20px;
.window-contents { .window-contents {
padding: 20px; padding: 20px;
} }
h4 { h4 {
padding: 6px 14px; padding: 6px 14px;
border-bottom: 1px solid #cbd1db; border-bottom: 1px solid #cbd1db;
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 70%) #edf1f5; background: -webkit-linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 70%) #edf1f5;
box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset; box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
} }
.row { .row {
margin-bottom: 15px; margin-bottom: 15px;
} }
input[type="text"] { input[type="text"] {
display: block; display: block;
width: 100%; width: 100%;
} }
.visibility-options .option { .visibility-options .option {
margin-right: 10px; margin-right: 10px;
padding: 3px 13px 6px; padding: 3px 13px 6px;
border-radius: 3px; border-radius: 3px;
background: #edf1f5; background: #edf1f5;
&.checked { &.checked {
background: #d1dae3; background: #d1dae3;
} }
input[type="radio"] { input[type="radio"] {
margin-right: 7px; margin-right: 7px;
} }
} }
.save-button { .save-button {
@include blue-button; @include blue-button;
margin-top: 10px; margin-top: 10px;
} }
.publish-button { .publish-button {
@include orange-button; @include orange-button;
margin-top: 10px; margin-top: 10px;
border-color: #bda046; border-color: #bda046;
} }
} }
.unit-properties { .unit-properties {
.window-contents { .window-contents {
padding: 10px 20px; padding: 10px 20px;
} }
} }
.unit-history { .unit-history {
&.collapsed { &.collapsed {
h4 { h4 {
border-bottom: none; border-bottom: none;
border-radius: 3px; border-radius: 3px;
} }
.window-contents { .window-contents {
display: none; display: none;
} }
} }
ol { ol {
border: 1px solid #ced2db; border: 1px solid #ced2db;
li { li {
display: block; display: block;
padding: 6px 8px 8px 10px; padding: 6px 8px 8px 10px;
background: #edf1f5; background: #edf1f5;
font-size: 12px; font-size: 12px;
&:hover { &:hover {
background: #fffcf1; background: #fffcf1;
.item-actions { .item-actions {
display: block; display: block;
} }
} }
&.checked { &.checked {
background: #d1dae3; background: #d1dae3;
} }
.item-actions { .item-actions {
display: none; display: none;
} }
input[type="radio"] { input[type="radio"] {
margin-right: 7px; margin-right: 7px;
} }
} }
} }
} }
...@@ -801,144 +799,144 @@ input.courseware-unit-search-input { ...@@ -801,144 +799,144 @@ input.courseware-unit-search-input {
// ------------------------------------- // -------------------------------------
// //
// Icons / Tags // Icons / Tags
// //
// ------------------------------------- // -------------------------------------
.expand-collapse-icon { .expand-collapse-icon {
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 9px; width: 9px;
height: 11px; height: 11px;
margin-right: 10px; margin-right: 10px;
background: url(../img/expand-collapse-icons.png) no-repeat; background: url(../img/expand-collapse-icons.png) no-repeat;
&.expand { &.expand {
top: 1px; top: 1px;
background-position: 0 0; background-position: 0 0;
} }
&.collapse { &.collapse {
top: -1px; top: -1px;
background-position: 0 -11px; background-position: 0 -11px;
} }
} }
.edit-icon { .edit-icon {
display: inline-block; display: inline-block;
width: 12px; width: 12px;
height: 12px; height: 12px;
margin-right: 2px; margin-right: 2px;
background: url(../img/edit-icon.png) no-repeat; background: url(../img/edit-icon.png) no-repeat;
&.white { &.white {
background: url(../img/edit-icon-white.png) no-repeat; background: url(../img/edit-icon-white.png) no-repeat;
} }
} }
.delete-icon { .delete-icon {
display: inline-block; display: inline-block;
width: 10px; width: 10px;
height: 11px; height: 11px;
margin-right: 2px; margin-right: 2px;
background: url(../img/delete-icon.png) no-repeat; background: url(../img/delete-icon.png) no-repeat;
&.white { &.white {
background: url(../img/delete-icon-white.png) no-repeat; background: url(../img/delete-icon-white.png) no-repeat;
} }
} }
.drag-handle { .drag-handle {
display: inline-block; display: inline-block;
float: right; float: right;
width: 7px; width: 7px;
height: 22px; height: 22px;
margin-left: 10px; margin-left: 10px;
background: url(../img/drag-handles.png) no-repeat; background: url(../img/drag-handles.png) no-repeat;
cursor: move; cursor: move;
} }
.draft-tag, .draft-tag,
.publish-flag { .publish-flag {
margin-left: 3px; margin-left: 3px;
font-size: 9px; font-size: 9px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
color: #a4aab7; color: #a4aab7;
} }
.plus-icon { .plus-icon {
display: inline-block; display: inline-block;
width: 11px; width: 11px;
height: 11px; height: 11px;
margin-right: 8px; margin-right: 8px;
background: url(../img/plus-icon.png) no-repeat; background: url(../img/plus-icon.png) no-repeat;
} }
.textbook-icon { .textbook-icon {
display: inline-block; display: inline-block;
width: 32px; width: 32px;
height: 32px; height: 32px;
margin-right: 8px; margin-right: 8px;
vertical-align: middle; vertical-align: middle;
background: url(../img/textbook-icon.png) no-repeat; background: url(../img/textbook-icon.png) no-repeat;
} }
.slides-icon { .slides-icon {
display: inline-block; display: inline-block;
width: 32px; width: 32px;
height: 32px; height: 32px;
margin-right: 8px; margin-right: 8px;
vertical-align: middle; vertical-align: middle;
background: url(../img/slides-icon.png) no-repeat; background: url(../img/slides-icon.png) no-repeat;
} }
.large-slide-icon { .large-slide-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-slide-icon.png) center no-repeat; background: url(../img/large-slide-icon.png) center no-repeat;
} }
.large-textbook-icon { .large-textbook-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-textbook-icon.png) center no-repeat; background: url(../img/large-textbook-icon.png) center no-repeat;
} }
.large-discussion-icon { .large-discussion-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-discussion-icon.png) center no-repeat; background: url(../img/large-discussion-icon.png) center no-repeat;
} }
.large-freeform-icon { .large-freeform-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-freeform-icon.png) center no-repeat; background: url(../img/large-freeform-icon.png) center no-repeat;
} }
.large-problem-icon { .large-problem-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-problem-icon.png) center no-repeat; background: url(../img/large-problem-icon.png) center no-repeat;
} }
.large-video-icon { .large-video-icon {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
height: 60px; height: 60px;
margin-right: 5px; margin-right: 5px;
background: url(../img/large-video-icon.png) center no-repeat; background: url(../img/large-video-icon.png) center no-repeat;
} }
...@@ -946,65 +944,65 @@ input.courseware-unit-search-input { ...@@ -946,65 +944,65 @@ input.courseware-unit-search-input {
// ------------------------------------- // -------------------------------------
// //
// Modal // Modal
// //
// ------------------------------------- // -------------------------------------
.modal-cover { .modal-cover {
display: none; display: none;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 1000; z-index: 1000;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0, 0, 0, .8); background: rgba(0, 0, 0, .8);
} }
.history-modal { .history-modal {
display: none; display: none;
position: fixed; position: fixed;
top: 60px; top: 60px;
left: 50%; left: 50%;
z-index: 1001; z-index: 1001;
width: 930px; width: 930px;
height: 540px; height: 540px;
margin-left: -465px; margin-left: -465px;
background: #fff; background: #fff;
.modal-body { .modal-body {
height: 400px; height: 400px;
padding: 40px; padding: 40px;
overflow-y: scroll; overflow-y: scroll;
} }
.modal-actions { .modal-actions {
height: 60px; height: 60px;
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0)) #d1dae3; background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0)) #d1dae3;
} }
h2 { h2 {
margin: 0 10px 30px; margin: 0 10px 30px;
color: #646464; color: #646464;
font-size: 19px; font-size: 19px;
font-weight: 300; font-weight: 300;
letter-spacing: 1px; letter-spacing: 1px;
text-transform: uppercase; text-transform: uppercase;
} }
p { p {
margin: 20px; margin: 20px;
} }
.revert-button { .revert-button {
@include blue-button; @include blue-button;
margin: 13px 6px 0 13px; margin: 13px 6px 0 13px;
} }
.close-button { .close-button {
@include white-button; @include white-button;
margin-top: 13px; margin-top: 13px;
} }
} }
...@@ -12,7 +12,7 @@ from xmodule.vertical_module import VerticalModule ...@@ -12,7 +12,7 @@ from xmodule.vertical_module import VerticalModule
log = logging.getLogger("mitx.xmodule_modifiers") log = logging.getLogger("mitx.xmodule_modifiers")
def wrap_xmodule(get_html, module, template): def wrap_xmodule(get_html, module, template, context=None):
""" """
Wraps the results of get_html in a standard <section> with identifying Wraps the results of get_html in a standard <section> with identifying
data so that the appropriate javascript module can be loaded onto it. data so that the appropriate javascript module can be loaded onto it.
...@@ -24,14 +24,18 @@ def wrap_xmodule(get_html, module, template): ...@@ -24,14 +24,18 @@ def wrap_xmodule(get_html, module, template):
class_: the module class name class_: the module class name
module_name: the js_module_name of the module module_name: the js_module_name of the module
""" """
if context is None:
context = {}
@wraps(get_html) @wraps(get_html)
def _get_html(): def _get_html():
return render_to_string(template, { context.update({
'content': get_html(), 'content': get_html(),
'class_': module.__class__.__name__, 'class_': module.__class__.__name__,
'module_name': module.js_module_name 'module_name': module.js_module_name
}) })
return render_to_string(template, context)
return _get_html return _get_html
......
...@@ -12,7 +12,7 @@ from .x_module import XModuleDescriptor ...@@ -12,7 +12,7 @@ from .x_module import XModuleDescriptor
def write_module_styles(output_root, extra_descriptors): def write_module_styles(output_root, extra_descriptors):
return _write_styles(output_root, _list_modules(extra_descriptors)) return _write_styles('.xmodule_display', output_root, _list_modules(extra_descriptors))
def write_module_js(output_root, extra_descriptors): def write_module_js(output_root, extra_descriptors):
...@@ -20,7 +20,7 @@ def write_module_js(output_root, extra_descriptors): ...@@ -20,7 +20,7 @@ def write_module_js(output_root, extra_descriptors):
def write_descriptor_styles(output_root, extra_descriptors): def write_descriptor_styles(output_root, extra_descriptors):
return _write_styles(output_root, _list_descriptors(extra_descriptors)) return _write_styles('.xmodule_edit', output_root, _list_descriptors(extra_descriptors))
def write_descriptor_js(output_root, extra_descriptors): def write_descriptor_js(output_root, extra_descriptors):
...@@ -53,7 +53,7 @@ def _ensure_dir(dir_): ...@@ -53,7 +53,7 @@ def _ensure_dir(dir_):
raise raise
def _write_styles(output_root, classes): def _write_styles(selector, output_root, classes):
_ensure_dir(output_root) _ensure_dir(output_root)
css_fragments = defaultdict(set) css_fragments = defaultdict(set)
...@@ -78,8 +78,8 @@ def _write_styles(output_root, classes): ...@@ -78,8 +78,8 @@ def _write_styles(output_root, classes):
with open(output_root / '_module-styles.scss', 'w') as module_styles: with open(output_root / '_module-styles.scss', 'w') as module_styles:
for class_, fragment_names in css_imports.items(): for class_, fragment_names in css_imports.items():
imports = "\n".join('@import "{0}";'.format(name) for name in fragment_names) imports = "\n".join('@import "{0}";'.format(name) for name in fragment_names)
module_styles.write(""".xmodule_{class_} {{ {imports} }}""".format( module_styles.write("""{selector}.xmodule_{class_} {{ {imports} }}""".format(
class_=class_, imports=imports class_=class_, imports=imports, selector=selector
)) ))
......
<section class="xmodule_edit xmodule_${class_}" data-type="${module_name}"> <div class="xmodule_edit xmodule_${class_} ${editable_class}" data-type="${module_name}">
${content} <%include file="xmodule_display.html"/>
</section> % if editable_data:
<div class="component-actions">
<a href="#" class="edit-button"><span class="edit-icon white"></span>Edit</a>
<a href="#" class="delete-button"><span class="delete-icon white"></span>Delete</a>
</div>
<div class="component-editor">
${editor_content}
<a href="#" class="save-button">Save</a>
<a href="#" class="cancel-button">Cancel</a>
</div>
% endif
</div>
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