magicsunday / webtrees-descendants-chart

SVG based descendants chart module for webtrees genealogy application.
GNU General Public License v3.0
26 stars 8 forks source link

Text can overflow box #12

Closed ddrury closed 2 years ago

ddrury commented 2 years ago

As per title, particularly noticeable with dates of the format "between January 1849 and March 1849".

Could possibly shorten text to "Bet Jan and Mar 1849"

ddrury commented 2 years ago

Hi,

Here's a suggestion that shortens the text but keeps the international format:

In IndividualTrait::getIndividualData()

Add line $date_format = Str_replace(['%l', '%F'], ['%D', '%M'], I18N::dateFormat()); change birth (& death) date lines to 'birth' => strip_tags($individual->getBirthDate()->display(false, $date_format)),

(also works for pedigree chart)

before after

reteP-riS commented 2 years ago

Just tested this. The proposed change shortens the date format, but is still way too long in case you have days in there as well, e. g. "between 23 Jul 1909 and 23 Sep 1909".

ddrury commented 2 years ago

Yeah, I realised the change above wouldn't be a complete solution. It's simple to change the standard php date formatting characters. The trouble is the Gedcom modifiers (after, between, before, etc.) are difficult to intercept before they are internationalised.

See https://github.com/fisharebest/webtrees/issues/4046

magicsunday commented 2 years ago

This change cuts off dates that are too long to prevent them from overflowing the edge of the box. Unfortunately, this doesn't work for multibyte languages like hebrew yet.

The complete date is still available as additional attribute.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>