Skip to content

Commit 05a9259

Browse files
committed
revert jquery load to default approach
1 parent 8b75e8c commit 05a9259

9 files changed

Lines changed: 310 additions & 31 deletions

File tree

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
test/javasource/
22
test/deployment/
3-
test/resources/
3+
test/.classpath
4+
test/.project
45
test/theme/
56
test/userlib/
67
test/.classpath
@@ -9,4 +10,11 @@ test/.project
910
*.tmp
1011
*.lock
1112
.idea/
12-
test/package.xml
13+
14+
dist/
15+
16+
node_modules/
17+
.editorconfig
18+
*DS_Store*
19+
.vscode/
20+
*.bak

.jshintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
"logger" : false
14+
},
15+
16+
// Relaxing
17+
"laxbreak" : true,
18+
19+
// Environments
20+
"browser" : true,
21+
"devel" : true,
22+
"dojo" : true
23+
}

Gruntfile.js

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
// Generated on 2017-01-12 using generator-mendix 2.0.1 :: git+https://github.com/mendix/generator-mendix.git
2+
/*jshint -W069*/
3+
/*global module*/
4+
"use strict";
5+
6+
// In case you seem to have trouble starting Mendix through `grunt start-mendix`, you might have to set the path to the Mendix application.
7+
// If it works, leave MODELER_PATH at null
8+
var MODELER_PATH = null;
9+
var MODELER_ARGS = "/file:{path}";
10+
11+
/********************************************************************************
12+
* Do not edit anything below, unless you know what you are doing
13+
********************************************************************************/
14+
15+
var path = require("path"),
16+
mendixApp = require("node-mendix-modeler-path"),
17+
base64 = require("node-base64-image"),
18+
semver = require("semver"),
19+
xml2js = require("xml2js"),
20+
parser = new xml2js.Parser(),
21+
builder = new xml2js.Builder({
22+
renderOpts: { pretty: true, indent: " ", newline: "\n" },
23+
xmldec: { standalone: null, encoding: "utf-8" }
24+
}),
25+
shelljs = require("shelljs"),
26+
pkg = require("./package.json"),
27+
currentFolder = shelljs.pwd().toString();
28+
29+
var TEST_PATH = path.join(currentFolder, "/test/Test.mpr");
30+
var WIDGET_XML = path.join(currentFolder, "/src/", pkg.name, "/", pkg.name + ".xml");
31+
var PACKAGE_XML = path.join(currentFolder, "/src/package.xml");
32+
var TEST_WIDGETS_FOLDER = path.join(currentFolder, "./test/widgets");
33+
var TEST_WIDGETS_DEPLOYMENT_FOLDER = path.join(currentFolder, "./test/deployment/web/widgets");
34+
35+
/**
36+
* If you want to use a custom folder for the test project, make sure these are added to package.json:
37+
* "paths": {
38+
* "testProjectFolder": "./test/",
39+
* "testProjectFileName": "Test.mpr"
40+
* },
41+
* You can test it by running: `grunt folders`
42+
**/
43+
44+
if (pkg.paths && pkg.paths.testProjectFolder && pkg.paths.testProjectFileName) {
45+
var folder = pkg.paths.testProjectFolder;
46+
if (folder.indexOf(".") === 0) {
47+
folder = path.join(currentFolder, folder);
48+
}
49+
TEST_PATH = path.join(folder, pkg.paths.testProjectFileName);
50+
TEST_WIDGETS_FOLDER = path.join(folder, "/widgets");
51+
TEST_WIDGETS_DEPLOYMENT_FOLDER = path.join(folder, "/deployment/web/widgets");
52+
}
53+
54+
module.exports = function (grunt) {
55+
grunt.initConfig({
56+
watch: {
57+
autoDeployUpdate: {
58+
"files": [ "./src/**/*" ],
59+
"tasks": [ "compress", "newer:copy" ],
60+
options: {
61+
debounceDelay: 250,
62+
livereload: true
63+
}
64+
}
65+
},
66+
compress: {
67+
makezip: {
68+
options: {
69+
archive: "./dist/" + pkg.name + ".mpk",
70+
mode: "zip"
71+
},
72+
files: [{
73+
expand: true,
74+
date: new Date(),
75+
store: false,
76+
cwd: "./src",
77+
src: ["**/*"]
78+
}]
79+
}
80+
},
81+
copy: {
82+
deployment: {
83+
files: [
84+
{ dest: TEST_WIDGETS_DEPLOYMENT_FOLDER, cwd: "./src/", src: ["**/*"], expand: true }
85+
]
86+
},
87+
mpks: {
88+
files: [
89+
{ dest: TEST_WIDGETS_FOLDER, cwd: "./dist/", src: [ pkg.name + ".mpk"], expand: true }
90+
]
91+
}
92+
},
93+
clean: {
94+
build: [
95+
path.join(currentFolder, "dist", pkg.name, "/*")
96+
]
97+
},
98+
csslint: {
99+
strict: {
100+
options: {
101+
import: 2
102+
},
103+
src: ["src/" + pkg.name + "/widget/ui/*.css"]
104+
}
105+
}
106+
});
107+
108+
grunt.loadNpmTasks("grunt-contrib-compress");
109+
grunt.loadNpmTasks("grunt-contrib-clean");
110+
grunt.loadNpmTasks("grunt-contrib-watch");
111+
grunt.loadNpmTasks("grunt-contrib-copy");
112+
grunt.loadNpmTasks("grunt-newer");
113+
grunt.loadNpmTasks("grunt-contrib-csslint");
114+
115+
grunt.registerTask("start-modeler", function () {
116+
var done = this.async();
117+
if (MODELER_PATH !== null || (mendixApp.err === null && mendixApp.output !== null && mendixApp.output.cmd && mendixApp.output.arg)) {
118+
grunt.util.spawn({
119+
cmd: MODELER_PATH || mendixApp.output.cmd,
120+
args: [
121+
(MODELER_PATH !== null ? MODELER_ARGS : mendixApp.output.arg).replace("{path}", TEST_PATH)
122+
]
123+
}, function () {
124+
done();
125+
});
126+
} else {
127+
console.error("Cannot start Modeler, see error:");
128+
console.log(mendixApp.err);
129+
done();
130+
}
131+
});
132+
133+
grunt.registerTask("version", function (version) {
134+
var done = this.async();
135+
if (!grunt.file.exists(PACKAGE_XML)) {
136+
grunt.log.error("Cannot find " + PACKAGE_XML);
137+
return done();
138+
}
139+
140+
var xml = grunt.file.read(PACKAGE_XML);
141+
parser.parseString(xml, function (err, res) {
142+
if (err) {
143+
grunt.log.error(err);
144+
return done();
145+
}
146+
if (res.package.clientModule[0]["$"]["version"]) {
147+
var currentVersion = res.package.clientModule[0]["$"]["version"];
148+
if (!version) {
149+
grunt.log.writeln("\nCurrent version is " + currentVersion);
150+
grunt.log.writeln("Set new version by running 'grunt version:x.y.z'");
151+
done();
152+
} else {
153+
if (!semver.valid(version) || !semver.satisfies(version, ">= 1.0.0")) {
154+
grunt.log.error("\nPlease provide a valid version that is higher than 1.0.0. Current version: " + currentVersion);
155+
done();
156+
} else {
157+
res.package.clientModule[0]["$"]["version"] = version;
158+
pkg.version = version;
159+
var xmlString = builder.buildObject(res);
160+
grunt.file.write(PACKAGE_XML, xmlString);
161+
grunt.file.write("package.json", JSON.stringify(pkg, null, 2));
162+
done();
163+
}
164+
}
165+
} else {
166+
grunt.log.error("Cannot find current version number");
167+
}
168+
});
169+
170+
});
171+
172+
grunt.registerTask("generate-icon", function () {
173+
var iconPath = path.join(currentFolder, "/icon.png"),
174+
options = {localFile: true, string: true},
175+
done = this.async();
176+
177+
grunt.log.writeln("Processing icon");
178+
179+
if (!grunt.file.exists(iconPath) || !grunt.file.exists(WIDGET_XML)) {
180+
grunt.log.error("can\'t generate icon");
181+
return done();
182+
}
183+
184+
base64.base64encoder(iconPath, options, function (err, image) {
185+
if (!err) {
186+
var xmlOld = grunt.file.read(WIDGET_XML);
187+
parser.parseString(xmlOld, function (err, result) {
188+
if (!err) {
189+
if (result && result.widget && result.widget.icon) {
190+
result.widget.icon[0] = image;
191+
}
192+
var xmlString = builder.buildObject(result);
193+
grunt.file.write(WIDGET_XML, xmlString);
194+
done();
195+
}
196+
});
197+
} else {
198+
grunt.log.error("can\'t generate icon");
199+
return done();
200+
}
201+
});
202+
});
203+
204+
grunt.registerTask("folders", function () {
205+
var done = this.async();
206+
grunt.log.writeln("\nShowing file paths that Grunt will use. You can edit the package.json accordingly\n");
207+
grunt.log.writeln("TEST_PATH: ", TEST_PATH);
208+
grunt.log.writeln("WIDGET_XML: ", WIDGET_XML);
209+
grunt.log.writeln("PACKAGE_XML: ", PACKAGE_XML);
210+
grunt.log.writeln("TEST_WIDGETS_FOLDER: ", TEST_WIDGETS_FOLDER);
211+
grunt.log.writeln("TEST_WIDGETS_DEPLOYMENT_FOLDER: ", TEST_WIDGETS_DEPLOYMENT_FOLDER);
212+
return done();
213+
});
214+
215+
grunt.registerTask("start-mendix", [ "start-modeler" ]);
216+
217+
grunt.registerTask(
218+
"default",
219+
"Watches for changes and automatically creates an MPK file, as well as copying the changes to your deployment folder",
220+
[ "watch" ]
221+
);
222+
223+
grunt.registerTask(
224+
"clean build",
225+
"Compiles all the assets and copies the files to the build directory.",
226+
[ "clean", "compress", "copy" ]
227+
);
228+
229+
grunt.registerTask(
230+
"build",
231+
[ "clean build" ]
232+
);
233+
};
-377 Bytes
Binary file not shown.

