Files
edx-platform/cms/templates/js/validation-error-modal.underscore
Se Won Jang 11d260910f Implemented Validation for Course Advanced Setting
This commit adds validation for course advanced settings. Currently when course
administrators make invalid changes in the Settings/Advanced Settings tab,
they're not notified through a new modal window of the list of invalid settings
changes.

* Extending CourseMetadata
    - Previously, we only had update_from_json method in CourseMetadata.py,
      and it was only validating one field every POST request.
    - Now we have validate_and_update_from_json method that encapsulates the
      functionality of update_from_json into a validation call
    - To avoid discrepancy of validation standards between modules, validation
      uses the from_json method implemented to each field in xblock.

* Different Response in advanced settings ajax requests
    - After receiving a POST ajax request, course.py calls
      validate_and_update_from_json, and sends a json object of either:
        1) valid course metadata model
        2) error objects

* Error Messages shown in validation-error-modal
    - error objects passed through ajax are shown in a separate modal.
2014-08-26 11:24:38 -07:00

31 lines
1.0 KiB
Plaintext

<div class = "validation-error-modal-content">
<div class "error-header">
<p>
<%= _.template(
gettext("There were {strong_start}{num_errors} validation error(s){strong_end} while trying to save the course setting(s) in the database."),
{
strong_start:'<strong>',
num_errors: num_errors,
strong_end: '</strong>'
},
{interpolate: /\{(.+?)\}/g})%>
<%= gettext("Please check the following validation feedbacks and reflect them in your course settings:")%></p>
</div>
<hr>
<ul class = "error-list">
<% _.each(response, function(value, index, list) { %>
<li class = "error-item">
<span class='error-item-title'>
<i class="icon-warning-sign"></i>
<strong><%= value.model.display_name %></strong>:
</span>
<textarea class = "error-item-message" disabled='disabled'><%=value.message%></textarea>
</li>
<% }); %>
</ul>
</div>