Add ability to put an OK button on the curtain-tooltip

This commit is contained in:
Bryan Housel
2017-03-26 00:35:00 -04:00
parent 6cc524a0a0
commit b7267e0571
5 changed files with 27 additions and 5 deletions
+1
View File
@@ -3646,6 +3646,7 @@ img.tile-removing {
padding: 20px;
}
.curtain-tooltip .tooltip-inner .button-section,
.curtain-tooltip .tooltip-inner .bold {
font-weight: bold;
display: block;
+1
View File
@@ -778,6 +778,7 @@ en:
click the "Merge" (+) button.
intro:
done: done
ok: OK
graph:
city_hall: Three Rivers City Hall
fire_department: Three Rivers Fire Department
+1
View File
@@ -635,6 +635,7 @@
},
"intro": {
"done": "done",
"ok": "OK",
"graph": {
"city_hall": "Three Rivers City Hall",
"fire_department": "Three Rivers Fire Department",
+20 -1
View File
@@ -62,7 +62,14 @@ export function uiCurtain() {
// pseudo markdown bold text hack
var parts = text.split('**');
var html = parts[0] ? '<span>' + parts[0] + '</span>' : '';
if (parts[1]) html += '<span class="bold">' + parts[1] + '</span>';
if (parts[1]) {
html += '<span class="bold">' + parts[1] + '</span>';
}
if (options.buttonText && options.buttonCallback) {
html += '<div class="button-section">' +
'<button href="#" class="button action col8">' + options.buttonText + '</button></div>';
}
var classes = 'curtain-tooltip tooltip in ' + (options.tooltipClass || '');
tooltip
@@ -70,6 +77,18 @@ export function uiCurtain() {
.selectAll('.tooltip-inner')
.html(html);
if (options.buttonText && options.buttonCallback) {
var button = tooltip.selectAll('.button-section .button.action');
button
.on('click', function() {
d3.event.preventDefault();
options.buttonCallback();
});
button.node().focus();
}
// var dimensions = utilGetDimensions(selection, true),
var tip = tooltip.node().getBoundingClientRect(),
w = window.innerWidth,
+4 -4
View File
@@ -26,10 +26,10 @@ export function uiIntroNavigation(context, reveal) {
function welcome() {
reveal('.intro-nav-wrap', 'This walkthrough will teach you the basics of editing on OpenStreetMap.');
timeout(function() {
dragMap();
}, 5000);
reveal('.intro-nav-wrap',
'Welcome! This walkthrough will teach you the basics of editing on OpenStreetMap.',
{ buttonText: t('intro.ok'), buttonCallback: dragMap }
);
}