Skip to content

Commit afdab9d

Browse files
silverwind6543lafriks
authored
Remove fomantic image module (#21145)
Remove this small, but unnecessary [module](https://fomantic-ui.com/elements/image.html) and use `img` selector over previous `.image`. Did a few tests, could not notice any visual regression. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
1 parent fe73246 commit afdab9d

File tree

16 files changed

+32
-382
lines changed

16 files changed

+32
-382
lines changed

Diff for: modules/templates/helper.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ func SVG(icon string, others ...interface{}) template.HTML {
631631

632632
// Avatar renders user avatars. args: user, size (int), class (string)
633633
func Avatar(item interface{}, others ...interface{}) template.HTML {
634-
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image vm", others...)
634+
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar vm", others...)
635635

636636
switch t := item.(type) {
637637
case *user_model.User:
@@ -662,7 +662,7 @@ func AvatarByAction(action *activities_model.Action, others ...interface{}) temp
662662

663663
// RepoAvatar renders repo avatars. args: repo, size(int), class (string)
664664
func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTML {
665-
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
665+
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar", others...)
666666

667667
src := repo.RelAvatarLink()
668668
if src != "" {
@@ -673,7 +673,7 @@ func RepoAvatar(repo *repo_model.Repository, others ...interface{}) template.HTM
673673

674674
// AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)
675675
func AvatarByEmail(email, name string, others ...interface{}) template.HTML {
676-
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar image", others...)
676+
size, class := parseOthers(avatars.DefaultAvatarPixelSize, "ui avatar", others...)
677677
src := avatars.GenerateEmailAvatarFastLink(email, size*setting.Avatar.RenderedSizeFactor)
678678

679679
if src != "" {

Diff for: templates/base/head_navbar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{end}}
66
<div class="item brand" style="justify-content: space-between;">
77
<a href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}">
8-
<img class="ui mini image" width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
8+
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
99
</a>
1010
{{if .IsSigned}}
1111
<a href="{{AppSubUrl}}/notifications" class="tooltip mobile-only" data-content='{{.locale.Tr "notifications"}}'>

Diff for: templates/repo/issue/view_content/attachments.tmpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
{{if not (containGeneric $.Content .UUID)}}
1212
{{$hasThumbnails = true}}
1313
{{end}}
14-
<span class="ui image">{{svg "octicon-file"}}</span>
14+
{{svg "octicon-file"}}
1515
{{else}}
16-
<span class="ui image">{{svg "octicon-desktop-download"}}</span>
16+
{{svg "octicon-desktop-download"}}
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 images thumbnails">
29+
<div class="ui small 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 class="ui image" src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
34+
<img src="{{.DownloadURL}}" title='{{$.ctx.locale.Tr "repo.issues.attachment.open_tab" .Name}}'>
3535
</a>
3636
{{end}}
3737
{{end}}

Diff for: templates/repo/release/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
</span>
169169
</span>
170170
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}">
171-
<strong><span class="ui image" title='{{.Name}}'>{{svg "octicon-package" 16 "mr-2"}}</span>{{.Name}}</strong>
171+
<strong>{{svg "octicon-package" 16 "mr-2"}}{{.Name}}</strong>
172172
</a>
173173
</li>
174174
{{end}}

Diff for: templates/repo/settings/tags.tmpl

+2-2
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 image label" href="{{.HomeLink}}">{{avatar . 26}} {{.GetDisplayName}}</a>
97+
<a class="ui basic label" href="{{.HomeLink}}">{{avatar . 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 image label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
104+
<a class="ui basic label" href="{{$.Owner.OrganisationLink}}/teams/{{PathEscape .LowerName}}">{{.Name}}</a>
105105
{{end}}
106106
{{end}}
107107
{{end}}

Diff for: templates/status/404.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="page-content ui container center 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 class="ui centered image" src="{{AssetUrlPrefix}}/img/404.png" alt="404"/></p>
5+
<p style="margin-top: 100px"><img src="{{AssetUrlPrefix}}/img/404.png" alt="404"/></p>
66
<div class="ui divider"></div>
77
<br>
88
<p>{{.locale.Tr "error404" | Safe}}

Diff for: templates/status/500.tmpl

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

Diff for: tests/e2e/example.test.e2e.js

+1-1
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.image')).toBeVisible();
26+
await expect(page.locator('.dashboard-navbar span>img.ui.avatar')).toBeVisible();
2727
await expect(page.locator('.ui.positive.message.flash-success')).toHaveText('Account was successfully created.');
2828

2929
save_visual(page);

Diff for: tests/e2e/utils_e2e.js

+2-2
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.image'),
56-
page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar.image'),
55+
page.locator('.dashboard-navbar span>img.ui.avatar'),
56+
page.locator('.ui.dropdown.jump.item.tooltip span>img.ui.avatar'),
5757
],
5858
});
5959
}

0 commit comments

Comments
 (0)