package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "BootstrapMultiSelectForMendix",
3+
"version": "1.6.1",
4+
"description": "",
5+
"license": "",
6+
"author": "",
7+
"private": true,
8+
"dependencies": {
9+
},
10+
"devDependencies": {
11+
"grunt": "^1.0.1",
12+
"grunt-contrib-clean": "^1.0.0",
13+
"grunt-contrib-compress": "^1.3.0",
14+
"grunt-contrib-copy": "^1.0.0",
15+
"grunt-contrib-csslint": "^1.0.0",
16+
"grunt-contrib-watch": "^1.0.0",
17+
"grunt-newer": "^1.2.0",
18+
"node-base64-image": "^0.1.2",
19+
"node-mendix-modeler-path": "https://github.com/JelteMX/node-mendix-modeler-path/archive/v1.0.0.tar.gz",
20+
"semver": "^5.1.0",
21+
"shelljs": "^0.7.4",
22+
"xml2js": "^0.4.17"
23+
},
24+
"engines": {
25+
"node": ">=5"
26+
},
27+
"generatorVersion": "2.0.1",
28+
"paths": {
29+
"testProjectFolder": "./test/",
30+
"testProjectFileName": "Test.mpr"
31+
},
32+
"scripts": {
33+
"build": "grunt build"
34+
}
35+
}

