diff options
author | André Colomb <src@andre.colomb.de> | 2024-03-03 20:55:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-03 20:55:09 +0100 |
commit | 13a6d43f0b63faa5b55d357124401c854dbf0b30 (patch) | |
tree | 1a58fc6a0c14b6a8a2230dc43566c0501a518747 | |
parent | ac942e2481fa0692f0a51bd9fd6b2a6b4142bd32 (diff) |
gui: Fix wrapping in "Shared With" / "Folders" lists. (#9438)
This change was split off from #9355 as an independent clean-up / fix.
See that PR for review discussion, testing, and screenshots.
Improve the wrapping of folder labels / device names by going back to
word-wrapping, but making sure other spans, such as the trailing comma,
do not get separated from the label span.
* Avoid adding whitespace caused by line wraps in HTML source code.
The different cases within the ng-switch block are separated by
newlines for readability, but that gets parsed as whitespace. For
wrapping purposes, this should not happen, because then there is no
way to keep other HTML parts glued to the name / label in each list
entry.
* Simplify redundant conditional comma code.
The separating comma after a device name or folder label (all but the
last) should always stick to it. Use the HTML comment trick to avoid
whitespace and therefore a wrapping opportunity caused by the code
formatting newline. Thus the conditional comma only needs to be
defined once, not in each ng-switch case.
* Wrap at word boundaries and only break up words if necessary.
Use the overflow-wrap: break-word; style instead of word-break:
break-all;. While the latter is suitable for longish paths, breaking
device names or folder labels arbitrarily within words is ugly.
This also makes the the <sup> numbers actually stay glued to their
respective neighboring words.
Include legacy CSS alias "word-wrap" in the class definition.
* Fix indentation (unrelated).
-rw-r--r-- | gui/default/assets/css/overrides.css | 7 | ||||
-rw-r--r-- | gui/default/index.html | 26 |
2 files changed, 21 insertions, 12 deletions
diff --git a/gui/default/assets/css/overrides.css b/gui/default/assets/css/overrides.css index b773cf0006..043e6a9249 100644 --- a/gui/default/assets/css/overrides.css +++ b/gui/default/assets/css/overrides.css @@ -189,6 +189,13 @@ input[type="checkbox"].extended-attributes-filter-rule-checkbox { word-break: break-all; } +/* Break up long words in paragraphs only if necessary to prevent text overflow. */ +.overflow-break-word { + overflow-wrap: break-word; + /* Legacy name alias */ + word-wrap: break-word; +} + .folder-advanced { padding: 1rem; margin-bottom: 15px; diff --git a/gui/default/index.html b/gui/default/index.html index 12216d485a..26f4e86557 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -404,9 +404,9 @@ <span class="hidden-xs">{{folderStatusText(folder)}}</span> <span ng-switch-when="scanning" ng-if="scanPercentage(folder.id) != undefined">({{scanPercentage(folder.id) | percent}})</span> <span ng-switch-when="syncing">({{syncPercentage(folder.id) | percent}}, {{model[folder.id].needBytes | binary}}B)</span> - <span class="inline-icon"> + <span class="inline-icon"> <span class="visible-xs fa fa-fw {{folderStatusIcon(folder)}}" aria-label="{{folderStatusText(folder)}}"></span> - </span> + </span> </div> <div class="panel-title-text"> <span tooltip data-original-title="{{folder.label.length != 0 ? folder.id : ''}}">{{folder.label.length != 0 ? folder.label : folder.id}}</span> @@ -585,12 +585,13 @@ </tr> <tr> <th><span class="fas fa-fw fa-share-alt"></span> <span translate>Shared With</span></th> - <td class="text-right no-overflow-ellipse word-break-all"> + <td class="text-right no-overflow-ellipse overflow-break-word"> <span ng-repeat="device in otherDevices(folder.devices)"> - <span ng-switch="completion[device.deviceID][folder.id].remoteState"> - <span ng-switch-when="notSharing" data-original-title="{{'The remote device has not accepted sharing this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>1</sup><span ng-if="!$last">,</span></span> - <span ng-switch-when="paused" data-original-title="{{'The remote device has paused this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>2</sup><span ng-if="!$last">,</span></span> - <span ng-switch-default>{{deviceName(devices[device.deviceID])}}<span ng-if="!$last">,</span></span> + <span ng-switch="completion[device.deviceID][folder.id].remoteState"><!-- Avoid stray space... + --><span ng-switch-when="notSharing" data-original-title="{{'The remote device has not accepted sharing this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>1</sup></span><!-- Avoid stray space... + --><span ng-switch-when="paused" data-original-title="{{'The remote device has paused this folder.' | translate}}" tooltip>{{deviceName(devices[device.deviceID])}}<sup>2</sup></span><!-- Avoid stray space... + --><span ng-switch-default>{{deviceName(devices[device.deviceID])}}</span><!-- Avoid stray space... + --><span ng-if="!$last">,</span> </span> </span> </td> @@ -940,12 +941,13 @@ </tr> <tr ng-if="deviceFolders(deviceCfg).length > 0"> <th><span class="fas fa-fw fa-folder"></span> <span translate>Folders</span></th> - <td class="text-right no-overflow-ellipse word-break-all"> + <td class="text-right no-overflow-ellipse overflow-break-word"> <span ng-repeat="folderID in deviceFolders(deviceCfg)"> - <span ng-switch="completion[deviceCfg.deviceID][folderID].remoteState"> - <span ng-switch-when="notSharing" data-original-title="{{'The remote device has not accepted sharing this folder.' | translate}}" tooltip>{{folderLabel(folderID)}}<sup>1</sup><span ng-if="!$last">,</span></span> - <span ng-switch-when="paused" data-original-title="{{'The remote device has paused this folder.' | translate}}" tooltip>{{folderLabel(folderID)}}<sup>2</sup><span ng-if="!$last">,</span></span> - <span ng-switch-default>{{folderLabel(folderID)}}<span ng-if="!$last">,</span></span> + <span ng-switch="completion[deviceCfg.deviceID][folderID].remoteState"><!-- Avoid stray space... + --><span ng-switch-when="notSharing" data-original-title="{{'The remote device has not accepted sharing this folder.' | translate}}" tooltip>{{folderLabel(folderID)}}<sup>1</sup></span><!-- Avoid stray space... + --><span ng-switch-when="paused" data-original-title="{{'The remote device has paused this folder.' | translate}}" tooltip>{{folderLabel(folderID)}}<sup>2</sup></span><!-- Avoid stray space... + --><span ng-switch-default>{{folderLabel(folderID)}}</span><!-- Avoid stray space... + --><span ng-if="!$last">,</span> </span> </span> </td> |