Skip to content

Commit ffddf3f

Browse files
Make SVG size argument optional (#12814)
Now defaults to 16 on both frontend and backend. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
1 parent 26c4a04 commit ffddf3f

89 files changed

Lines changed: 458 additions & 455 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/templates/helper.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,10 @@ var heightRe = regexp.MustCompile(`height="[0-9]+?"`)
470470

471471
// SVG render icons - arguments icon name (string), size (int), class (string)
472472
func SVG(icon string, others ...interface{}) template.HTML {
473-
var size = others[0].(int)
473+
size := 16
474+
if len(others) > 0 && others[0].(int) != 0 {
475+
size = others[0].(int)
476+
}
474477

475478
class := ""
476479
if len(others) > 1 && others[1].(string) != "" {

templates/admin/dashboard.tmpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,44 @@
2121
<tbody>
2222
<tr>
2323
<td>{{.i18n.Tr "admin.dashboard.delete_inactive_accounts"}}</td>
24-
<td><button type="submit" class="ui green button" name="op" value="delete_inactive_accounts">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
24+
<td><button type="submit" class="ui green button" name="op" value="delete_inactive_accounts">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
2525
</tr>
2626
<tr>
2727
<td>{{.i18n.Tr "admin.dashboard.delete_repo_archives"}}</td>
28-
<td><button type="submit" class="ui green button" name="op" value="delete_repo_archives">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
28+
<td><button type="submit" class="ui green button" name="op" value="delete_repo_archives">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
2929
</tr>
3030
<tr>
3131
<td>{{.i18n.Tr "admin.dashboard.delete_missing_repos"}}</td>
32-
<td><button type="submit" class="ui green button" name="op" value="delete_missing_repos">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
32+
<td><button type="submit" class="ui green button" name="op" value="delete_missing_repos">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
3333
</tr>
3434
<tr>
3535
<td>{{.i18n.Tr "admin.dashboard.git_gc_repos"}}</td>
36-
<td><button type="submit" class="ui green button" name="op" value="git_gc_repos">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
36+
<td><button type="submit" class="ui green button" name="op" value="git_gc_repos">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
3737
</tr>
3838
<tr>
3939
<td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}<br/>
4040
{{.i18n.Tr "admin.dashboard.resync_all_sshkeys.desc"}}</td>
41-
<td><button type="submit" class="ui green button" name="op" value="resync_all_sshkeys">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
41+
<td><button type="submit" class="ui green button" name="op" value="resync_all_sshkeys">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
4242
</tr>
4343
<tr>
4444
<td>{{.i18n.Tr "admin.dashboard.resync_all_hooks"}}</td>
45-
<td><button type="submit" class="ui green button" name="op" value="resync_all_hooks">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
45+
<td><button type="submit" class="ui green button" name="op" value="resync_all_hooks">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
4646
</tr>
4747
<tr>
4848
<td>{{.i18n.Tr "admin.dashboard.reinit_missing_repos"}}</td>
49-
<td><button type="submit" class="ui green button" name="op" value="reinit_missing_repos">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
49+
<td><button type="submit" class="ui green button" name="op" value="reinit_missing_repos">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
5050
</tr>
5151
<tr>
5252
<td>{{.i18n.Tr "admin.dashboard.sync_external_users"}}</td>
53-
<td><button type="submit" class="ui green button" name="op" value="sync_external_users">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
53+
<td><button type="submit" class="ui green button" name="op" value="sync_external_users">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
5454
</tr>
5555
<tr>
5656
<td>{{.i18n.Tr "admin.dashboard.repo_health_check"}}</td>
57-
<td><button type="submit" class="ui green button" name="op" value="repo_health_check">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
57+
<td><button type="submit" class="ui green button" name="op" value="repo_health_check">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
5858
</tr>
5959
<tr>
6060
<td>{{.i18n.Tr "admin.dashboard.delete_generated_repository_avatars"}}</td>
61-
<td><button type="submit" class="ui green button" name="op" value="delete_generated_repository_avatars">{{svg "octicon-play" 16}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
61+
<td><button type="submit" class="ui green button" name="op" value="delete_generated_repository_avatars">{{svg "octicon-play"}} {{.i18n.Tr "admin.dashboard.operation_run"}}</button></td>
6262
</tr>
6363
</tbody>
6464
</table>

templates/admin/monitor.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<tbody>
2525
{{range .Entries}}
2626
<tr>
27-
<td><button type="submit" class="ui green button" name="op" value="{{.Name}}" title="{{$.i18n.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right" 16}}</button></td>
27+
<td><button type="submit" class="ui green button" name="op" value="{{.Name}}" title="{{$.i18n.Tr "admin.dashboard.operation_run"}}">{{svg "octicon-triangle-right"}}</button></td>
2828
<td>{{$.i18n.Tr (printf "admin.dashboard.%s" .Name)}}</td>
2929
<td>{{.Spec}}</td>
3030
<td>{{DateFmtLong .Next}}</td>

templates/admin/org/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<td>
3939
<a href="{{.HomeLink}}">{{.Name}}</a>
4040
{{if .Visibility.IsPrivate}}
41-
<span class="text gold">{{svg "octicon-lock" 16}}</span>
41+
<span class="text gold">{{svg "octicon-lock"}}</span>
4242
{{end}}
4343
</td>
4444
<td>{{.NumTeams}}</td>

templates/admin/repo/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<td>
4646
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
4747
{{if .Owner.Visibility.IsPrivate}}
48-
<span class="text gold">{{svg "octicon-lock" 16}}</span>
48+
<span class="text gold">{{svg "octicon-lock"}}</span>
4949
{{end}}
5050
</td>
5151
<td><a href="{{AppSubUrl}}/{{.Owner.Name}}/{{.Name}}">{{.Name}}</a></td>

templates/base/head_navbar.tmpl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<img class="ui tiny avatar image" width="24" height="24" src="{{.SignedUser.RelAvatarLink}}">
5151
<span class="sr-only">{{.i18n.Tr "user_profile_and_more"}}</span>
5252
<span class="mobile-only">{{.SignedUser.Name}}</span>
53-
<span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down" 16}}</span>
53+
<span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span>
5454
</span>
5555
<div class="menu user-menu" tabindex="-1">
5656
<div class="ui header">
@@ -59,7 +59,7 @@
5959

6060
<div class="divider"></div>
6161
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
62-
{{svg "octicon-sign-out" 16}}
62+
{{svg "octicon-sign-out"}}
6363
{{.i18n.Tr "sign_out"}}<!-- Sign Out -->
6464
</a>
6565
</div><!-- end content avatar menu -->
@@ -69,7 +69,7 @@
6969
<div class="right stackable menu">
7070
<a href="{{AppSubUrl}}/notifications" class="item poping up" data-content='{{.i18n.Tr "notifications"}}' data-variation="tiny inverted">
7171
<span class="text">
72-
<span class="fitted">{{svg "octicon-bell" 16}}</span>
72+
<span class="fitted">{{svg "octicon-bell"}}</span>
7373
<span class="sr-mobile-only">{{.i18n.Tr "notifications"}}</span>
7474
{{$notificationUnreadCount := 0}}
7575
{{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}
@@ -81,20 +81,20 @@
8181

8282
<div class="ui dropdown jump item poping up" data-content="{{.i18n.Tr "create_new"}}" data-variation="tiny inverted">
8383
<span class="text">
84-
<span class="fitted">{{svg "octicon-plus" 16}}</span>
84+
<span class="fitted">{{svg "octicon-plus"}}</span>
8585
<span class="sr-mobile-only">{{.i18n.Tr "create_new"}}</span>
86-
<span class="fitted not-mobile">{{svg "octicon-triangle-down" 16}}</span>
86+
<span class="fitted not-mobile">{{svg "octicon-triangle-down"}}</span>
8787
</span>
8888
<div class="menu">
8989
<a class="item" href="{{AppSubUrl}}/repo/create">
90-
<span class="fitted">{{svg "octicon-plus" 16}}</span> {{.i18n.Tr "new_repo"}}
90+
<span class="fitted">{{svg "octicon-plus"}}</span> {{.i18n.Tr "new_repo"}}
9191
</a>
9292
<a class="item" href="{{AppSubUrl}}/repo/migrate">
93-
<span class="fitted">{{svg "octicon-repo-push" 16}}</span> {{.i18n.Tr "new_migrate"}}
93+
<span class="fitted">{{svg "octicon-repo-push"}}</span> {{.i18n.Tr "new_migrate"}}
9494
</a>
9595
{{if .SignedUser.CanCreateOrganization}}
9696
<a class="item" href="{{AppSubUrl}}/org/create">
97-
<span class="fitted">{{svg "octicon-organization" 16}}</span> {{.i18n.Tr "new_org"}}
97+
<span class="fitted">{{svg "octicon-organization"}}</span> {{.i18n.Tr "new_org"}}
9898
</a>
9999
{{end}}
100100
</div><!-- end content create new menu -->
@@ -105,7 +105,7 @@
105105
<img class="ui tiny avatar image" width="24" height="24" src="{{.SignedUser.RelAvatarLink}}">
106106
<span class="sr-only">{{.i18n.Tr "user_profile_and_more"}}</span>
107107
<span class="mobile-only">{{.SignedUser.Name}}</span>
108-
<span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down" 16}}</span>
108+
<span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span>
109109
</span>
110110
<div class="menu user-menu" tabindex="-1">
111111
<div class="ui header">
@@ -114,19 +114,19 @@
114114

115115
<div class="divider"></div>
116116
<a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}">
117-
{{svg "octicon-person" 16}}
117+
{{svg "octicon-person"}}
118118
{{.i18n.Tr "your_profile"}}<!-- Your profile -->
119119
</a>
120120
<a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
121-
{{svg "octicon-star" 16}}
121+
{{svg "octicon-star"}}
122122
{{.i18n.Tr "your_starred"}}
123123
</a>
124124
<a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubUrl}}/user/settings">
125-
{{svg "octicon-tools" 16}}
125+
{{svg "octicon-tools"}}
126126
{{.i18n.Tr "your_settings"}}<!-- Your settings -->
127127
</a>
128128
<a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io">
129-
{{svg "octicon-question" 16}}
129+
{{svg "octicon-question"}}
130130
{{.i18n.Tr "help"}}<!-- Help -->
131131
</a>
132132
{{if .IsAdmin}}
@@ -140,7 +140,7 @@
140140

