Skip to content

Commit e115b06

Browse files
Review rating block cleared on reset button click
1 parent bd5a012 commit e115b06

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/code/Magento/Review/Block/Adminhtml/Add.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ protected function _construct()
3737
';
3838
// @codingStandardsIgnoreStart
3939
$this->_formInitScripts[] = '
40-
require(["jquery","prototype"], function(jQuery){
40+
require(["jquery","Magento_Review/js/rating","prototype"], function(jQuery, rating){
4141
window.review = function() {
4242
return {
4343
reviewFormEditSelector: "#edit_form",
44+
ratingSelector: "[data-widget=ratingControl]",
4445
productInfoUrl : null,
4546
formHidden : true,
4647
gridRowClick : function(data, click) {
@@ -71,6 +72,7 @@ protected function _construct()
7172
},
7273
formReset: function() {
7374
jQuery(review.reviewFormEditSelector).trigger(\'reset\');
75+
jQuery(review.ratingSelector).ratingControl(\'removeRating\');
7476
},
7577
updateRating: function() {
7678
elements = [$("select_stores"), $("rating_detail").getElementsBySelector("input[type=\'radio\']")].flatten();

app/code/Magento/Review/view/adminhtml/web/js/rating.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ define([
6262

6363
checkedInputs.nextAll('label').addBack().css('color', this.options.colorFilled).data('checked', true);
6464
checkedInputs.prevAll('label').css('color', this.options.colorUnfilled).data('checked', false);
65+
},
66+
67+
/**
68+
* Remove rating when form reset
69+
*/
70+
removeRating: function () {
71+
var checkedInputs = this.element.find('input[type="radio"]');
72+
checkedInputs.nextAll('label').css('color', this.options.colorUnfilled).data('checked', false);
6573
}
6674
});
6775

0 commit comments

Comments
 (0)