Index: lams_central/web/authoring/template/comms.jsp
===================================================================
diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb
--- lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f)
+++ lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb)
@@ -399,3 +399,23 @@
}
return true;
}
+
+ // Functions used of x-editable.
+ // Shown as a fudge the validator to keep x-editable compatible with jquery validator
+ function onShownForXEditable(e, editable) {
+ $(this).nextAll('i.fa-pencil').hide();
+ var $innerForm = $(this).data('editable').input.$input.closest('form');
+ var $outerForm = $innerForm.parents('form').eq(0);
+ $innerForm.data('validator', $outerForm.data('validator'));
+ }
+ function onHiddenForXEditable(e, reason) {
+ $(this).nextAll('i.fa-pencil').show();
+ }
+ function validateXEditable(value) {
+ //close editing area on validation failure
+ if (!value.trim()) {
+ $('.editable-open').editableContainer('hide', 'cancel');
+ return 'Can not be empty!';
+ }
+ }
+
\ No newline at end of file
Index: lams_central/web/authoring/template/tbl/appex.jsp
===================================================================
diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb
--- lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f)
+++ lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb)
@@ -59,23 +59,14 @@
$('#${appexTitleDisplay}').editable({
mode: 'inline',
type: 'text',
- validate: function(value) {
- //close editing area on validation failure
- if (!value.trim()) {
- $('.editable-open').editableContainer('hide', 'cancel');
- return 'Can not be empty!';
- }
- },
- success: function(response, newValue) {
+ validate: validateXEditable,
+ success: function(response, newValue) {
var trimmedValue = newValue.trim();
$('#${appexTitleDisplay}').val(trimmedValue);
$('#${appexTitleField}').val(trimmedValue);
- }
- }).on('shown', function(e, editable) {
- $(this).nextAll('i.fa-pencil').hide();
- }).on('hidden', function(e, reason) {
- $(this).nextAll('i.fa-pencil').show();
- });;
+ }
+ }).on('shown', onShownForXEditable)
+ .on('hidden', onHiddenForXEditable);
Index: lams_central/web/authoring/template/tool/assessmcq.jsp
===================================================================
diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb
--- lams_central/web/authoring/template/tool/assessmcq.jsp (.../assessmcq.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f)
+++ lams_central/web/authoring/template/tool/assessmcq.jsp (.../assessmcq.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb)
@@ -99,22 +99,13 @@
$('#${questionTitleDisplay}').editable({
mode: 'inline',
type: 'text',
- validate: function(value) {
- //close editing area on validation failure
- if (!value.trim()) {
- $('.editable-open').editableContainer('hide', 'cancel');
- return 'Can not be empty!';
- }
- },
+ validate: validateXEditable,
success: function(response, newValue) {
var trimmedValue = newValue.trim();
$('#${questionTitleDisplay}').val(trimmedValue);
$('#${questionTitleField}').val(trimmedValue);
}
- }).on('shown', function(e, editable) {
- $(this).nextAll('i.fa-pencil').hide();
-}).on('hidden', function(e, reason) {
- $(this).nextAll('i.fa-pencil').show();
-});;
+ }).on('shown', onShownForXEditable)
+ .on('hidden', onHiddenForXEditable);
\ No newline at end of file
Index: lams_central/web/authoring/template/tool/assessment.jsp
===================================================================
diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb
--- lams_central/web/authoring/template/tool/assessment.jsp (.../assessment.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f)
+++ lams_central/web/authoring/template/tool/assessment.jsp (.../assessment.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb)
@@ -33,23 +33,14 @@
\ No newline at end of file
Index: lams_central/web/authoring/template/tool/mcquestion.jsp
===================================================================
diff -u -r08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f -r1c3d21d9fdee96b507a158f84564fafbef9a6ecb
--- lams_central/web/authoring/template/tool/mcquestion.jsp (.../mcquestion.jsp) (revision 08a2133f0cddf6ef58bdd8bd6ea21c6d73cc354f)
+++ lams_central/web/authoring/template/tool/mcquestion.jsp (.../mcquestion.jsp) (revision 1c3d21d9fdee96b507a158f84564fafbef9a6ecb)
@@ -89,23 +89,15 @@
\ No newline at end of file