Project

General

Profile

Actions

Feature #1918

closed

Capitalization of first letter with CSS

Added by Alexander Watzinger over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
UI
Target version:
Start date:
2022-11-11
Estimated time:

Description

In OpenAtlas there are many cases were we want the capitalization of the first letter, e.g for buttons, tab headers, ...
There is a CSS way of doing it e.g.

<html>
<head>
  <style>div::first-letter {text-transform: uppercase;}</style>
</head>
<body>
<div>mm</div>
</body>
</html>

But because it wasn't working correctly with Firefox a few years ago, we are using the Python function uc_first() located in openatlas/util/util.py

    @app.template_filter()
    def uc_first(string: str) -> str:
       return str(string)[0].upper() + str(string)[1:] if string else ''

There are 250+ calls to this function in the OpenAtlas code base and it would be great, if we could replace these with an CSS implementation. It would greatly reduce the Python code and so make parts of it much more readable.
Much things have changed in the last years so I would like to ask Andi (or Mocca) to look into this and evaluate, if the CSS implementation first-letter {text-transform: uppercase;} would be viable now.

I'm tracking one related Mozilla bug (still open after 13 years): https://bugzilla.mozilla.org/show_bug.cgi?id=385615 but I'm not sure, if this is relevant for this case.


Files

screenshot.png (25.3 KB) screenshot.png Alexander Watzinger, 2023-01-21 18:16

Related issues 1 (0 open1 closed)

Follows OpenAtlas - Feature #1866: Complete Bootstrap layoutClosedAndreas Olschnögger2022-11-10Actions
Actions

Also available in: Atom PDF