Style save button counter

This commit is contained in:
Tom MacWright
2013-01-04 16:33:33 -05:00
parent 70de57b784
commit 39e93b5f42
2 changed files with 26 additions and 4 deletions
+17 -2
View File
@@ -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
View File
@@ -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')