141141
<div class="divider"></div>
142142
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
143-
{{svg "octicon-sign-out" 16}}
143+
{{svg "octicon-sign-out"}}
144144
{{.i18n.Tr "sign_out"}}<!-- Sign Out -->
145145
</a>
146146
</div><!-- end content avatar menu -->
@@ -151,11 +151,11 @@
151151
<div class="right stackable menu">
152152
{{if .ShowRegistrationButton}}
153153
<a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up">
154-
{{svg "octicon-person" 16}} {{.i18n.Tr "register"}}
154+
{{svg "octicon-person"}} {{.i18n.Tr "register"}}
155155
</a>
156156
{{end}}
157157
<a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{.CurrentURL}}">
158-
{{svg "octicon-sign-in" 16}} {{.i18n.Tr "sign_in"}}
158+
{{svg "octicon-sign-in"}} {{.i18n.Tr "sign_in"}}
159159
</a>
160160
</div><!-- end anonymous right menu -->
161161
{{end}}

templates/explore/navbar.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<div class="ui secondary pointing tabular top attached borderless stackable menu navbar">
22
<a class="{{if .PageIsExploreRepositories}}active{{end}} item" href="{{AppSubUrl}}/explore/repos">
3-
{{svg "octicon-repo" 16}} {{.i18n.Tr "explore.repos"}}
3+
{{svg "octicon-repo"}} {{.i18n.Tr "explore.repos"}}
44
</a>
55
<a class="{{if .PageIsExploreUsers}}active{{end}} item" href="{{AppSubUrl}}/explore/users">
6-
{{svg "octicon-person" 16}} {{.i18n.Tr "explore.users"}}
6+
{{svg "octicon-person"}} {{.i18n.Tr "explore.users"}}
77
</a>
88
<a class="{{if .PageIsExploreOrganizations}}active{{end}} item" href="{{AppSubUrl}}/explore/organizations">
9-
{{svg "octicon-organization" 16}} {{.i18n.Tr "explore.organizations"}}
9+
{{svg "octicon-organization"}} {{.i18n.Tr "explore.organizations"}}
1010
</a>
1111
{{if .IsRepoIndexerEnabled}}
1212
<a class="{{if .PageIsExploreCode}}active{{end}} item" href="{{AppSubUrl}}/explore/code">
13-
{{svg "octicon-code" 16}} {{.i18n.Tr "explore.code"}}
13+
{{svg "octicon-code"}} {{.i18n.Tr "explore.code"}}
1414
</a>
1515
{{end}}
1616
</div>

