1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-02 08:14:25 +00:00
gitea/templates/devtest/gitea-ui.tmpl
wxiaoguang 7681d582cd
Refactor locale number (#24134)
Before, the `GiteaLocaleNumber.js` was just written as a a drop-in
replacement for old `js-pretty-number`.

Actually, we can use Golang's `text` package to format.

This PR partially completes the TODOs in `GiteaLocaleNumber.js`:

> if we have complete backend locale support (eg: Golang "x/text"
package), we can drop this component.
> tooltip: only 2 usages of this, we can replace it with Golang's
"x/text/number" package in the future.

This PR also helps #24131

Screenshots:

<details>

![image](https://user-images.githubusercontent.com/2114189/232179420-b1b9974b-9d96-4408-b209-b80182c8b359.png)


![image](https://user-images.githubusercontent.com/2114189/232179416-14f36aa0-3f3e-4ac9-b366-7bd3a4464a11.png)

</details>
2023-04-17 11:37:23 +08:00

52 lines
1.5 KiB
Handlebars

{{template "base/head" .}}
<div class="page-content devtest ui container">
<div>
<h1>Tooltip</h1>
<div><span data-tooltip-content="test tooltip">text with tooltip</span></div>
<div><span data-tooltip-content="test tooltip" data-tooltip-interactive="true">text with interactive tooltip</span></div>
</div>
<div>
<h1>GiteaOriginUrl</h1>
<div><gitea-origin-url data-url="test/url"></gitea-origin-url></div>
<div><gitea-origin-url data-url="/test/url"></gitea-origin-url></div>
</div>
<div>
<h1>LocaleNumber</h1>
<div>{{.locale.PrettyNumber 1}}</div>
<div>{{.locale.PrettyNumber 12}}</div>
<div>{{.locale.PrettyNumber 123}}</div>
<div>{{.locale.PrettyNumber 1234}}</div>
<div>{{.locale.PrettyNumber 12345}}</div>
<div>{{.locale.PrettyNumber 123456}}</div>
<div>{{.locale.PrettyNumber 1234567}}</div>
</div>
<div>
<h1>TimeSince</h1>
<div>Now: {{TimeSince .TimeNow $.locale}}</div>
<div>5s past: {{TimeSince .TimePast5s $.locale}}</div>
<div>5s future: {{TimeSince .TimeFuture5s $.locale}}</div>
<div>2m past: {{TimeSince .TimePast2m $.locale}}</div>
<div>2m future: {{TimeSince .TimeFuture2m $.locale}}</div>
<div>1y past: {{TimeSince .TimePast1y $.locale}}</div>
<div>1y future: {{TimeSince .TimeFuture1y $.locale}}</div>
</div>
<div>
<h1>ComboMarkdownEditor</h1>
<div>ps: no JS code attached, so just a layout</div>
{{template "shared/combomarkdowneditor" .}}
</div>
<style>
h1 {
margin: 0;
padding: 10px 0;
}
</style>
</div>
{{template "base/footer" .}}