Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.

Commit 48bffbf

Browse files
Merge pull request #27 from mendix/fix/over-association-attribute
fix: fixing over association attribute value
2 parents 2aa792f + b955bfe commit 48bffbf

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "BootstrapTooltip",
3-
"version": "3.2.4",
3+
"version": "3.2.5",
44
"description": "This widget adds a tooltip to an user defined field, containing for example help text or extra information.",
55
"license": "Apache-2.0",
66
"author": "Mendix Technology B.V.",

src/BootstrapTooltip.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltip", [_WidgetBase,
2121
postCreate: function() {
2222
logger.debug(this.id + ".postCreate");
2323

24+
this._checkTrigger();
25+
},
26+
27+
_checkTrigger: function() {
2428
this._tooltipTrigger = this.tooltipMode === "hover" ? "focus hover" : this.tooltipMode;
2529
},
2630

src/BootstrapTooltipContext.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ import _bootstrapTooltipWidget from "./BootstrapTooltip";
33

44
export default declare("BootstrapTooltip.widget.BootstrapTooltipContext", [_bootstrapTooltipWidget], {
55
_contextObj: null,
6+
_attribute: "",
7+
8+
postCreate: function () {
9+
const attributeSplit = this.tooltipMessageAttribute.split("/");
10+
if (attributeSplit.length === 1) {
11+
this._attribute = this.tooltipMessageAttribute;
12+
} else {
13+
this._attribute = attributeSplit[attributeSplit.length - 1];
14+
}
15+
this._checkTrigger();
16+
},
617

718
update: function(obj, callback) {
819
logger.debug(this.id + ".update");
@@ -19,7 +30,7 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltipContext", [_boot
1930
return;
2031
}
2132

22-
if (this.tooltipSource === "attribute" && this.tooltipMessageAttribute) {
33+
if (this.tooltipSource === "attribute" && this._attribute) {
2334
this.setTooltipTextAttribute();
2435
} else {
2536
if (this.tooltipMessageString) {
@@ -42,18 +53,18 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltipContext", [_boot
4253

4354
this.subscribe({
4455
guid: this._contextObj.getGuid(),
45-
attr: this.tooltipMessageAttribute,
56+
attr: this._attribute,
4657
callback: () => this.setTooltipTextAttribute()
4758
});
4859
}
4960
},
5061

5162
setTooltipTextAttribute: function() {
5263
if (this._contextObj) {
53-
if (this._contextObj.isEnum(this.tooltipMessageAttribute)) {
54-
this._tooltipText = this._contextObj.getEnumCaption(this.tooltipMessageAttribute);
64+
if (this._contextObj.isEnum(this._attribute)) {
65+
this._tooltipText = this._contextObj.getEnumCaption(this._attribute);
5566
} else {
56-
this._tooltipText = this._contextObj.get(this.tooltipMessageAttribute);
67+
this._tooltipText = this._contextObj.get(this._attribute);
5768
}
5869
} else {
5970
this._tooltipText = null;

0 commit comments

Comments
 (0)