Skip to content

Commit c26ef38

Browse files
committed
5.18 compatible
added onclick microflow functionality
1 parent 75ea36b commit c26ef38

File tree

195 files changed

+14599
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+14599
-90
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
test/javasource/
2+
test/deployment/
3+
test/.classpath
4+
test/.project
5+
*.launch
6+
*.tmp
7+
*.lock
8+
.idea/
9+
10+
dist/
11+
12+
node_modules/
13+
.editorconfig
14+
*DS_Store*
15+
.vscode/

.jshintrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// Enforcing
3+
"curly" : false,
4+
"forin" : false,
5+
"latedef" : "nofunc",
6+
"newcap" : true,
7+
"quotmark" : "double",
8+
"eqeqeq" : true,
9+
"undef" : true,
10+
"globals" : {
11+
"mendix" : false,
12+
"mx" : false
13+
},
14+
15+
// Relaxing
16+
"laxbreak" : true,
17+
18+
// Environments
19+
"browser" : true,
20+
"devel" : true,
21+
"dojo" : true
22+
}

Gruntfile.js

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
// Generated on 2015-12-03 using generator-mendix 1.0.0 :: http://github.com/[object Object]
2+
'use strict';
3+
4+
var path = require('path'),
5+
mendixApp = require('node-mendix-modeler-path'),
6+
base64 = require('node-base64-image'),
7+
fs = require('fs'),
8+
xml2js = require('xml2js'),
9+
parser = new xml2js.Parser(),
10+
builder = new xml2js.Builder(),
11+
shelljs = require('shelljs');
12+
13+
// In case you seem to have trouble starting Mendix through `grunt start-mendix`, you might have to set the path to the Mendix application.
14+
// If it works, leave MODELER_PATH at null
15+
var MODELER_PATH = null;
16+
var MODELER_ARGS = '/file:{path}';
17+
18+
// In case you have a different path to the test project (currently in ./test/Test.mpr) point TEST_PATH to the Test-project (full path). Otherwise, leave at null
19+
var TEST_PATH = null;
20+
// Use this example if you want to point it to a different subfolder and specific Test project Name:
21+
// var TEST_PATH = path.join(shelljs.pwd(), './<custom folder>/<Custom Test Project Name>.mpr');
22+
23+
module.exports = function (grunt) {
24+
var pkg = grunt.file.readJSON("package.json");
25+
grunt.verbose;
26+
grunt.initConfig({
27+
watch: {
28+
autoDeployUpdate: {
29+
"files": [ "./src/**/*" ],
30+
"tasks": [ "newer:copy", "compress" ],
31+
options: {
32+
debounceDelay: 250,
33+
livereload: true
34+
}
35+
}
36+
},
37+
compress: {
38+
makezip: {
39+
options: {
40+
archive: "./dist/" + pkg.name + ".mpk",
41+
mode: "zip"
42+
},
43+
files: [{
44+
expand: true,
45+
date: new Date(),
46+
store: false,
47+
cwd: "./src",
48+
src: ["**/*"]
49+
}]
50+
}
51+
},
52+
copy: {
53+
deployment: {
54+
files: [
55+
{ dest: "./test/deployment/web/widgets", cwd: "./src/", src: ["**/*"], expand: true }
56+
]
57+
},
58+
mpks: {
59+
files: [
60+
{ dest: "./test/widgets", cwd: "./dist/", src: [ pkg.name + ".mpk"], expand: true }
61+
]
62+
}
63+
},
64+
clean: {
65+
build: [
66+
"./dist/" + pkg.name + "/*",
67+
"./test/deployment/web/widgets/" + pkg.name + "/*",
68+
"./test/widgets/" + pkg.name + ".mpk"
69+
]
70+
}
71+
});
72+
73+
grunt.loadNpmTasks("grunt-contrib-compress");
74+
grunt.loadNpmTasks("grunt-contrib-clean");
75+
grunt.loadNpmTasks("grunt-contrib-watch");
76+
grunt.loadNpmTasks("grunt-contrib-copy");
77+
grunt.loadNpmTasks("grunt-newer");
78+
79+
grunt.registerTask("start-mendix", function () {
80+
var done = this.async(),
81+
testProjectPath = TEST_PATH !== null ? TEST_PATH : path.join(shelljs.pwd(), '/test/Test.mpr');
82+
83+
if (MODELER_PATH !== null || (mendixApp.err === null && mendixApp.output !== null && mendixApp.output.cmd && mendixApp.output.arg)) {
84+
grunt.util.spawn({
85+
cmd: MODELER_PATH || mendixApp.output.cmd,
86+
args: [
87+
(MODELER_PATH !== null ? MODELER_ARGS : mendixApp.output.arg).replace('{path}', testProjectPath)
88+
]
89+
}, function () {
90+
done();
91+
});
92+
} else {
93+
console.error('Cannot start Modeler, see error:');
94+
console.log(mendixApp.err);
95+
done();
96+
}
97+
});
98+
99+
grunt.registerTask("generate-icon", function () {
100+
var iconPath = path.join(shelljs.pwd(), '/icon.png'),
101+
widgetXml = path.join(shelljs.pwd(), '/src/', pkg.name, '/', pkg.name + '.xml'),
102+
options = {localFile: true, string: true},
103+
done = this.async();
104+
105+
grunt.log.writeln('Processing icon');
106+
107+
if (!grunt.file.exists(iconPath) || !grunt.file.exists(widgetXml)) {
108+
grunt.log.error("can't generate icon");
109+
return done();
110+
}
111+
112+
base64.base64encoder(iconPath, options, function (err, image) {
113+
if (!err) {
114+
var xmlOld = grunt.file.read(widgetXml);
115+
parser.parseString(xmlOld, function (err, result) {
116+
if (!err) {
117+
if (result && result.widget && result.widget.icon) {
118+
result.widget.icon[0] = image;
119+
}
120+
var xmlString = builder.buildObject(result);
121+
grunt.file.write(widgetXml, xmlString);
122+
done();
123+
}
124+
});
125+
}
126+
});
127+
});
128+
129+
grunt.registerTask(
130+
"default",
131+
"Watches for changes and automatically creates an MPK file, as well as copying the changes to your deployment folder",
132+
[ "watch" ]
133+
);
134+
135+
grunt.registerTask(
136+
"clean build",
137+
"Compiles all the assets and copies the files to the build directory.",
138+
[ "clean", "compress", "copy" ]
139+
);
140+
141+
grunt.registerTask(
142+
"build",
143+
[ "clean build" ]
144+
);
145+
};