src/BootstrapMultiSelectForMendix/lib/jqwrapper.js

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

src/BootstrapMultiSelectForMendix/widget/BootstrapMultiSelect.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
========================
44
55
@file : BootstrapMultiSelect.js
6-
@version : 1.6
6+
@version : 1.6.1
77
@author : Iain Lindsay
8-
@date : Mon, 22 Feb 2016 10:53:00 GMT
8+
@date : 2017-01-12
99
@copyright : AuraQ Limited 2016
1010
@license : Apache v2
1111
@@ -16,21 +16,7 @@
1616
1717
Available options are held in a separate entity, selected items are stored in a reference set association to that entity.
1818
*/
19-
require({
20-
packages: [{
21-
name: 'jqwrapper',
22-
location: '../../widgets/BootstrapMultiSelectForMendix/lib',
23-
main: 'jqwrapper'
24-
}, {
25-
name: 'bootstrap',
26-
location: '../../widgets/BootstrapMultiSelectForMendix/lib',
27-
main: 'bootstrap'
28-
}, {
29-
name: 'bootstrap-multiselect',
30-
location: '../../widgets/BootstrapMultiSelectForMendix/lib',
31-
main: 'bootstrap-multiselect'
32-
}]
33-
}, [
19+
define( [
3420
'dojo/_base/declare',
3521
'mxui/widget/_WidgetBase',
3622
'dijit/_TemplatedMixin',
@@ -48,14 +34,14 @@ require({
4834
'dojo/text',
4935
'dojo/html',
5036
'dojo/_base/event',
51-
'jqwrapper',
52-
'bootstrap',
53-
'bootstrap-multiselect',
37+
'BootstrapMultiSelectForMendix/lib/jquery-1.11.2',
38+
'BootstrapMultiSelectForMendix/lib/bootstrap',
39+
'BootstrapMultiSelectForMendix/lib/bootstrap-multiselect',
5440
'dojo/text!BootstrapMultiSelectForMendix/widget/templates/BootstrapMultiSelect.html'
55-
], function (declare, _WidgetBase, _TemplatedMixin, _AttachMixin, dom, dojoDom, domQuery, domProp, domGeom, domClass, domStyle, domConstruct, dojoArray, lang, text, html, event, _jqwrapper, _bootstrap, _bootstrapMultiSelect, widgetTemplate) {
41+
], function (declare, _WidgetBase, _TemplatedMixin, _AttachMixin, dom, dojoDom, domQuery, domProp, domGeom, domClass, domStyle, domConstruct, dojoArray, lang, text, html, event, _jQuery, _bootstrap, _bootstrapMultiSelect, widgetTemplate) {
5642
'use strict';
5743

58-
var $ = _jqwrapper;
44+
var $ = _jQuery.noConflict(true);
5945
$ = _bootstrap.createInstance($);
6046
$ = _bootstrapMultiSelect.createInstance($);
6147

src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="BootstrapMultiSelectForMendix" version="1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="BootstrapMultiSelectForMendix" version="1.6.1" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="BootstrapMultiSelectForMendix/BootstrapMultiSelect.xml"/>
66
</widgetFiles>
-377 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)