MDL-50246 question: enable/disable add question button when available
authorDavid Monllao <davidm@moodle.com>
Wed, 27 Dec 2017 05:45:39 +0000 (06:45 +0100)
committerDavid Monllao <davidm@moodle.com>
Wed, 27 Dec 2017 16:54:59 +0000 (17:54 +0100)
question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-debug.js
question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-min.js
question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager.js
question/yui/src/qbankmanager/js/qbankmanager.js

index bad45e0..fbe45fe 100644 (file)
Binary files a/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-debug.js and b/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-debug.js differ
index 2cbf9fb..22b2432 100644 (file)
Binary files a/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-min.js and b/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager-min.js differ
index bad45e0..fbe45fe 100644 (file)
Binary files a/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager.js and b/question/yui/build/moodle-question-qbankmanager/moodle-question-qbankmanager.js differ
index c4058ad..cb6ea38 100644 (file)
@@ -78,15 +78,18 @@ var manager = {
         });
 
         this._header.on('click', this._headerClick, this);
-        this._header.on('click', this._questionClick, this);
 
         this._addbutton = Y.one('.modulespecificbuttonscontainer input[name="add"]');
-
-        this._addbutton.setAttrs({
-            disabled: true
-        });
-
-        Y.one('.categoryquestionscontainer').delegate('change', this._questionClick, 'td.checkbox input[type="checkbox"]', this);
+        // input[name="add"] is not always available.
+        if (this._addbutton) {
+            this._addbutton.setAttrs({
+                disabled: true
+            });
+
+            this._header.on('click', this._questionClick, this);
+            Y.one('.categoryquestionscontainer').delegate('change', this._questionClick,
+                'td.checkbox input[type="checkbox"]', this);
+        }
 
         // Store the first checkbox details.
         var table = this._header.ancestor('table');