Skip to content

Commit 2b2f20b

Browse files
committed
Revert "Remove fomantic image module (go-gitea#21145)"
This reverts commit afdab9d.
1 parent ca445cf commit 2b2f20b

File tree

16 files changed

+381
-31
lines changed

16 files changed

+381
-31
lines changed

modules/templates/helper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ func AvatarHTML(src string, size int, class, name string) template.HTML {
613613

614614
// Avatar renders user avatars. args: user, size (int), class (string)
615615
func Avatar(ctx context.Context, item interface{}, others ...interface{}) template.HTML {
616-
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
616+
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, "ui avatar image gt-vm", others...)
617617

618618
switch t := item.(type) {
619619
case *user_model.User:
@@ -644,7 +644,7 @@ func AvatarByAction(ctx context.Context, action *activities_model.Action, others
644644

645645
// RepoAvatar renders repo avatars. args: repo, size(int), class (string)
646646
func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTML {
647-
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
647+
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
648648

649649
src := repo.RelAvatarLink()
650650
if src != "" {
@@ -655,7 +655,7 @@ func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTM
655655

656656
// AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)
657657
func AvatarByEmail(ctx context.Context, email, name string, others ...interface{}) template.HTML {
658-
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
658+
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
659659
src := avatars.GenerateEmailAvatarFastLink(ctx, email, size*setting.Avatar.RenderedSizeFactor)
660660

661661
if src != "" {

templates/base/head_navbar.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{end}}
66
<div class="item brand gt-sb">
77
<a href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}">
8-
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
8+
<img class="ui mini image" width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
99
</a>
1010
<div class="gt-df gt-ac">
1111
{{if .IsSigned}}

templates/repo/issue/view_content/attachments.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
{{if not (containGeneric $.Content .UUID)}}
1212
{{$hasThumbnails = true}}
1313
{{end}}
14-
{{svg "octicon-file"}}
14+
<span class="ui image">{{svg "octicon-file"}}</span>
1515
{{else}}
16-
{{svg "octicon-desktop-download"}}
16+
<span class="ui image">{{svg "octicon-desktop-download"}}</span>
1717
{{end}}
1818
<span><strong>{{.Name}}</strong></span>
1919
</a>
@@ -26,12 +26,12 @@
2626

2727
{{if $hasThumbnails}}
2828
<div class="ui clearing divider"></div>
29-
<div class="ui small thumbnails">
29+
<div class="ui small images thumbnails">
3030
{{- range .Attachments -}}
3131
{{if FilenameIsImage .Name}}
3232
{{if not (containGeneric $.Content .UUID)}}
3333
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
34-
<img src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
34+
<img class="ui image" src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
3535
</a>
3636
{{end}}
3737
{{end}}

templates/repo/release/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
</span>
181181
</span>
182182
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
183-
<strong>{{svg "octicon-package" 16 "gt-mr-2"}}{{.Name}}</strong>
183+
<strong><span class="ui image" title='{{.Name}}'>{{svg "octicon-package" 16 "gt-mr-2"}}</span>{{.Name}}</strong>
184184
</a>
185185
</li>
186186
{{end}}

templates/repo/settings/tags.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@
9494
{{$userIDs := .AllowlistUserIDs}}
9595
{{range $.Users}}
9696
{{if contain $userIDs .ID}}
97-
<a class="ui basic label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
97+
<a class="ui basic image label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
9898
{{end}}
9999
{{end}}
100100
{{if $.Owner.IsOrganization}}
101101
{{$teamIDs := .AllowlistTeamIDs}}
102102
{{range $.Teams}}
103103
{{if contain $teamIDs .ID}}
104-
<a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
104+
<a class="ui basic image label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
105105
{{end}}
106106
{{end}}
107107
{{end}}

templates/status/404.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content ui container center gt-full-screen-width {{if .IsRepo}}repository{{end}}">
33
{{if .IsRepo}}{{template "repo/header" .}}{{end}}
44
<div class="ui container center">
5-
<p style="margin-top: 100px"><img src="{{AssetUrlPrefix}}/img/404.png" alt="404"/></p>
5+
<p style="margin-top: 100px"><img class="ui centered image" src="{{AssetUrlPrefix}}/img/404.png" alt="404"/></p>
66
<div class="ui divider"></div>
77
<br>
88
<p>{{.locale.Tr "error404" | Safe}}

templates/status/500.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{template "base/head" .}}
22
<div role="main" aria-label="{{.Title}}" class="page-content ui container gt-full-screen-width center">
3-
<p style="margin-top: 100px"><img src="{{AssetUrlPrefix}}/img/500.png" alt="500"/></p>
3+
<p style="margin-top: 100px"><img class="ui centered image" src="{{AssetUrlPrefix}}/img/500.png" alt="500"/></p>
44
<div class="ui divider"></div>
55
<br>
66
{{if .ErrorMsg}}

tests/e2e/example.test.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('Test Register Form', async ({page}, workerInfo) => {
2323
await page.click('form button.ui.green.button:visible');
2424
// Make sure we routed to the home page. Else login failed.
2525
await expect(page.url()).toBe(`${workerInfo.project.use.baseURL}/`);
26-
await expect(page.locator('.dashboard-navbar span>img.ui.avatar')).toBeVisible();
26+
await expect(page.locator('.dashboard-navbar span>img.ui.avatar.image')).toBeVisible();
2727
await expect(page.locator('.ui.positive.message.flash-success')).toHaveText('Account was successfully created.');
2828

2929
save_visual(page);

tests/e2e/utils_e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ export async function save_visual(page) {
5252
fullPage: true,
5353
timeout: 20000,
5454
mask: [
55-
page.locator('.dashboard-navbar span>img.ui.avatar'),
56-
page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar'),
55+
page.locator('.dashboard-navbar span>img.ui.avatar.image'),
56+
page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar.image'),
5757
],
5858
});
5959
}

0 commit comments

Comments
 (0)