Revert "fix: Remove pointless Maintenance and Announcement apps (#35852)"
This reverts commit 9274852f2d.
This commit is contained in:
83
cms/static/js/maintenance/force_publish_course.js
Normal file
83
cms/static/js/maintenance/force_publish_course.js
Normal file
@@ -0,0 +1,83 @@
|
||||
define([ // jshint ignore:line
|
||||
'jquery',
|
||||
'underscore',
|
||||
'gettext',
|
||||
'common/js/components/utils/view_utils',
|
||||
'edx-ui-toolkit/js/utils/string-utils',
|
||||
'edx-ui-toolkit/js/utils/html-utils'
|
||||
],
|
||||
function($, _, gettext, ViewUtils, StringUtils, HtmlUtils) {
|
||||
'use strict';
|
||||
|
||||
return function(maintenanceViewURL) {
|
||||
var showError;
|
||||
// Reset values
|
||||
$('#reset-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#course-id').val('');
|
||||
$('#dry-run').prop('checked', true);
|
||||
// clear out result container
|
||||
$('#result-container').html('');
|
||||
});
|
||||
|
||||
showError = function(containerElSelector, error) {
|
||||
var errorWrapperElSelector, errorHtml;
|
||||
errorWrapperElSelector = containerElSelector + ' .wrapper-error';
|
||||
errorHtml = HtmlUtils.joinHtml(
|
||||
HtmlUtils.HTML('<div class="error" aria-live="polite" id="course-id-error">'),
|
||||
error,
|
||||
HtmlUtils.HTML('</div>')
|
||||
);
|
||||
HtmlUtils.setHtml($(errorWrapperElSelector), HtmlUtils.HTML(errorHtml));
|
||||
$(errorWrapperElSelector).css('display', 'inline-block');
|
||||
$(errorWrapperElSelector).fadeOut(5000);
|
||||
};
|
||||
|
||||
$('form#force_publish').submit(function(event) {
|
||||
var attrs, forcePublishedTemplate, $submitButton, deferred, promise, data;
|
||||
event.preventDefault();
|
||||
|
||||
// clear out result container
|
||||
$('#result-container').html('');
|
||||
|
||||
$submitButton = $('#submit_force_publish');
|
||||
deferred = new $.Deferred();
|
||||
promise = deferred.promise();
|
||||
|
||||
data = $('#force_publish').serialize();
|
||||
|
||||
// disable submit button while executing.
|
||||
ViewUtils.disableElementWhileRunning($submitButton, function() { return promise; });
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: maintenanceViewURL,
|
||||
dataType: 'json',
|
||||
data: data
|
||||
})
|
||||
.done(function(response) {
|
||||
if (response.error) {
|
||||
showError('#course-id-container', response.msg);
|
||||
} else {
|
||||
if (response.msg) {
|
||||
showError('#result-error', response.msg);
|
||||
} else {
|
||||
attrs = $.extend({}, response, {StringUtils: StringUtils});
|
||||
forcePublishedTemplate = HtmlUtils.template(
|
||||
$('#force-published-course-response-tpl').text()
|
||||
);
|
||||
HtmlUtils.setHtml($('#result-container'), forcePublishedTemplate(attrs));
|
||||
}
|
||||
}
|
||||
})
|
||||
.fail(function() {
|
||||
// response.responseText here because it would show some strange output, it may output Traceback
|
||||
// sometimes if unexpected issue arises. Better to show just internal error when getting 500 error.
|
||||
showError('#result-error', gettext('Internal Server Error.'));
|
||||
})
|
||||
.always(function() {
|
||||
deferred.resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -77,6 +77,7 @@
|
||||
@import 'views/group-configuration';
|
||||
@import 'views/video-upload';
|
||||
@import 'views/certificates';
|
||||
@import 'views/maintenance';
|
||||
|
||||
// +Base - Contexts
|
||||
// ====================
|
||||
|
||||
104
cms/static/sass/views/_maintenance.scss
Normal file
104
cms/static/sass/views/_maintenance.scss
Normal file
@@ -0,0 +1,104 @@
|
||||
.maintenance-header {
|
||||
text-align: center;
|
||||
margin-top: 50px;
|
||||
|
||||
h2 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.maintenance-content {
|
||||
padding: 3rem 0;
|
||||
|
||||
.maintenance-list {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
|
||||
.view-list-container {
|
||||
padding: 10px 15px;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ddd;
|
||||
|
||||
&:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.view-name {
|
||||
display: inline-block;
|
||||
width: 20%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.view-desc {
|
||||
display: inline-block;
|
||||
width: 80%;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.maintenance-form {
|
||||
width: 60%;
|
||||
margin: auto;
|
||||
|
||||
.result-list {
|
||||
height: calc(100vh - 200px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.result {
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
margin-top: 15px;
|
||||
padding: 15px 30px;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
|
||||
li {
|
||||
font-size: 13px;
|
||||
line-height: 9px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.field-radio div {
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
div.error {
|
||||
color: #f00;
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
div.head-output {
|
||||
font-size: 13px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
div.main-output {
|
||||
color: #0a0;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.announcement-container {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
.announcement-item {
|
||||
display: inline-block;
|
||||
max-width: 300px;
|
||||
min-width: 300px;
|
||||
margin: 15px;
|
||||
|
||||
.announcement-content {
|
||||
background-color: $body-bg;
|
||||
text-align: center;
|
||||
padding: 22px 33px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user