From 61ae541cfc063d9cb06cd6d3dbd93965a982104f Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Tue, 3 Jul 2018 10:57:53 -0400 Subject: [PATCH] updated: notes save buttons --- css/65_data.css | 1 - css/80_app.css | 10 ++++++++-- data/core.yaml | 3 ++- dist/locales/en.json | 3 ++- modules/ui/commit.js | 4 ++-- modules/ui/note_editor.js | 32 +++++++++++++++++++++++++------- 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/css/65_data.css b/css/65_data.css index 93627877e..fa1a18ba3 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -68,7 +68,6 @@ margin-top: 10px; } -/* Note editor UI */ #new-comment-input { width: 100%; height: 100px; diff --git a/css/80_app.css b/css/80_app.css index 46eaa1da2..f6ca2de6b 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -3566,10 +3566,16 @@ img.tile-debug { vertical-align: middle; } +.save-section .buttons { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} + .save-section .buttons .action, .save-section .buttons .secondary-action { - display: inline-block; - margin: 0 20px 0 0; + width: 45%; + margin: 10px auto; text-align: center; vertical-align: middle; } diff --git a/data/core.yaml b/data/core.yaml index 5640a8261..2aa605657 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -615,7 +615,8 @@ en: title: Edit note anonymous: anonymous commentTitle: Comments - resolve: Resolve + close: Resolve + reopen: Reopen newComment: New Comment inputPlaceholder: Enter a comment to share with other users. comment: Comment diff --git a/dist/locales/en.json b/dist/locales/en.json index 0820a7b88..b87f22d0a 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -748,7 +748,8 @@ "title": "Edit note", "anonymous": "anonymous", "commentTitle": "Comments", - "resolve": "Resolve", + "close": "Resolve", + "reopen": "Reopen", "newComment": "New Comment", "inputPlaceholder": "Enter a comment to share with other users.", "comment": "Comment", diff --git a/modules/ui/commit.js b/modules/ui/commit.js index 3b934898c..ec79e7baf 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -220,14 +220,14 @@ export function uiCommit(context) { buttonEnter .append('button') - .attr('class', 'secondary-action col5 button cancel-button') + .attr('class', 'secondary-action button cancel-button') .append('span') .attr('class', 'label') .text(t('commit.cancel')); buttonEnter .append('button') - .attr('class', 'action col5 button save-button') + .attr('class', 'action button save-button') .append('span') .attr('class', 'label') .text(t('commit.save')); diff --git a/modules/ui/note_editor.js b/modules/ui/note_editor.js index b6b772a9f..852a4232e 100644 --- a/modules/ui/note_editor.js +++ b/modules/ui/note_editor.js @@ -156,22 +156,45 @@ export function uiNoteEditor(context) { buttonEnter .append('button') - .attr('class', 'secondary-action col5 button cancel-button') + .attr('class', 'secondary-action button cancel-button') .append('span') .attr('class', 'label') .text(t('note.cancel')); buttonEnter .append('button') - .attr('class', 'action col5 button save-button') + .attr('class', 'action button save-button') .append('span') .attr('class', 'label') .text(t('note.save')); + var status; + if (_note.status) { + status = _note.status === 'open' ? t('note.close') : t('note.reopen'); + } + + buttonEnter + .append('button') + .attr('class', _note.status + '-button status-button action button') + .append('span') + .attr('class', 'label') + .text(status); + + // update buttonSection = buttonSection .merge(buttonEnter); + buttonSection.selectAll('.close-button') + .on('click.close', function() { + console.log('close button clicked'); + }); + + buttonSection.selectAll('.reopen-button') + .on('click.reopen', function() { + console.log('reopen button clicked'); + }); + buttonSection.selectAll('.cancel-button') .on('click.cancel', function() { // var selectedID = commitChanges.entityID(); TODO: cancel note event @@ -194,11 +217,6 @@ export function uiNoteEditor(context) { var saveSection = selection.selectAll('.save-section') .data([0]); - // saveSection = saveSection.enter() - // .append('h4') - // .text(t('note.newComment')) - // .merge(saveSection); - saveSection = saveSection.enter() .append('div') .attr('class','save-section cf')