don't allow "require sequential progress" with nc-or
test plan: * edit a module and add some requirements * the "Students must move through... in sequential order" checkbox should not be shown if the radio button for "Students must complete one requirement" is selected closes #CNVS-23692 Change-Id: I37b23c549fa3517a06b8222c28d55a3a48e7f742 Reviewed-on: https://gerrit.instructure.com/64650 Reviewed-by: Dan Minkevitch <dan@instructure.com> Tested-by: Jenkins QA-Review: Jeremy Stanley <jeremy@instructure.com> Product-Review: Cosme Salazar <cosme@instructure.com>
This commit is contained in:
parent
4011641ee9
commit
dc6c05bdff
|
@ -259,4 +259,8 @@ input.move-module-label-spacer {
|
|||
width:1px;
|
||||
height:1px;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.require-sequential {
|
||||
margin-left: 20px;
|
||||
}
|
|
@ -52,12 +52,16 @@
|
|||
<%= f.label :module_complete_when, "Requirements", class: "ic-Label form-element" %>
|
||||
<div class="ic-Form-control ic-Form-control--radio requirement-count-radio">
|
||||
<div class="ic-Radio">
|
||||
<%= f.radio_button :requirement_count, "" %>
|
||||
<%= f.label :requirement_count, t("Student must complete all of these requirements"), class: "ic-Label", value: "" %>
|
||||
<%= f.radio_button :requirement_count, "" %>
|
||||
<%= f.label :requirement_count, t("Students must complete all of these requirements"), class: "ic-Label", value: "" %>
|
||||
</div>
|
||||
<div class="form-element require-sequential ic-Form-control ic-Form-control--checkbox">
|
||||
<%= f.check_box :require_sequential_progress, :id => "require_sequential_progress" %>
|
||||
<%= f.label :require_sequential_progress, :en => "Students must move through requirements in sequential order", :for => "require_sequential_progress", class: 'ic-Label' %>
|
||||
</div>
|
||||
<div class="ic-Radio">
|
||||
<%= f.radio_button :requirement_count, 1 %>
|
||||
<%= f.label :requirement_count, t("Student must complete one of these requirements"), class: "ic-Label", value: 1 %>
|
||||
<%= f.label :requirement_count, t("Students must complete one of these requirements"), class: "ic-Label", value: 1 %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="no_items_message form-element" style="display: none;">
|
||||
|
@ -91,11 +95,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="form-element require-sequential ic-Form-control ic-Form-control--checkbox">
|
||||
<%= f.check_box :require_sequential_progress, :id => "require_sequential_progress" %>
|
||||
<%= f.label :require_sequential_progress, :en => "Students must move through requirements in this module in sequential order", :for => "require_sequential_progress", class: 'ic-Label' %>
|
||||
</div>
|
||||
|
||||
<div class="button-container">
|
||||
<button type="button" class="btn cancel_button"><%= t('#buttons.cancel', %{Cancel}) %></button>
|
||||
<button type="submit" class="btn btn-primary submit_button"><%= t('buttons.add_module', %{Add Module}) %></button>
|
||||
|
|
|
@ -333,14 +333,11 @@ define([
|
|||
isNew = true;
|
||||
$form.attr('action', $form.find(".add_context_module_url").attr('href'));
|
||||
$form.find(".completion_entry").hide();
|
||||
$form.find(".require-sequential").children().hide();
|
||||
$form.attr('method', 'POST');
|
||||
$form.find(".submit_button").text(I18n.t('buttons.add', "Add Module"));
|
||||
} else {
|
||||
$form.attr('action', $module.find(".edit_module_link").attr('href'));
|
||||
$form.find(".completion_entry").show();
|
||||
$form.find(".require-sequential").children().hide().end()
|
||||
$form.find(".requirement-count-radio .ic-Radio").children().hide().end()
|
||||
$form.attr('method', 'PUT');
|
||||
$form.find(".submit_button").text(I18n.t('buttons.update', "Update Module"));
|
||||
}
|
||||
|
@ -382,14 +379,20 @@ define([
|
|||
// Set no items or criteria message plus diasable elements if there are no items or no requirements
|
||||
if (no_items) {
|
||||
$form.find(".completion_entry .no_items_message").show();
|
||||
|
||||
} else if ($module.find(".content .context_module_item .criterion.defined").length !== 0) {
|
||||
$(".require-sequential").children().show();
|
||||
$(".requirement-count-radio .ic-Radio").children().show();
|
||||
}
|
||||
if ($module.find(".content .context_module_item .criterion.defined").length !== 0) {
|
||||
$(".requirement-count-radio").children().show();
|
||||
} else {
|
||||
$(".requirement-count-radio").children().hide();
|
||||
}
|
||||
|
||||
var $requirementCount = $module.find('.pill li').data("requirement-count");
|
||||
$requirementCount == 1 ? $('#context_module_requirement_count_1').prop('checked', true) : $('#context_module_requirement_count').prop('checked', true);
|
||||
if ($requirementCount == 1) {
|
||||
$('#context_module_requirement_count_1').prop('checked', true).change();
|
||||
} else {
|
||||
$('#context_module_requirement_count_').prop('checked', true).change();
|
||||
}
|
||||
|
||||
|
||||
$module.fadeIn('fast', function() {
|
||||
});
|
||||
|
@ -922,8 +925,7 @@ define([
|
|||
$option.slideDown();
|
||||
$form.find(".completion_entry .criteria_list").append($pre).show();
|
||||
$pre.slideDown();
|
||||
$(".require-sequential").children().show();
|
||||
$(".requirement-count-radio .ic-Radio").children().show();
|
||||
$(".requirement-count-radio").children().show();
|
||||
$('#context_module_requirement_count_').change().focus();
|
||||
});
|
||||
$("#completion_criterion_option .id").change(function() {
|
||||
|
@ -953,6 +955,16 @@ define([
|
|||
$option.find(".points_possible_parent").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#add_context_module_form .requirement-count-radio .ic-Radio input").change(function() {
|
||||
if ($('#context_module_requirement_count_').prop('checked')) {
|
||||
$('.require-sequential').show();
|
||||
} else {
|
||||
$('.require-sequential').hide();
|
||||
$('#require_sequential_progress').prop('checked', false)
|
||||
}
|
||||
});
|
||||
|
||||
$("#add_context_module_form .delete_criterion_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
var $elem = $(this).closest(".criteria_list");
|
||||
|
@ -961,8 +973,7 @@ define([
|
|||
$(this).remove();
|
||||
// Hides radio button and checkbox if there are no requirements
|
||||
if ($elem.html().length === 0 && $requirement.length !== 0) {
|
||||
$(".require-sequential").children().fadeOut("fast");
|
||||
$(".requirement-count-radio .ic-Radio").children().fadeOut("fast");
|
||||
$(".requirement-count-radio").children().fadeOut("fast");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue