Extract TagReferenceButton

This commit is contained in:
John Firebaugh
2013-05-21 15:11:28 -07:00
parent abf7c14b13
commit 3249487632
6 changed files with 27 additions and 21 deletions
+3 -3
View File
@@ -1413,15 +1413,15 @@ div.combobox {
border-top-width: 1px;
}
.tag-row:first-child button.tag-help-button {
.tag-row:first-child .tag-reference-button {
border-top-right-radius: 4px;
}
.tag-row:last-child button.tag-help-button {
.tag-row:last-child .tag-reference-button {
border-bottom-right-radius: 4px;
}
.tag-row button.tag-help-button {
.tag-row .tag-reference-button {
right: 0;
}
+1
View File
@@ -83,6 +83,7 @@
<script src='js/id/ui/spinner.js'></script>
<script src='js/id/ui/restore.js'></script>
<script src='js/id/ui/tag_reference.js'></script>
<script src='js/id/ui/tag_reference_button.js'></script>
<script src='js/id/ui/preset.js'></script>
<script src='js/id/ui/preset_icon.js'></script>
<script src='js/id/ui/lasso.js'></script>
+2 -6
View File
@@ -125,12 +125,8 @@ iD.ui.preset = function(context, entity, preset) {
.attr('for', function(field) { return 'preset-input-' + field.id; })
.text(function(field) { return field.label(); });
label.append('button')
.attr('class', 'tag-reference-button minor')
.attr('tabindex', -1)
.on('click', toggleReference)
.append('span')
.attr('class', 'icon inspect');
label.call(iD.ui.TagReferenceButton()
.on('click', toggleReference));
label.append('button')
.attr('class', 'modified-icon minor')
+2 -6
View File
@@ -214,12 +214,8 @@ iD.ui.PresetGrid = function(context, entity) {
.text(function(d) { return d.name(); });
entered.filter(function(d) { return !d.members; })
.append('button')
.attr('tabindex', -1)
.attr('class', 'tag-reference-button minor')
.on('click', helpClick)
.append('span')
.attr('class', 'icon inspect');
.call(iD.ui.TagReferenceButton()
.on('click', helpClick));
entries.order();
}
+17
View File
@@ -0,0 +1,17 @@
iD.ui.TagReferenceButton = function() {
var dispatch = d3.dispatch('click');
function button(selection) {
var button = selection.append('button')
.attr('tabindex', -1)
.attr('class', 'tag-reference-button minor')
.on('click', dispatch.click);
button.append('span')
.attr('class', 'icon inspect');
return button;
}
return d3.rebind(button, dispatch, 'on')
};
+2 -6
View File
@@ -100,9 +100,7 @@ iD.ui.Taglist = function(context, entity) {
.append('span')
.attr('class', 'icon delete');
row.append('button')
.attr('tabindex', -1)
.attr('class', 'tag-help-button minor')
row.call(iD.ui.TagReferenceButton()
.on('click', function(tag) {
tags.forEach(function(other) {
if (other.key === tag.key) {
@@ -111,9 +109,7 @@ iD.ui.Taglist = function(context, entity) {
other.reference.hide();
}
});
})
.append('span')
.attr('class', 'icon inspect');
}));
row.each(function(tag) {
d3.select(this).call(tag.reference);