Skip to content

Commit 7029375

Browse files
author
Jelte Lagendijk
committed
Merge branch 'master' of ssh://github.com/tieniber/DropdownDivConverter
into tieniber-master
2 parents 584fcb1 + 5507fe1 commit 7029375

File tree

4 files changed

+20
-40
lines changed

4 files changed

+20
-40
lines changed

Gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated on 2016-11-03 using generator-mendix 2.0.1 :: git+https://github.com/mendix/generator-mendix.git
1+
// Generated on 2018-02-07 using generator-mendix 2.0.1 :: git+https://github.com/mendix/generator-mendix.git
22
/*jshint -W069,-W097*/
33
"use strict";
44

src/DropdownDivConverter/widget/DropdownDivConverter.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ define([
22
"dojo/_base/declare",
33
"mxui/widget/_WidgetBase",
44
"dijit/_TemplatedMixin",
5+
"mxui/dom",
56
"dojo/query",
67
"dojo/dom-class",
78
"dojo/dom-construct",
@@ -10,7 +11,7 @@ define([
1011
"dojo/_base/event",
1112
"dojo/text!DropdownDivConverter/widget/template/DropdownDivConverter.html",
1213
"dojo/NodeList-traverse"
13-
], function (declare, _WidgetBase, _TemplatedMixin, domQuery, domClass, domConstruct, dojoArray, lang, event, widgetTemplate) {
14+
], function (declare, _WidgetBase, _TemplatedMixin, dom, domQuery, domClass, domConstruct, dojoArray, lang, event, widgetTemplate) {
1415
"use strict";
1516

1617
/*
@@ -61,6 +62,7 @@ define([
6162
this._isOpen = false;
6263
},
6364

65+
// mxui.widget._WidgetBase.update is called when context is changed or initialized. Implement to re-render and / or fetch data.
6466
update: function (obj, callback) {
6567
this._contextObj = obj;
6668

@@ -81,13 +83,13 @@ define([
8183
domConstruct.place(entry,this.dropdownMenu,"last");
8284
}));
8385

84-
this._renderInterface(this.startOpen, callback);
86+
this._renderInterface(this.startOpen,callback);
8587
},
8688

8789
// Really render the interface, if renderAsOpen is true: render the menu in open state
8890
_renderInterface: function(renderAsOpen, callback) {
8991
this._updateButtonTitle();
90-
this.dropdownButton.innerHTML = this._buttonLabel + "<span class=\"caret\"></span>";
92+
this.dropdownButton.innerHTML = dom.escapeString(this._buttonLabel) + "<span class='caret'></span>";
9193
// if a glyphicon icon was requested and the splitButton is not wanted: add the glyphicon to the button.
9294
if (this.buttonGlyphicon !== "" && !this.splitButtonActive){
9395
this._addGlyphicon(this.dropdownButton);
@@ -196,6 +198,12 @@ define([
196198
params : {
197199
applyto : "selection",
198200
guids : [id]
201+
},
202+
callback : function(success) {
203+
// if success was true, the microflow was indeed followed through
204+
},
205+
error : function(error) {
206+
// if there was an error
199207
}
200208
}, this);
201209
} else if (this.simpleSplitButtonClicked !== "") {
@@ -225,20 +233,20 @@ define([
225233
// Set button types: size and type
226234
_setButtonTypes: function(button){
227235
// first set the button type
228-
var typeClassName = "btn-" + this.buttonType;
236+
var typeClassName = "btn-"+this.buttonType,
237+
sizeClassName;
229238

230239
if (!domClass.contains(button,typeClassName)){
231240
domClass.add(button,typeClassName);
232241
}
233242

234243
if (this.buttonSize === "default") {
235-
// default buttonsize is allready implemented
236-
return;
244+
return;
237245
}
238246

239-
var sizeClassName = "btn-" + this.buttonSize;
240-
if (!domClass.contains(button,sizeClassName)){
241-
domClass.add(button,sizeClassName);
247+
sizeClassName = "btn-" + this.buttonSize;
248+
if (!domClass.contains(button, sizeClassName)) {
249+
domClass.add(button, sizeClassName);
242250
}
243251
},
244252

@@ -252,7 +260,7 @@ define([
252260
// Create a split button group
253261
_createSplitButton: function() {
254262
// create the new split button label
255-
this.splitButton.innerHTML = this._buttonLabel;
263+
this.splitButton.innerHTML = dom.escapeString(this._buttonLabel);
256264
// if a glyphicon icon was requested: add the glyphicon to the button.
257265
if (this.buttonGlyphicon !== ""){
258266
this._addGlyphicon(this.splitButton);
@@ -273,7 +281,7 @@ define([
273281

274282
// Add a glyphicon to a button
275283
_addGlyphicon: function(buttonObject) {
276-
buttonObject.innerHTML = "<span class=\"glyphicon " + this.buttonGlyphicon + "\"></span>" + buttonObject.innerHTML;
284+
buttonObject.innerHTML = "<span class='glyphicon " + dom.escapeString(this.buttonGlyphicon) + "'></span>" + buttonObject.innerHTML;
277285
},
278286

279287
// Reset subscriptions.

test/Test.mpr

100644100755
-280 KB
Binary file not shown.

test/theme/index.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)