big commit modal cleanup.

This commit is contained in:
Saman Bemel-Benrud
2013-03-21 17:02:22 -04:00
parent 36da7fee4e
commit 992df47cac
10 changed files with 105 additions and 175 deletions
+19 -25
View File
@@ -28,22 +28,30 @@ iD.ui.Commit = function(context) {
var changes = selection.datum(),
connection = changes.connection,
user = connection.user(),
header = selection.append('div').attr('class', 'header modal-section fillL'),
header = selection.append('div').attr('class', 'header modal-section'),
body = selection.append('div').attr('class', 'body');
header.append('h2')
header.append('h3')
.text(t('commit.title'));
// Comment Section
var commentSection = body.append('div')
.attr('class', 'modal-section fillD');
.attr('class', 'modal-section preset-field');
var commentField = commentSection.append('textarea')
.attr('class', 'changeset-comment')
.attr('placeholder', t('commit.description_placeholder'))
.property('value', context.storage('comment') || '');
commentSection.append('h4')
.attr('for','input-commit-note')
.text(t('commit.message_label'));
var commentField = commentSection
.append('textarea')
.attr('placeholder', t('commit.description_placeholder'))
.property('value', context.storage('comment') || '');
commentField.node().select();
// Save Section
var saveSection = body.append('div').attr('class','modal-section cf');
var userLink = d3.select(document.createElement('div'));
if (user.image_url) {
@@ -58,18 +66,14 @@ iD.ui.Commit = function(context) {
.attr('href', connection.url() + '/user/' + user.display_name)
.attr('target', '_blank');
commentSection.append('p')
saveSection.append('p')
.attr('class', 'commit-info')
.html(t('commit.upload_explanation', {user: userLink.html()}));
// Confirm / Cancel Buttons
var buttonWrap = commentSection.append('div')
.attr('class', 'buttons cf')
.append('div')
.attr('class', 'button-wrap joined col4');
var saveButton = buttonWrap.append('button')
.attr('class', 'save action col6 button')
var saveButton = saveSection.append('button')
.attr('class', 'action col3 button')
.on('click.save', function() {
var comment = commentField.node().value;
localStorage.comment = comment;
@@ -82,21 +86,11 @@ iD.ui.Commit = function(context) {
.attr('class', 'label')
.text(t('commit.save'));
var cancelButton = buttonWrap.append('button')
.attr('class', 'cancel col6 button')
.on('click.cancel', function() {
event.cancel();
});
cancelButton.append('span')
.attr('class', 'label')
.text(t('commit.cancel'));
var warnings = body.selectAll('div.warning-section')
.data(iD.validate(changes, context.graph()))
.enter()
.append('div')
.attr('class', 'modal-section warning-section fillL');
.attr('class', 'modal-section warning-section fillL2');
warnings.append('h3')
.text(t('commit.warnings'));
+2 -8
View File
@@ -5,7 +5,7 @@ iD.ui.confirm = function(selection) {
.classed('modal-alert', true);
var section = modal.select('.content')
.attr('class', 'modal-section fillD');
.attr('class', 'modal-section');
var description = section.append('div')
.attr('class', 'description');
@@ -17,13 +17,7 @@ iD.ui.confirm = function(selection) {
.attr('class', 'col2 action centered')
.on('click.confirm', function() {
modal.remove();
});
okbutton.append('span')
.attr('class', 'icon apply icon-pre-text');
okbutton.append('span')
.attr('class', 'label')
})
.text('Okay');
return modal;
+5 -3
View File
@@ -21,13 +21,15 @@ iD.ui.modal = function(selection, blocking) {
});
var modal = shaded.append('div')
.attr('class', 'modal');
.attr('class', 'modal fillL col6');
modal.append('button')
.attr('class', 'icon remove')
.attr('class', 'close')
.on('click', function() {
if (!blocking) shaded.remove();
});
})
.append('div')
.attr('class','icon close');
modal.append('div')
.attr('class', 'content');
+3 -3
View File
@@ -12,7 +12,7 @@ iD.ui.PresetGrid = function(context, entity) {
presets = context.presets().matchGeometry(entity, context.graph());
var messagewrap = selection.append('div')
.attr('class', 'message fillL');
.attr('class', 'header fillL cf');
var message = messagewrap.append('h3')
.attr('class', 'inspector-inner fl')
@@ -20,13 +20,13 @@ iD.ui.PresetGrid = function(context, entity) {
if (preset) {
messagewrap.append('button')
.attr('class', 'tooltip-bottom preset-choose fr')
.attr('class', 'preset-choose')
.on('click', event.choose)
.append('span')
.attr('class', 'icon forward');
} else {
messagewrap.append('button')
.attr('class', 'tooltip-bottom preset-close fr')
.attr('class', 'close')
.on('click', event.close)
.append('span')
.attr('class', 'icon close');
+1 -1
View File
@@ -16,7 +16,7 @@ iD.ui.Restore = function(context) {
.text(t('restore.description'));
var buttonWrap = introModal.append('div')
.attr('class', 'modal-section fillD cf col12');
.attr('class', 'modal-section cf col12');
var buttons = buttonWrap
.append('div')
+10 -13
View File
@@ -3,12 +3,10 @@ iD.ui.Success = function(connection) {
function success(selection) {
var changeset = selection.datum(),
header = selection.append('div').attr('class', 'header fillL modal-section'),
header = selection.append('div').attr('class', 'header modal-section'),
body = selection.append('div').attr('class', 'body');
var section = body.append('div').attr('class','modal-section fillD');
header.append('h2').text(t('just_edited'));
header.append('h3').text(t('just_edited'));
var m = '';
if (changeset.comment) {
@@ -18,7 +16,9 @@ iD.ui.Success = function(connection) {
var message = (m || 'Edited OSM!') +
connection.changesetUrl(changeset.id);
header.append('a')
var links = body.append('div').attr('class','modal-section');
links.append('a')
.attr('href', function() {
return connection.changesetUrl(changeset.id);
})
@@ -26,7 +26,7 @@ iD.ui.Success = function(connection) {
.attr('class', 'success-action')
.text(t('view_on_osm'));
header.append('a')
links.append('a')
.attr('target', '_blank')
.attr('href', function() {
return 'https://twitter.com/intent/tweet?source=webclient&text=' +
@@ -35,17 +35,14 @@ iD.ui.Success = function(connection) {
.attr('class', 'success-action')
.text('Tweet');
var buttonwrap = section.append('div')
.attr('class', 'buttons cf');
var section = body.append('div').attr('class','modal-section cf');
var okbutton = buttonwrap.append('button')
section.append('button')
.attr('class', 'action col2')
.on('click.save', function() {
event.cancel();
});
okbutton.append('span').attr('class','icon apply icon-pre-text');
okbutton.append('span').attr('class','label').text('Okay');
})
.append('span').attr('class','label').text('Okay');
}
return d3.rebind(success, event, 'on');
+1 -1
View File
@@ -27,7 +27,7 @@ iD.ui.TagEditor = function(context, entity) {
selection.html('');
var messagewrap = selection.append('div')
.attr('class', 'message fillL');
.attr('class', 'header fillL cf');
var back = messagewrap.append('button')
.attr('class', 'preset-reset fl ' + geometry)