Skip to content

Commit 282bc28

Browse files
author
Jelte Lagendijk
committed
Fix halfImage attribute in widget
1 parent 4324092 commit 282bc28

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Ratings/widget/ratings.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ define([
2525

2626
standardImage: null,
2727
mouseoverImage: null,
28-
halfImage: null,
28+
halfImage: "",
2929

3030
_contextObj: null,
3131

3232
postCreate : function(){
3333
logger.debug(this.id + ".postCreate");
3434
this.root = window.mx.appUrl;
3535

36+
console.log(this.halfImage);
37+
3638
this.attrValues = [];
3739
this.connectArray = [];
3840
this.mouseoverArray = [];
@@ -60,7 +62,7 @@ define([
6062
showCount = parseInt(mxApp.get(this.ratingsCount), 10);
6163
if (showCount === 0) {
6264
showVote = 1;
63-
} else if (this.halfImage !== null) {
65+
} else if (this.halfImage !== "") {
6466
showVote = ((showTotal / showCount) * 2).toFixed() / 2;
6567
} else {
6668
showVote = number.round((showTotal / showCount));
@@ -73,7 +75,7 @@ define([
7375
for (i = 1; i <= 5; i++) {
7476
imgNode = mxui.dom.create("img",{"class": "ratings_image"});
7577
if (i > showVote) {
76-
if (this.halfImage !== null && (i - showVote === 0.5)) {
78+
if (this.halfImage !== "" && (i - showVote === 0.5)) {
7779
domAttr.set(imgNode, "src", this._getImagePath(this.halfImage));
7880
} else {
7981
domAttr.set(imgNode, "src", this._getImagePath(this.standardImage));
@@ -106,7 +108,7 @@ define([
106108
}
107109

108110
for (k = 4; k > iterator; k--) {
109-
if (this.halfImage !== null && (k - iterator === 0.5)) {
111+
if (this.halfImage !== "" && (k - iterator === 0.5)) {
110112
this.mouseoverArray[k].element.src = this._getImagePath(this.halfImage);
111113
} else {
112114
this.mouseoverArray[k].element.src = this._getImagePath(this.standardImage);

test/widgets/Ratings.mpk

13 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)