mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 00:07:03 +02:00
Style save button counter
This commit is contained in:
+17
-2
@@ -291,10 +291,25 @@ button.delete:hover {
|
||||
|
||||
button.save {
|
||||
background-color: #6bc641;
|
||||
width: 120px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
button.save[disabled] {
|
||||
background-color: #92BB7F;
|
||||
button.save.has-count {
|
||||
padding-right:10px;
|
||||
}
|
||||
|
||||
button.save.has-count .count {
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-size:small;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
height: 37px;
|
||||
border-radius: 0 3px 3px 0;
|
||||
padding: 0 10px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
button.save:hover {
|
||||
|
||||
+9
-2
@@ -158,15 +158,22 @@ window.iD = function(container) {
|
||||
}
|
||||
});
|
||||
|
||||
save_button.append('span').attr('class', 'count');
|
||||
save_button.append('span')
|
||||
.attr('class', 'count');
|
||||
|
||||
history.on('change.save-button', function() {
|
||||
var changes = history.changes(),
|
||||
num_changes = d3.sum(d3.values(changes).map(function(c) {
|
||||
return c.length;
|
||||
}));
|
||||
|
||||
save_button.property('disabled', num_changes === 0);
|
||||
save_button.select('span.count').text(num_changes === 0 ? '' : num_changes);
|
||||
|
||||
save_button
|
||||
.classed('has-count', num_changes > 0);
|
||||
|
||||
save_button.select('span.count')
|
||||
.text(num_changes);
|
||||
});
|
||||
|
||||
bar.append('div')
|
||||
|
||||
Reference in New Issue
Block a user