Skip to content

Commit

Permalink
update meteor 1.5.2, new method K.Util.tmpl
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocudini committed Sep 29, 2017
1 parent 2b4ef32 commit 48fb76f
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@1.5.1
METEOR@1.5.2.1
31 changes: 16 additions & 15 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
accounts-base@1.3.1
accounts-base@1.3.3
accounts-facebook@1.2.1
accounts-google@1.2.0
accounts-oauth@1.1.15
accounts-password@1.4.0
allow-deny@1.0.9
anti:i18n@0.4.3
autoupdate@1.3.12
babel-compiler@6.19.4
babel-compiler@6.20.0
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
blaze@2.3.2
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.1.1
boilerplate-generator@1.2.0
caching-compiler@1.1.9
caching-html-compiler@1.1.2
callback-hook@1.0.10
check@1.2.5
ddp@1.3.0
ddp-client@2.0.0
ddp@1.3.1
ddp-client@2.1.3
ddp-common@1.2.9
ddp-rate-limiter@1.0.7
ddp-server@2.0.0
ddp-server@2.0.2
deps@1.0.12
diff-sequence@1.0.7
dynamic-import@0.1.1
ecmascript@0.8.2
dynamic-import@0.1.3
ecmascript@0.8.3
ecmascript-runtime@0.4.1
ecmascript-runtime-client@0.4.3
ecmascript-runtime-server@0.4.1
Expand Down Expand Up @@ -81,11 +81,12 @@ matb33:collection-hooks@0.8.4
meteor@1.7.2
meteor-base@1.1.0
minifier-css@1.2.16
minifier-js@2.1.1
minimongo@1.2.1
modules@0.9.4
minifier-js@2.1.4
minimongo@1.3.2
modules@0.10.0
modules-runtime@0.8.0
mongo@1.1.22
mongo@1.2.2
mongo-dev-server@1.0.1
mongo-id@1.0.6
mrt:imagemagick@0.1.2
mrt:modernizr-meteor@2.6.2
Expand All @@ -99,7 +100,7 @@ oauth1@1.1.11
oauth2@1.1.11
observe-sequence@1.0.16
ordered-dict@1.0.9
promise@0.8.9
promise@0.9.0
random@1.0.10
rate-limit@1.0.8
reactive-dict@1.1.9
Expand All @@ -116,7 +117,7 @@ spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.10
standard-minifier-css@1.3.5
standard-minifier-js@2.1.1
standard-minifier-js@2.1.2
stylus@2.513.9
templating@1.3.2
templating-compiler@1.3.3
Expand All @@ -129,6 +130,6 @@ underscore@1.0.10
underscorestring:underscore.string@3.3.4
url@1.1.0
verron:autosize@3.0.8
webapp@1.3.17
webapp@1.3.19
webapp-hashing@1.0.9
zenorocha:clipboard@1.7.1
25 changes: 25 additions & 0 deletions packages/keplerjs-core/modules/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ Kepler.Util = {
return obj[last];
},

/**
* [tmpl description]
* @param {String} str [description]
* @param {Object} data [description]
* @return {String} [description]
*/
tmpl: function(str, data) {
/*
origin Leflet.js
*/
var templateRe = /\{ *([\w_\-]+) *\}/g;

return str.replace(templateRe, function (str, key) {
var value = data[key];

if (value === undefined) {
throw new Error('No value provided for variable ' + str);

} else if (typeof value === 'function') {
value = value(data);
}
return value;
});
},

dateUtcToLocal: function(date) {
var newDate = new Date(date.getTime()+date.getTimezoneOffset()*60*1000),
offset = date.getTimezoneOffset() / 60,
Expand Down
4 changes: 0 additions & 4 deletions packages/keplerjs-lib/config/underscore.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@

_.templateSettings = {
interpolate: /\{(.+?)\}/g
};

//bind underscore string
_.str = s;

Expand Down
1 change: 0 additions & 1 deletion packages/keplerjs-lib/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ Package.onUse(function(api) {
'accounts-google',
//'accounts-twitter',


'blaze-html-templates@1.1.2',
'matb33:collection-hooks@0.8.4',
'underscorestring:underscore.string@3.3.4',
Expand Down
8 changes: 4 additions & 4 deletions packages/keplerjs-osm/server/Osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Kepler.Osm = {

queryTmpl = queryTmplId;

tags = _.template(queryTmpl, {
tags = K.Util.tmpl(queryTmpl, {
id: opts.id,
type: opts.type
});
Expand All @@ -76,7 +76,7 @@ Kepler.Osm = {

tags += '(';
for(var f in opts.filter) {
tags += _.template(queryTmpl, {
tags += K.Util.tmpl(queryTmpl, {

bbox: bbox,

Expand All @@ -92,7 +92,7 @@ Kepler.Osm = {

}else{

tags = _.template(queryTmpl, {
tags = K.Util.tmpl(queryTmpl, {

bbox: bbox,

Expand All @@ -106,7 +106,7 @@ Kepler.Osm = {
}
}

foot = _.template('out{meta} {limit};', {
foot = K.Util.tmpl('out{meta} {limit};', {
meta: opts.meta ? ' meta' : '',
limit: opts.limit
});
Expand Down
8 changes: 4 additions & 4 deletions packages/keplerjs-share/client/views/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Template.panelPlace_share.helpers({
};

return {
google: _.template("http://maps.google.com/maps?ll={lat},{lon}&spn=0.5,0.5&t=h&q={lat},{lon}", loc),
apple: _.template("http://maps.apple.com/?ll={lat},{lon}", loc),
osm: _.template("http://osm.org/?mlat={lat}&mlon={lon}#map={zoom}/{lat}/{lon}", loc),
//TODO bing: _.template("http://maps.live.com/default.aspx?v=2&cp={lat}~{lon}&style=h", loc),
google: K.Util.tmpl("http://maps.google.com/maps?ll={lat},{lon}&spn=0.5,0.5&t=h&q={lat},{lon}", loc),
apple: K.Util.tmpl("http://maps.apple.com/?ll={lat},{lon}", loc),
osm: K.Util.tmpl("http://osm.org/?mlat={lat}&mlon={lon}#map={zoom}/{lat}/{lon}", loc),
//TODO bing: K.Util.tmpl("http://maps.live.com/default.aspx?v=2&cp={lat}~{lon}&style=h", loc),
};

}
Expand Down
2 changes: 1 addition & 1 deletion packages/keplerjs-ui/client/views/panels/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Template.panelSettings.helpers({
val: k,
name: i18n('map_layer_'+k),
active: k===layer,
url: _.template(val,{s:'a',z:'15',x:'17374',y:'11667'})
url: K.Util.tmpl(val,{s:'a',z:'15',x:'17374',y:'11667'})
};
});
},
Expand Down
2 changes: 1 addition & 1 deletion packages/keplerjs-upload/server/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Meteor.methods({
},
fileUid = Meteor.user().username +'_'+ K.Util.time(),
fileName = K.Util.sanitize.filename( fileUid ),
fileMin = fileName + _.template('_{width}x{height}.min.jpg', imgSize),
fileMin = fileName + K.Util.tmpl('_{width}x{height}.min.jpg', imgSize),
fileBig = fileName + '.ori.jpg',
imgOpts = _.extend(imgSize, {
srcPath: filePath + fileBig,
Expand Down

0 comments on commit 48fb76f

Please sign in to comment.