assets/app_store_banner.png

62.9 KB
Loading

assets/app_store_icon.png

49.7 KB
Loading

icon.png

658 Bytes
Loading

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "CustomString",
3+
"version": "1.1.0",
4+
"description": "Create a string with a microflow",
5+
"private": true,
6+
"dependencies": {
7+
},
8+
"devDependencies": {
9+
"grunt": "0.4.5",
10+
"grunt-contrib-clean": "^0.6.0",
11+
"grunt-contrib-compress": "^0.14.0",
12+
"grunt-contrib-copy": "^0.8.2",
13+
"grunt-contrib-watch": "^0.6.1",
14+
"grunt-newer": "^1.1.1",
15+
"node-base64-image": "^0.1.0",
16+
"shelljs": "^0.5.3",
17+
"xml2js": "^0.4.15",
18+
"node-mendix-modeler-path": "https://github.com/JelteMX/node-mendix-modeler-path/archive/v1.0.0.tar.gz"
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "http://github.com/roelandsalij/CustomString"
23+
},
24+
"engines": {
25+
"node": ">=0.12.0"
26+
},
27+
"scripts": {
28+
"test": "grunt test"
29+
}
30+
}

src/CustomString/CustomString.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616
<caption>Render value as HTML</caption>
1717
<category>Data source</category>
1818
<description>Escapes HTML elements when set to false</description>
19-
</property>
19+
</property>
20+
<property key="mfToExecute" type="microflow" required="false" defaultValue="">
21+
<caption>On click</caption>
22+
<category>Behavior</category>
23+
<description>The microflow to execute on click.</description>
24+
<returnType type="Boolean" />
25+
</property>
2026
</properties>
2127
</widget>
2228

0 commit comments

Comments
 (0)