From 3454753bf607a73c867f785249d7b9d383a55893 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 11 Jul 2018 16:00:54 -0400 Subject: [PATCH] Drop more/less toggle and just use a scrollbar for long comments --- css/65_data.css | 5 ++++- data/core.yaml | 2 -- dist/locales/en.json | 7 +++--- modules/ui/note_comments.js | 45 ++----------------------------------- 4 files changed, 9 insertions(+), 50 deletions(-) diff --git a/css/65_data.css b/css/65_data.css index 8c32c676d..0be1ab163 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -133,9 +133,12 @@ .comment-text { color: #333; margin-top: 10px; - overflow-y: hidden; /* TODO: give scroll bar or replace with accordion */ + overflow-y: auto; max-height: 250px; } +.comment-text::-webkit-scrollbar { + border-left: none; +} #new-comment-input { width: 100%; diff --git a/data/core.yaml b/data/core.yaml index 02def0244..ecb21897c 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -615,8 +615,6 @@ en: title: Edit note anonymous: anonymous closed: "(Closed)" - more: More - less: Less commentTitle: Comments close: Resolve reopen: Reopen diff --git a/dist/locales/en.json b/dist/locales/en.json index 1a99cfc49..7b6591fa1 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -747,8 +747,7 @@ "note": "Note", "title": "Edit note", "anonymous": "anonymous", - "more": "More", - "less": "Less", + "closed": "(Closed)", "commentTitle": "Comments", "close": "Resolve", "reopen": "Reopen", @@ -6689,7 +6688,7 @@ "attribution": { "text": "Terms & Feedback" }, - "description": "Premium DigitalGlobe satellite imagery.", + "description": "DigitalGlobe-Premium is a mosaic composed of DigitalGlobe basemap with select regions filled with +Vivid or custom area of interest imagery, 50cm resolution or better, and refreshed more frequently with ongoing updates.", "name": "DigitalGlobe Premium Imagery" }, "DigitalGlobe-Premium-vintage": { @@ -6703,7 +6702,7 @@ "attribution": { "text": "Terms & Feedback" }, - "description": "Standard DigitalGlobe satellite imagery.", + "description": "DigitalGlobe-Standard is a curated set of imagery covering 86% of the earth’s landmass, with 30-60cm resolution where available, backfilled by Landsat. Average age is 2.31 years, with some areas updated 2x per year.", "name": "DigitalGlobe Standard Imagery" }, "DigitalGlobe-Standard-vintage": { diff --git a/modules/ui/note_comments.js b/modules/ui/note_comments.js index 533acd74e..503f4a44d 100644 --- a/modules/ui/note_comments.js +++ b/modules/ui/note_comments.js @@ -67,55 +67,14 @@ export function uiNoteComments() { mainEnter .append('div') - .attr('class', function(d) { - var trunc = (d.text.length > commentLimit); - return 'comment-text' + (trunc ? ' truncated' : ''); - }) - .text(function(d) { - var trunc = (d.text.length > commentLimit); - return trunc ? d.text.slice(0, commentLimit) + '…' : d.text; - }); - - mainEnter - .each(function(d) { - var selection = d3_select(this); - var trunc = (d.text.length > commentLimit); - if (!trunc) return; - - selection - .append('a') - .attr('class', 'comment-toggle-more') - .attr('href', '#') - .attr('tabindex', -1) - .attr('target', '_blank') - .text(t('note.more')) - .on('click', toggleMore); - }); + .attr('class', 'comment-text') + .text(function(d) { return d.text; }); comments .call(replaceAvatars); } - function toggleMore() { - d3_event.preventDefault(); - - var selection = d3_select(this.parentNode); // select .comment-main - var commentText = selection.selectAll('.comment-text'); - var commentToggle = selection.selectAll('.comment-toggle-more'); - var trunc = !commentText.classed('truncated'); - - commentText - .classed('truncated', trunc) - .text(function(d) { - return trunc ? d.text.slice(0, commentLimit) + '…' : d.text; - }); - - commentToggle - .text(t('note.' + (trunc ? 'more' : 'less'))); - } - - function replaceAvatars(selection) { var osm = services.osm; if (!osm) return;