Skip to content

Commit

Permalink
Merge branch 'main' into advertice-webauthn-support
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Feb 15, 2024
2 parents 48cb1ff + 363b5f0 commit 6a06abc
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 56 deletions.
1 change: 1 addition & 0 deletions routers/web/repo/setting/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func WebhooksNew(ctx *context.Context) {
}
}
ctx.Data["BaseLink"] = orCtx.LinkNew
ctx.Data["BaseLinkNew"] = orCtx.LinkNew

ctx.HTML(http.StatusOK, orCtx.NewTemplate)
}
Expand Down
6 changes: 3 additions & 3 deletions templates/repo/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<div class="flex-item gt-ac">
<div class="flex-item-leading">{{template "repo/icon" .}}</div>
<div class="flex-item-main">
<div class="flex-item-title">
<a class="text light thin" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
<a class="text primary" href="{{$.RepoLink}}">{{.Name}}</a></div>
<div class="flex-item-title gt-font-18">
<a class="muted gt-font-normal" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
<a class="muted" href="{{$.RepoLink}}">{{.Name}}</a></div>
</div>
<div class="flex-item-trailing">
{{if .IsArchived}}
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/icon.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{$avatarLink := (.RelAvatarLink ctx)}}
{{if $avatarLink}}
<img class="ui avatar gt-vm" src="{{$avatarLink}}" width="32" height="32" alt="{{.FullName}}">
<img class="ui avatar gt-vm" src="{{$avatarLink}}" width="24" height="24" alt="{{.FullName}}">
{{else if $.IsMirror}}
{{svg "octicon-mirror" 32}}
{{svg "octicon-mirror" 24}}
{{else if $.IsFork}}
{{svg "octicon-repo-forked" 32}}
{{svg "octicon-repo-forked" 24}}
{{else}}
{{svg "octicon-repo" 32}}
{{svg "octicon-repo" 24}}
{{end}}
47 changes: 1 addition & 46 deletions templates/repo/settings/webhook/base_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,7 @@
<div class="ui right">
<div class="ui jump dropdown">
<div class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</div>
<div class="menu">
<a class="item" href="{{.BaseLinkNew}}/gitea/new">
{{template "shared/webhook/icon" (dict "HookType" "gitea" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_gitea"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/gogs/new">
{{template "shared/webhook/icon" (dict "HookType" "gogs" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_gogs"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/slack/new">
{{template "shared/webhook/icon" (dict "HookType" "slack" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_slack"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/discord/new">
{{template "shared/webhook/icon" (dict "HookType" "discord" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_discord"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/dingtalk/new">
{{template "shared/webhook/icon" (dict "HookType" "dingtalk" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/telegram/new">
{{template "shared/webhook/icon" (dict "HookType" "telegram" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_telegram"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/msteams/new">
{{template "shared/webhook/icon" (dict "HookType" "msteams" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_msteams"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/feishu/new">
{{template "shared/webhook/icon" (dict "HookType" "feishu" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_feishu_or_larksuite"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/matrix/new">
{{template "shared/webhook/icon" (dict "HookType" "matrix" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_matrix"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/wechatwork/new">
{{template "shared/webhook/icon" (dict "HookType" "wechatwork" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/packagist/new">
{{template "shared/webhook/icon" (dict "HookType" "packagist" "Size" 20)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_packagist"}}
</a>
</div>
{{template "repo/settings/webhook/link_menu" .}}
</div>
</div>
</h4>
Expand Down
50 changes: 50 additions & 0 deletions templates/repo/settings/webhook/link_menu.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{$size := 20}}
{{if .Size}}
{{$size = .Size}}
{{end}}
<div class="menu">
<a class="item" href="{{.BaseLinkNew}}/gitea/new">
{{template "shared/webhook/icon" (dict "HookType" "gitea" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_gitea"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/gogs/new">
{{template "shared/webhook/icon" (dict "HookType" "gogs" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_gogs"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/slack/new">
{{template "shared/webhook/icon" (dict "HookType" "slack" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_slack"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/discord/new">
{{template "shared/webhook/icon" (dict "HookType" "discord" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_discord"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/dingtalk/new">
{{template "shared/webhook/icon" (dict "HookType" "dingtalk" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_dingtalk"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/telegram/new">
{{template "shared/webhook/icon" (dict "HookType" "telegram" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_telegram"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/msteams/new">
{{template "shared/webhook/icon" (dict "HookType" "msteams" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_msteams"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/feishu/new">
{{template "shared/webhook/icon" (dict "HookType" "feishu" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_feishu_or_larksuite"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/matrix/new">
{{template "shared/webhook/icon" (dict "HookType" "matrix" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_matrix"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/wechatwork/new">
{{template "shared/webhook/icon" (dict "HookType" "wechatwork" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_wechatwork"}}
</a>
<a class="item" href="{{.BaseLinkNew}}/packagist/new">
{{template "shared/webhook/icon" (dict "HookType" "packagist" "Size" $size)}}
{{ctx.Locale.Tr "repo.settings.web_hook_name_packagist"}}
</a>
</div>
2 changes: 1 addition & 1 deletion templates/shared/webhook/icon.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{$size = .Size}}
{{end}}
{{if eq .HookType "gitea"}}
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gitea.svg">
{{svg "gitea-gitea" $size "img"}}
{{else if eq .HookType "gogs"}}
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
Expand Down
9 changes: 7 additions & 2 deletions templates/webhook/new.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<h4 class="ui top attached header">
{{.CustomHeaderTitle}}
<div class="ui right">
{{template "shared/webhook/icon" .ctxData}}
<div class="ui right type dropdown">
<div class="text gt-df gt-ac">
{{template "shared/webhook/icon" (dict "Size" 20 "HookType" .ctxData.HookType)}}
{{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .ctxData.HookType)}}
</div>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
{{template "repo/settings/webhook/link_menu" .ctxData}}
</div>
</h4>
<div class="ui attached segment">
Expand Down
7 changes: 7 additions & 0 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ ol.ui.list li,
color: var(--color-text-light-2);
}

/* extend fomantic style '.ui.dropdown > .text > img' to include svg.img */
.ui.dropdown > .text > .img {
margin-left: 0;
float: none;
margin-right: 0.78571429rem;
}

.ui.dropdown > .text > .description,
.ui.dropdown .menu > .item > .description {
color: var(--color-text-light-2);
Expand Down

0 comments on commit 6a06abc

Please sign in to comment.