Pay attention to field types, style things a little bit better.

This commit is contained in:
Tom MacWright
2013-01-31 14:38:24 -05:00
parent 60c14dc7ac
commit 095ed4b486
4 changed files with 125 additions and 99 deletions
+12 -1
View File
@@ -94,7 +94,10 @@ a:hover {
textarea,
input[type=text] {
input[type=text],
input[type=url],
input[type=tel],
input[type=email] {
background-color: white;
border:1px solid #ccc;
padding:10px;
@@ -1288,3 +1291,11 @@ a.success-action {
height:30px;
margin: 5px;
}
.preset-label {
padding: 5px;
}
.preset-input input {
width: 100%;
}
+2 -2
View File
@@ -69,11 +69,11 @@ iD.ui.preset = function() {
.attr('class', 'preset-section-input cf');
wrap.append('div')
.attr('class', 'col6')
.attr('class', 'col4 preset-label')
.text(d.text);
input.call(wrap.append('div')
.attr('class', 'col6'), d);
.attr('class', 'col8 preset-input'), d);
});
}
+18 -3
View File
@@ -1,16 +1,23 @@
from xml.dom.minidom import parse
import os
import os, re, json
dirr = os.path.dirname(__file__)
import json
def relative(x):
return os.path.join(dirr, x)
dom1 = parse(relative('./josm.xml'))
items = dom1.getElementsByTagName('item')
jsonOutput = []
def isemail(x):
return re.search('email', x, flags=re.IGNORECASE)
def iswebsite(x):
return re.search('web', x, flags=re.IGNORECASE)
def istel(x):
return re.search('phone|tel|fax', x, flags=re.IGNORECASE)
for item in items:
jitem = {
"name": item.getAttribute('name'),
@@ -20,8 +27,16 @@ for item in items:
for n in item.childNodes:
if n.nodeType != n.TEXT_NODE and n.nodeType != n.COMMENT_NODE:
if n.tagName == 'text':
txt = n.getAttribute('text')
type = 'text'
if isemail(txt):
type = 'email'
if iswebsite(txt):
type = 'url'
if istel(txt):
type = 'tel'
jitem['main'].append({
'type': 'text',
'type': type,
'key': n.getAttribute('key'),
'text': n.getAttribute('text')
})
+93 -93
View File
@@ -2893,22 +2893,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -2981,7 +2981,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -3132,22 +3132,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -3607,22 +3607,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -3702,22 +3702,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -3792,22 +3792,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -3882,22 +3882,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -3977,22 +3977,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4063,22 +4063,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4180,22 +4180,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4270,22 +4270,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4381,22 +4381,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4498,22 +4498,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4584,22 +4584,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4683,22 +4683,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4780,22 +4780,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4866,22 +4866,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -4952,22 +4952,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -5017,22 +5017,22 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
}
],
@@ -5315,7 +5315,7 @@
},
{
"text": "Phone number",
"type": "text",
"type": "tel",
"key": "phone"
}
],
@@ -5795,12 +5795,12 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -6228,7 +6228,7 @@
},
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
}
],
@@ -10730,7 +10730,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10764,7 +10764,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10798,7 +10798,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10832,7 +10832,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10866,7 +10866,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10900,7 +10900,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10934,7 +10934,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -10963,7 +10963,7 @@
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
}
],
@@ -11785,22 +11785,22 @@
"main": [
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "email"
},
{
@@ -11826,22 +11826,22 @@
"main": [
{
"text": "Phone Number",
"type": "text",
"type": "tel",
"key": "contact:phone"
},
{
"text": "Fax Number",
"type": "text",
"type": "tel",
"key": "contact:fax"
},
{
"text": "Website",
"type": "text",
"type": "url",
"key": "contact:website"
},
{
"text": "Email Address",
"type": "text",
"type": "email",
"key": "contact:email"
},
{