Skip to content

Commit

Permalink
Merge branch 'hotfix/0.21.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
garex committed Oct 26, 2018
2 parents 3ae4cdd + 7e7910e commit 69a9189
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
## Changelog ##


### 0.21.13 ###

Add answer's attribute for CSS styling.


### 0.21.12 ###

Fix bug with scale sorting.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

**Tested up to:** 4.9

**Stable tag:** 0.21.12
**Stable tag:** 0.21.13

**License:** GPLv3

Expand Down
18 changes: 17 additions & 1 deletion js/test-pass-fill-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Wpt.form.initQuestionAnswered = function(form) {
}).bind('question_unanswered_initially.wpt', function(event, question) {
question.removeClass('answered');
question.find('.answer input:first').attr('required', 'required').attr('aria-required', 'true');
}).bind('answer_selected.wpt', function (event, answer) {
answer.addClass('selected');
}).bind('answer_unselected.wpt', function (event, answer) {
answer.removeClass('selected');
});
};

Expand Down Expand Up @@ -146,7 +150,19 @@ Wpt.form.setupQuestionsAnswered = function($, form) {
question.find('.answer').each(function () {
var answer = $(this);
answer.find('input').bind('change', function () {
if (!$(this).attr('checked')) {
answer.data('isSelected', !!$(this).attr('checked'));
if (answer.data('isSelected')) {
form.trigger('answer_selected.wpt', [answer]);
questionAnswersInputs.each(function (i, otherInput) {
var $el = $(otherInput);
if ($el.closest('.answer').data('isSelected') != !!$(otherInput).attr('checked')) {
$el.change();
}
});
} else {
form.trigger('answer_unselected.wpt', [answer]);
}
if (!answer.data('isSelected')) {
var isAllCheckboxesEmpty = (0 == questionAnswersInputs.filter(':checked').length);
if (isAllCheckboxesEmpty) {
question.data('isAnswered', false);
Expand Down
2 changes: 1 addition & 1 deletion wp-testing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Wp-testing
* Plugin URI: http://wordpress.org/extend/plugins/wp-testing/
* Description: Helps to create psychological tests.
* Version: 0.21.12
* Version: 0.21.13
* Author: Alexander Ustimenko
* Author URI: http://ustimen.co
* License: GPL3
Expand Down

0 comments on commit 69a9189

Please sign in to comment.