Add dimensions, improve make situation for presets.

This commit is contained in:
Tom MacWright
2013-03-08 16:18:20 -05:00
parent c9bbf9e6b6
commit 1294c972d0
9 changed files with 23 additions and 1924 deletions
+3 -2
View File
@@ -17,11 +17,12 @@ data/presets/presets.json: $(PRESET_FILES)
# TODO: write a nice node script for this
data/data.js: \
data \
data/deprecated.json \
data/discarded.json \
data/imagery.json \
data/keys.json
node data/make.js
node build.js
.INTERMEDIATE iD.js: \
js/lib/bootstrap-tooltip.js \
@@ -77,7 +78,7 @@ iD.js: Makefile
%.min.js: %.js Makefile
@rm -f $@
$(JS_COMPILER) $< -c -m -o $@
$(JS_COMPILER) $< -m -o $@
clean:
rm -f iD*.js
+1
View File
@@ -133,6 +133,7 @@ a:hover {
textarea,
input[type=text],
input[type=search],
input[type=number],
input[type=url],
input[type=tel],
input[type=email] {
-16
View File
@@ -1,16 +0,0 @@
var fs = require('fs');
function r(f) { return JSON.parse(fs.readFileSync(__dirname + '/' + f)); }
function rp(f) { return r('presets/' + f); }
fs.writeFileSync('data.js', 'iD.data = ' + JSON.stringify({
deprecated: r('deprecated.json'),
discarded: r('discarded.json'),
keys: r('keys.json'),
presets: {
presets: rp('presets.json'),
defaults: rp('defaults.json'),
categories: rp('categories.json'),
forms: rp('forms.json')
}
}));
-8
View File
@@ -1,8 +0,0 @@
#!/bin/bash
dir=$(dirname $0)
presets=$(find $dir/presets -name "*.json" -exec cat {} \; -exec echo , \;)
echo [${presets%?}] > $dir/presets.json
node -e "
var fs = require('fs');
fs.writeFileSync('$dir/presets.json', JSON.stringify(JSON.parse(fs.readFileSync('$dir/presets.json', 'utf8')), null, 4));
"
+5
View File
@@ -41,6 +41,11 @@
"type": "combo",
"default": { "area": "yes" }
},
"levels": {
"key": "building:levels",
"type": "number",
"title": "Levels"
},
"fee": {
"key": "fee",
"type": "check"
+1 -1895
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -12,6 +12,7 @@
"icon": "warehouse",
"form": [
"building_yes",
"levels",
"address"
]
}
}
+9 -1
View File
@@ -80,6 +80,13 @@ iD.ui.preset = function(context) {
.attr('placeholder', 'http://example.com/')
.call(iD.behavior.accept().on('accept', event.close));
break;
case 'number':
i = this.append('input')
.attr('type', 'number')
.attr('id', 'input-' + d.key)
.attr('placeholder', '0')
.call(iD.behavior.accept().on('accept', event.close));
break;
case 'check':
wrap = this.append('span').attr('class', 'input-wrap-position'),
i = wrap.append('input').attr('type', 'text');
@@ -87,7 +94,6 @@ iD.ui.preset = function(context) {
wrap.call(check);
event.on('setTags.' + d.key, check.update);
break;
case 'select':
wrap = this.append('span').attr('class', 'input-wrap-position'),
i = wrap.append('input').attr('type', 'text');
@@ -122,6 +128,8 @@ iD.ui.preset = function(context) {
}));
});
break;
default:
throw 'Unknown input type ' + d.type;
}
if (i) {
i.on('change', key);
+2 -1
View File
@@ -21,6 +21,7 @@
"license": "WTFPL",
"devDependencies": {
"uglify-js": "~2.2.2",
"mocha-phantomjs": "~1.1.1"
"mocha-phantomjs": "~1.1.1",
"glob": "~3.1.21"
}
}