Change tooltip for save button depending on disabled state. Fixes #573

This commit is contained in:
Tom MacWright
2013-03-05 15:29:44 -05:00
parent f81ce9daee
commit 64200b9920
2 changed files with 9 additions and 2 deletions

View File

@@ -78,10 +78,11 @@ iD.ui.Save = function(context) {
.attr('class', 'save col12 disabled')
.attr('tabindex', -1)
.on('click', save)
.attr('data-original-title',
iD.ui.tooltipHtml(t('save.no_changes'), key))
.call(bootstrap.tooltip()
.placement('bottom')
.html(true)
.title(iD.ui.tooltipHtml(t('save.help'), key)));
.html(true));
button.append('span')
.attr('class', 'label')
@@ -99,6 +100,11 @@ iD.ui.Save = function(context) {
context.history().on('change.save', function() {
var hasChanges = history.hasChanges();
button
.attr('data-original-title',
iD.ui.tooltipHtml(t(hasChanges ?
'save.help' : 'save.no_changes'), key));
button
.classed('disabled', !hasChanges)
.classed('has-count', hasChanges);

View File

@@ -205,6 +205,7 @@ locale.en = {
save: {
title: "Save",
help: "Save changes to OpenStreetMap, making them visible to other users.",
no_changes: "No changes to save.",
error: "An error occurred while trying to save",
uploading: "Uploading changes to OpenStreetMap.",
unsaved_changes: "You have unsaved changes"