Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-50246-master' of https://github.com/lucaboesch/moodle
  • Loading branch information
David Monllao committed Dec 27, 2017
2 parents 8b36f14 + 4bfcdfe commit f108433
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mod/quiz/tests/behat/editing_add.feature
Expand Up @@ -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"
Expand Down
Expand Up @@ -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.
*
Expand All @@ -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');
Expand Down Expand Up @@ -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)
});
}
};

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -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.
*
Expand All @@ -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');
Expand Down Expand Up @@ -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)
});
}
};

Expand Down
31 changes: 31 additions & 0 deletions question/yui/src/qbankmanager/js/qbankmanager.js
Expand Up @@ -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.
*
Expand All @@ -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');
Expand Down Expand Up @@ -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)
});
}
};

Expand Down

0 comments on commit f108433

Please sign in to comment.