mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 07:25:30 +02:00
MDL-50246 quiz: Add selected questions to quiz btn disabled 0 selected
This commit is contained in:
parent
9993c1d02c
commit
4bfcdfed4e
@ -195,6 +195,9 @@ Feature: Edit quiz page - adding things
|
||||
And I navigate to "Edit quiz" in current page administration
|
||||
And I open the "last" add to quiz menu
|
||||
And I follow "from question bank"
|
||||
Then the "Add selected questions to the quiz" "button" should be disabled
|
||||
And I click on "Essay 03" "checkbox"
|
||||
Then the "Add selected questions to the quiz" "button" should be enabled
|
||||
And I click on "Add to quiz" "link" in the "Essay 03" "table_row"
|
||||
Then I should see "Editing quiz: Quiz 1"
|
||||
And I should see "Essay 03" on quiz page "1"
|
||||
|
@ -45,6 +45,15 @@ var manager = {
|
||||
*/
|
||||
_header: null,
|
||||
|
||||
/**
|
||||
* A reference to the add to quiz button.
|
||||
*
|
||||
* @property _addbutton
|
||||
* @type Node
|
||||
* @private
|
||||
*/
|
||||
_addbutton: null,
|
||||
|
||||
/**
|
||||
* The ID of the first checkbox on the page.
|
||||
*
|
||||
@ -71,6 +80,15 @@ 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);
|
||||
|
||||
// Store the first checkbox details.
|
||||
var table = this._header.ancestor('table');
|
||||
@ -98,6 +116,19 @@ var manager = {
|
||||
}
|
||||
|
||||
this._header.set('checked', false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle toggling of a question checkbox.
|
||||
*
|
||||
* @method _questionClick
|
||||
* @private
|
||||
*/
|
||||
_questionClick: function() {
|
||||
var areChecked = Y.all('td.checkbox input[type="checkbox"]:checked').size();
|
||||
this._addbutton.setAttrs({
|
||||
disabled: (areChecked === 0)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-question-qbankmanager",function(e,t){var n={_header:null,_firstCheckbox:null,init:function(){this._header=e.one("#qbheadercheckbox");if(!this._header)return;this._header.setAttrs({disabled:!1,title:M.util.get_string("selectall","moodle")}),this._header.on("click",this._headerClick,this);var t=this._header.ancestor("table");this._firstCheckbox=t.one("tbody tr td.checkbox input")},_headerClick:function(){var t=e.one("#categoryquestions").all("[type=checkbox],[type=radio]");this._firstCheckbox.get("checked")?(t.set("checked",!1),this._header.setAttribute("title",M.util.get_string("selectall","moodle"))):(t.set("checked",!0),this._header.setAttribute("title",M.util.get_string("deselectall","moodle"))),this._header.set("checked",!1)}};M.question=M.question||{},M.question.qbankmanager=M.question.qbankmanager||n},"@VERSION@",{requires:["node","selector-css3"]});
|
||||
YUI.add("moodle-question-qbankmanager",function(e,t){var n={_header:null,_addbutton:null,_firstCheckbox:null,init:function(){this._header=e.one("#qbheadercheckbox");if(!this._header)return;this._header.setAttrs({disabled:!1,title:M.util.get_string("selectall","moodle")}),this._header.on("click",this._headerClick,this),this._header.on("click",this._questionClick,this),this._addbutton=e.one('.modulespecificbuttonscontainer input[name="add"]'),this._addbutton.setAttrs({disabled:!0}),e.one(".categoryquestionscontainer").delegate("change",this._questionClick,'td.checkbox input[type="checkbox"]',this);var t=this._header.ancestor("table");this._firstCheckbox=t.one("tbody tr td.checkbox input")},_headerClick:function(){var t=e.one("#categoryquestions").all("[type=checkbox],[type=radio]");this._firstCheckbox.get("checked")?(t.set("checked",!1),this._header.setAttribute("title",M.util.get_string("selectall","moodle"))):(t.set("checked",!0),this._header.setAttribute("title",M.util.get_string("deselectall","moodle"))),this._header.set("checked",!1)},_questionClick:function(){var t=e.all('td.checkbox input[type="checkbox"]:checked').size();this._addbutton.setAttrs({disabled:t===0})}};M.question=M.question||{},M.question.qbankmanager=M.question.qbankmanager||n},"@VERSION@",{requires:["node","selector-css3"]});
|
||||
|
@ -45,6 +45,15 @@ var manager = {
|
||||
*/
|
||||
_header: null,
|
||||
|
||||
/**
|
||||
* A reference to the add to quiz button.
|
||||
*
|
||||
* @property _addbutton
|
||||
* @type Node
|
||||
* @private
|
||||
*/
|
||||
_addbutton: null,
|
||||
|
||||
/**
|
||||
* The ID of the first checkbox on the page.
|
||||
*
|
||||
@ -71,6 +80,15 @@ 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);
|
||||
|
||||
// Store the first checkbox details.
|
||||
var table = this._header.ancestor('table');
|
||||
@ -98,6 +116,19 @@ var manager = {
|
||||
}
|
||||
|
||||
this._header.set('checked', false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle toggling of a question checkbox.
|
||||
*
|
||||
* @method _questionClick
|
||||
* @private
|
||||
*/
|
||||
_questionClick: function() {
|
||||
var areChecked = Y.all('td.checkbox input[type="checkbox"]:checked').size();
|
||||
this._addbutton.setAttrs({
|
||||
disabled: (areChecked === 0)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
31
question/yui/src/qbankmanager/js/qbankmanager.js
vendored
31
question/yui/src/qbankmanager/js/qbankmanager.js
vendored
@ -43,6 +43,15 @@ var manager = {
|
||||
*/
|
||||
_header: null,
|
||||
|
||||
/**
|
||||
* A reference to the add to quiz button.
|
||||
*
|
||||
* @property _addbutton
|
||||
* @type Node
|
||||
* @private
|
||||
*/
|
||||
_addbutton: null,
|
||||
|
||||
/**
|
||||
* The ID of the first checkbox on the page.
|
||||
*
|
||||
@ -69,6 +78,15 @@ 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);
|
||||
|
||||
// Store the first checkbox details.
|
||||
var table = this._header.ancestor('table');
|
||||
@ -96,6 +114,19 @@ var manager = {
|
||||
}
|
||||
|
||||
this._header.set('checked', false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle toggling of a question checkbox.
|
||||
*
|
||||
* @method _questionClick
|
||||
* @private
|
||||
*/
|
||||
_questionClick: function() {
|
||||
var areChecked = Y.all('td.checkbox input[type="checkbox"]:checked').size();
|
||||
this._addbutton.setAttrs({
|
||||
disabled: (areChecked === 0)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user