templates/explore/organizations.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
<span class="header">
1313
<a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}
1414
{{if .Visibility.IsPrivate}}
15-
<span class="text gold">{{svg "octicon-lock" 16}}</span>
15+
<span class="text gold">{{svg "octicon-lock"}}</span>
1616
{{end}}
1717
</span>
1818
<div class="description">
1919
{{if .Location}}
20-
{{svg "octicon-location" 16}} {{.Location}}
20+
{{svg "octicon-location"}} {{.Location}}
2121
{{end}}
2222
{{if and .Website}}
23-
{{svg "octicon-link" 16}}
23+
{{svg "octicon-link"}}
2424
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
2525
{{end}}
26-
{{svg "octicon-clock" 16}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}}
26+
{{svg "octicon-clock"}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}}
2727
</div>
2828
</div>
2929
</div>

templates/explore/repo_list.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@
2727
{{end}}
2828
{{end}}
2929
{{if .IsFork}}
30-
<span class="middle">{{svg "octicon-repo-forked" 16}}</span>
30+
<span class="middle">{{svg "octicon-repo-forked"}}</span>
3131
{{else if .IsMirror}}
32-
<span class="middle">{{svg "octicon-mirror" 16}}</span>
32+
<span class="middle">{{svg "octicon-mirror"}}</span>
3333
{{end}}
3434
<div class="ui right metas">
3535
{{if .PrimaryLanguage }}
3636
<span class="text grey"><i class="color-icon" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
3737
{{end}}
38-
<span class="text grey">{{svg "octicon-star" 16}} {{.NumStars}}</span>
39-
<span class="text grey">{{svg "octicon-git-branch" 16}} {{.NumForks}}</span>
38+
<span class="text grey">{{svg "octicon-star"}} {{.NumStars}}</span>
39+
<span class="text grey">{{svg "octicon-git-branch"}} {{.NumForks}}</span>
4040
</div>
4141
</div>
4242
<div class="description">

templates/explore/users.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
<span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span>
1313
<div class="description">
1414
{{if .Location}}
15-
{{svg "octicon-location" 16}} {{.Location}}
15+
{{svg "octicon-location"}} {{.Location}}
1616
{{end}}
1717
{{if and $.ShowUserEmail .Email $.IsSigned (not .KeepEmailPrivate)}}
18-
{{svg "octicon-mail" 16}}
18+
{{svg "octicon-mail"}}
1919
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
2020
{{end}}
21-
{{svg "octicon-clock" 16}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}}
21+
{{svg "octicon-clock"}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}}
2222
</div>
2323
</div>
2424
</div>

0 commit comments

Comments
 (0)