From 78e4271071dad9f5b46b768afa66ed1110bc53a1 Mon Sep 17 00:00:00 2001 From: samanpwbb Date: Fri, 6 Feb 2015 19:07:57 -0500 Subject: [PATCH] finish basic layout/style pass --- css/app.css | 110 +++++++++++++++++++++++++------------------ data/core.yaml | 16 +++---- dist/locales/en.json | 12 ++--- index.html | 7 +++ js/id/modes/save.js | 76 ++++++++++++++++++------------ js/id/ui/commit.js | 2 +- 6 files changed, 134 insertions(+), 89 deletions(-) diff --git a/css/app.css b/css/app.css index 30ea1813d..ec44e1f16 100644 --- a/css/app.css +++ b/css/app.css @@ -418,6 +418,10 @@ button.minor:hover { border-right: 1px solid rgba(0,0,0,.5); } +.fillL .joined button { + border-right: 1px solid white; +} + .joined button:first-child { border-radius:4px 0 0 4px; } @@ -429,6 +433,7 @@ button.minor:hover { button.action { background: #7092ff; + color: white; } button.action:focus, @@ -436,6 +441,15 @@ button.action:hover { background: #597BE7; } +button.secondary-action { + background: #ececec; +} + +button.secondary-action:focus, +button.secondary-action:hover { + background: #cccccc; +} + button.save.has-count { padding: 9px; } @@ -619,7 +633,7 @@ a:hover .icon.out-link { background-position: -500px -14px;} } .header h3 { - text-align: center; + text-align: left; margin-bottom: 0; white-space: nowrap; text-overflow: ellipsis; @@ -2311,6 +2325,7 @@ img.wiki-image { .modal { display: inline-block; position:absolute; + border-radius: 0 0 3px 3px; left: 0; right: 0; margin: auto; @@ -2362,42 +2377,6 @@ img.wiki-image { vertical-align: middle; } -.conflicts-help { - color: #8a6d3b; - background-color: #fcf8e3; - border-color: #faebcc; - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px; -} - -.error-detail-item { - padding-left: 10px; -} - -.error-detail-item:before { - content: '- '; -} - -.error-detail-container .error-choices { - padding: 5px; -} - -.error-detail-container .error-choices .error-choice.action { - display: inline-block; - margin: 0 5px; - text-align: center; - vertical-align: middle; - font-size: 12px; - font-weight: normal; - height: 30px; -} - -.modal-section:last-child { - border-bottom: 0; -} - .loading-modal { text-align: center; } @@ -2434,6 +2413,10 @@ img.wiki-image { border-right: 1px solid #CCC; } +.modal-section:last-child { + border-bottom: 0; +} + /* Restore Modal ------------------------------------------------------- */ @@ -2503,14 +2486,6 @@ img.wiki-image { margin-bottom: 0; } -.mode-save button.action { - float: none; - margin: auto; - display: block; - color: white; - font-size: 14px; -} - .mode-save .user-info img { float: left; } @@ -2573,6 +2548,51 @@ img.wiki-image { .changeset-list li:first-child { border-top: 0;} +/* Conflict resolution +------------------------------------------------------- */ + +.conflicts-help { + padding: 20px; + background-color: #ffffbb; + border-bottom: 1px solid #ccc; + margin-bottom: 20px; +} + +.conflicts-message-text { + padding: 0 20px; + margin-bottom: 20px; +} + +.conflicts-buttons { + padding: 20px; + border-top: 1px solid #ccc; +} + +.mode-save button.conflicts-button { + float: left; +} + +.error-detail-container { + display: block; + padding: 20px; + background: #f6f6f6; + border-radius: 3px; + margin: 10px 0; +} + +.error-detail-item { + margin-left: 15px; + list-style: disc; +} + +.error-choice-buttons { + margin-top: 10px; +} + +.error-choice-button { + height: 30px; +} + /* Notices ------------------------------------------------------- */ diff --git a/data/core.yaml b/data/core.yaml index 63662c451..594be8c53 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -319,10 +319,10 @@ en: uploading: Uploading changes to OpenStreetMap. unsaved_changes: You have unsaved changes conflict: - header: Conflicting edits detected + header: Resolve conflicting edits message: 'Conflicting edits were made to {name}' - keep_local: Keep Mine - keep_remote: Keep Theirs + keep_local: Keep my changes + keep_remote: Discard my changes restore: Restore delete: Leave Deleted annotation: @@ -331,12 +331,12 @@ en: keep_remote: 'Kept remote version of {id}.' restore: 'Restored local version of {id}.' delete: 'Deleted local version of {id}.' - try_again: Try Again - download_changes: Download Changes + try_again: Try to Save + download_changes: Download your changes. help: | - It looks like another OpenStreetMap user has changed some of the same map features that you changed. - You can click on each item below for more details about the conflict, and choose whether to keep - your changes or the other user's changes. Or, you can download your changes to a file. + Another user changed some of the same map features you changed. + Click on each item below for more details about the conflict, and choose whether to keep + your changes or the other user's changes. merge_remote_changes: conflict: location: Location was changed both locally and remotely. diff --git a/dist/locales/en.json b/dist/locales/en.json index fb86fcbea..c14ddf3dc 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -393,10 +393,10 @@ "uploading": "Uploading changes to OpenStreetMap.", "unsaved_changes": "You have unsaved changes", "conflict": { - "header": "Conflicting edits detected", + "header": "Resolve conflicting edits", "message": "Conflicting edits were made to {name}", - "keep_local": "Keep Mine", - "keep_remote": "Keep Theirs", + "keep_local": "Keep my changes", + "keep_remote": "Discard my changes", "restore": "Restore", "delete": "Leave Deleted", "annotation": { @@ -406,9 +406,9 @@ "restore": "Restored local version of {id}.", "delete": "Deleted local version of {id}." }, - "try_again": "Try Again", - "download_changes": "Download Changes", - "help": "It looks like another OpenStreetMap user has changed some of the same map features that you changed.\nYou can click on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes. Or, you can download your changes to a file.\n" + "try_again": "Try to Save", + "download_changes": "Download your changes.", + "help": "Another user changed some of the same map features you changed.\nClick on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" } }, "merge_remote_changes": { diff --git a/index.html b/index.html index db41a3522..f9c75ac76 100644 --- a/index.html +++ b/index.html @@ -258,6 +258,13 @@ "oauth_secret": "aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p" } ])); + id.connection() + .switch({ + "url": "http://api06.dev.openstreetmap.org", + "oauth_consumer_key": "zwQZFivccHkLs3a8Rq5CoS412fE5aPCXDw9DZj7R", + "oauth_secret": "aMnOOCwExO2XYtRVWJ1bI9QOdqh1cay2UgpbhA6p" + }); + }); diff --git a/js/id/modes/save.js b/js/id/modes/save.js index 1e6e6281d..aee7fefc8 100644 --- a/js/id/modes/save.js +++ b/js/id/modes/save.js @@ -161,29 +161,56 @@ iD.modes.Save = function(context) { } function showConflicts() { - confirm = iD.ui.confirm(context.container()); + confirm = context.container() + .select('#sidebar') + .append('div') + .attr('class','sidebar-component'); + loading.close(); - confirm - .select('.modal-section.header') - .append('h3') + var header = confirm.append('div') + .attr('class', 'header fillL'); + + header.append('button') + .attr('class', 'fr') + .on('click', cancel) + .append('span') + .attr('class', 'icon close'); + + header.append('h3') .text(t('save.conflict.header')); - confirm - .select('.modal-section.message-text') - .append('div') + var body = confirm.append('div') + .attr('class', 'body fillL'); + + body.append('div') .attr('class', 'conflicts-help') - .text(t('save.conflict.help')); + .text(t('save.conflict.help')) + .append('a') + .attr('class', 'conflicts-download') + .on('click.download', function() { + var diff = iD.actions.DiscardTags(history.difference()), + changes = history.changes(diff), + data = JXON.stringify(context.connection().osmChangeJXON('CHANGEME', changes)), + win = window.open('data:text/xml,' + encodeURIComponent(data), '_blank'); + + win.focus(); + confirm.remove(); + }) + .text(t('save.conflict.download_changes')); + + var message = body.append('div') + .attr('class','message-text conflicts-message-text'); addItems(confirm, conflicts); - - var buttons = confirm - .select('.modal-section.buttons'); + var buttons = body + .append('div') + .attr('class','buttons col12 joined conflicts-buttons'); buttons .append('button') - .attr('class', 'action col3') + .attr('class', 'action conflicts-button col6') .on('click.try_again', function() { confirm.remove(); save(e); @@ -192,25 +219,12 @@ iD.modes.Save = function(context) { buttons .append('button') - .attr('class', 'action col3') + .attr('class', 'secondary-action conflicts-button col6') .on('click.cancel', function() { confirm.remove(); }) .text(t('confirm.cancel')); - buttons - .append('button') - .attr('class', 'action col3') - .on('click.download', function() { - var diff = iD.actions.DiscardTags(history.difference()), - changes = history.changes(diff), - data = JXON.stringify(context.connection().osmChangeJXON('CHANGEME', changes)), - win = window.open('data:text/xml,' + encodeURIComponent(data), '_blank'); - - win.focus(); - confirm.remove(); - }) - .text(t('save.conflict.download_changes')); } function showErrors() { @@ -228,12 +242,16 @@ iD.modes.Save = function(context) { function addItems(confirm, data) { var message = confirm - .select('.modal-section.message-text'); + .select('.message-text'); + + console.log(message); var items = message .selectAll('.error-container') .data(data); + console.log(data); + var enter = items.enter() .append('div') .attr('class', 'error-container'); @@ -272,12 +290,12 @@ iD.modes.Save = function(context) { details .append('div') - .attr('class', 'error-choices cf') + .attr('class', 'error-choice-buttons joined cf') .selectAll('button') .data(function(d) { return d.choices || []; }) .enter() .append('button') - .attr('class', 'error-choice action col2') + .attr('class', 'error-choice-button action col6') .text(function(d) { return d.text; }) .on('click', function(d) { d.action(); diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index 6b4cb364a..091ea4042 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -116,7 +116,7 @@ iD.ui.Commit = function(context) { // Confirm Button var saveButton = saveSection.append('button') - .attr('class', 'action col4 button') + .attr('class', 'action col6 button') .on('click.save', function() { event.save({ comment: commentField.node().value