fix unlocked_at field when editing a module
fixes CNVS-13180 When you edit a module item and click to add an unlocked_at date it was acting a little weird. It would "persist" after you added an unlocked_at date when editing another unlocked_at date in a different module as well as it would loose the previously selected unlocked_at date when checking/unchecking the checkbox. This fixes all of that. Test Plan ------------------- As a teacher Given you have 2 modules that don't have a unlocked_at due date set And you are on the modules page When you click the gear icon and edit a module And you check the 'lock module until a given date' checkbox And you select an unlocked_at date And you uncheck the 'lock module until a given date' checkbox And you check 'lock module until a given date' again Then you should see the unlocked_at date field should have the previously selected due date. It should not be 'lost' --------------------------------- Given you have 2 modules that don't have a unlocked_at due date set And you are on the modules page When you click the gear icon and edit a module And you check the 'lock module until a given date' checkbox And you close the module edit dialog window And you edit a different module with no unlocked_at due date set Then you should see that module's 'lock module until a given date' checkbox is unchecked And you don't see the 'unlocked_at' field. --------------------------------------------------- Given you have a module with a due date And you are on the modules page When you click the gear icon and edit that module Then you should see the 'lock module until a given date' checkbox checked And there should be a unlocked_at date set in the field Change-Id: Ic70ebefaa2cadb684266cdd442b98751a6739cf7 Reviewed-on: https://gerrit.instructure.com/35278 Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Hilary Scharton <hilary@instructure.com> QA-Review: Clare Strong <clare@instructure.com>
This commit is contained in:
parent
efa361db59
commit
420cc32bf0
|
@ -266,7 +266,7 @@ define([
|
|||
$form.attr('method', 'PUT');
|
||||
$form.find(".submit_button").text(I18n.t('buttons.update', "Update Module"));
|
||||
}
|
||||
$form.find("#unlock_module_at").prop('checked', data.unlock_at);
|
||||
$form.find("#unlock_module_at").prop('checked', data.unlock_at).change()
|
||||
$form.find("#require_sequential_progress").attr('checked', data.require_sequential_progress == "true" || data.require_sequential_progress == "1");
|
||||
$form.find("#publish_final_grade").attr('checked', data.publish_final_grade == "true" || data.publish_final_grade == "1");
|
||||
$form.find(".prerequisites_entry").showIf($("#context_modules .context_module").length > 1);
|
||||
|
@ -489,13 +489,20 @@ define([
|
|||
modules: modules
|
||||
});
|
||||
|
||||
var $context_module_unlocked_at = $("#context_module_unlock_at");
|
||||
var valCache = '';
|
||||
$("#unlock_module_at").change(function() {
|
||||
$this = $(this);
|
||||
$unlock_module_at_details = $(".unlock_module_at_details");
|
||||
$unlock_module_at_details.showIf($this.attr('checked'))
|
||||
var $unlock_module_at_details = $(".unlock_module_at_details");
|
||||
$unlock_module_at_details.showIf($this.attr('checked'));
|
||||
|
||||
if (!$this.attr('checked')) {
|
||||
$("#context_module_unlock_at").val('').triggerHandler('change');
|
||||
if ($this.attr('checked')) {
|
||||
if(!$context_module_unlocked_at.val()){
|
||||
$context_module_unlocked_at.val(valCache);
|
||||
}
|
||||
}else{
|
||||
valCache = $context_module_unlocked_at.val();
|
||||
$context_module_unlocked_at.val('').triggerHandler('change');
|
||||
}
|
||||
}).triggerHandler('change');
|
||||
|
||||
|
|
Loading…
Reference in New Issue