Commit 1a179289 by Asad Iqbal Committed by GitHub

Merge pull request #13220 from edx/asadiqbal08/OLIVE-75

OLIVE-75 - CourseID Term not rendering correctly.
parents fa136937 1e938162
......@@ -67,6 +67,23 @@ define(['domReady', 'jquery', 'underscore', 'js/utils/cancel_on_escape', 'js/vie
});
};
var rtlTextDirection = function() {
var Selectors = {
new_course_run: '#new-course-run'
};
if ($('body').hasClass('rtl')) {
$(Selectors.new_course_run).addClass('course-run-text-direction placeholder-text-direction');
$(Selectors.new_course_run).on('input', function() {
if (this.value === '') {
$(Selectors.new_course_run).addClass('placeholder-text-direction');
} else {
$(Selectors.new_course_run).removeClass('placeholder-text-direction');
}
});
}
};
var makeCancelHandler = function(addType) {
return function(e) {
e.preventDefault();
......@@ -81,18 +98,22 @@ define(['domReady', 'jquery', 'underscore', 'js/utils/cancel_on_escape', 'js/vie
};
var addNewCourse = function(e) {
var $newCourse,
$cancelButton,
$courseName;
e.preventDefault();
$('.new-course-button').addClass('is-disabled').attr('aria-disabled', true);
$('.new-course-save').addClass('is-disabled').attr('aria-disabled', true);
var $newCourse = $('.wrapper-create-course').addClass('is-shown');
var $cancelButton = $newCourse.find('.new-course-cancel');
var $courseName = $('.new-course-name');
$newCourse = $('.wrapper-create-course').addClass('is-shown');
$cancelButton = $newCourse.find('.new-course-cancel');
$courseName = $('.new-course-name');
$courseName.focus().select();
$('.new-course-save').on('click', saveNewCourse);
$cancelButton.bind('click', makeCancelHandler('course'));
CancelOnEscape($cancelButton);
CreateCourseUtils.setupOrgAutocomplete();
CreateCourseUtils.configureHandlers();
rtlTextDirection();
};
var saveNewLibrary = function(e) {
......
......@@ -60,6 +60,16 @@ define(['jquery',
$('.new-course-org').autocomplete('destroy');
});
it('set the correct direction of text in case of rtl', function() {
$('body').addClass('rtl');
$('.new-course-button').click();
$('.new-course-run').val('2014_T2').trigger('input');
expect($('.new-course-run').hasClass('placeholder-text-direction')).toBe(false);
$('.new-course-run').val('').trigger('input');
expect($('.new-course-run').hasClass('placeholder-text-direction')).toBe(true);
});
it('displays an error when saving fails', function() {
var requests = AjaxHelpers.requests(this);
$('.new-course-button').click();
......
......@@ -677,6 +677,14 @@
.new-course-run {
width: 100%;
}
.course-run-text-direction {
direction: ltr;
text-align: right;
}
.placeholder-text-direction {
direction: rtl;
}
.new-course-name {
@extend %t-title5;
......
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