mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Extract TagReferenceButton
This commit is contained in:
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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')
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user