Skip to content

Commit c9f6a80

Browse files
Initial upload
0 parents  commit c9f6a80

6 files changed

Lines changed: 98 additions & 0 deletions

File tree

CustomFeedbackButton.mpk

8.29 KB
Binary file not shown.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
dojo.provide("CustomFeedbackButton.CustomFeedbackButton");
2+
mendix.widget.declare("CustomFeedbackButton.CustomFeedbackButton", {
3+
4+
inputargs: {
5+
clickmicroflow:"",
6+
buttontext:""
7+
},
8+
9+
// references to DOM elements
10+
button:null,
11+
12+
postCreate : function(){
13+
var imageUrl = "";
14+
if(this.buttontext == "Feedback")
15+
imageURL = "../widgets/CustomFeedbackButton/feedback.png";
16+
else
17+
imageURL = "../widgets/CustomFeedbackButton/support.png";
18+
19+
20+
this.button = mxui.dom.div(
21+
{
22+
"style": 'background: url("'+imageURL+'") no-repeat scroll 0 0 transparent !important;'
23+
+ 'color: white;'
24+
+ 'cursor: pointer;'
25+
+ 'height: 102px;'
26+
+ 'position: fixed;'
27+
+ 'right: 0;'
28+
+ 'top: 50%;'
29+
+ 'vertical-align: bottom;'
30+
+ 'width: 35px;'
31+
+ 'z-index: 10000;'
32+
}
33+
);
34+
dojo.connect(this.button, "onclick", this, this.onButtonClick);
35+
dojo.place(this.button , window.document.body);
36+
this.actRendered();
37+
38+
},
39+
onButtonClick : function () {
40+
41+
if(this.clickmicroflow != ""){
42+
mx.data.action({
43+
params : {
44+
actionname : this.clickmicroflow
45+
},
46+
callback : function(obj) {
47+
// no MxObject expected
48+
// alert("Just petted the cat a little");
49+
},
50+
error : function(error) {
51+
alert(error.description);
52+
},
53+
onValidation : function(validations) {
54+
//alert("There were " + validation.length + " validation errors");
55+
}
56+
});
57+
}
58+
}
59+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<widget id="CustomFeedbackButton.CustomFeedbackButton" needsEntityContext="false" xmlns="http://www.mendix.com/widget/1.0/">
3+
<name>Custom Feedback Widget</name>
4+
<description>Feedback button dat triggers microflow for custom handling</description>
5+
6+
<icon></icon>
7+
8+
<properties>
9+
10+
<property key="clickmicroflow" type="microflow" required="true">
11+
<caption>On click</caption>
12+
<category>Behavior</category>
13+
<description>Microflow to trigger on click.</description>
14+
<returnType type="Void"/>
15+
</property>
16+
17+
18+
<property key="buttontext" type="enumeration" defaultValue="Feedback">
19+
<caption>Button text</caption>
20+
<category>Behavior</category>
21+
<description>In what type of webpage must the URL be open.</description>
22+
<enumerationValues>
23+
<enumerationValue key="Feedback">Feedback</enumerationValue>
24+
<enumerationValue key="Support">Support</enumerationValue>
25+
</enumerationValues>
26+
</property>
27+
</properties>
28+
</widget>

CustomFeedbackButton/feedback.png

1.84 KB
Loading

CustomFeedbackButton/support.png

4.08 KB
Loading

package.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<package xmlns="http://www.mendix.com/package/1.0/">
3+
<clientModule name="Custom Feedback Button" version="0.1" xmlns="http://www.mendix.com/clientModule/1.0/">
4+
<widgetFiles>
5+
<widgetFile path="CustomFeedbackButton/CustomFeedbackButton.xml"/>
6+
</widgetFiles>
7+
<files>
8+
<file path="CustomFeedbackButton/"/>
9+
</files>
10+
</clientModule>
11+
</package>

0 commit comments

Comments
 (0)