Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom SVGs for commit signing lock icon #12017

Merged
merged 6 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/svg/gitea-lock-cog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/gitea-lock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/gitea-unlock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions templates/repo/commit_page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<div class="ui bottom attached message {{$class}}">
{{if .Verification.Verified }}
{{if ne .Verification.SigningUser.ID 0}}
<i class="lock icon"></i>
{{svg "gitea-lock" 16}}
{{if eq .Verification.TrustStatus "trusted"}}
<span class="ui text">{{.i18n.Tr "repo.commits.signed_by"}}:</span>
{{else if eq .Verification.TrustStatus "untrusted"}}
Expand All @@ -102,17 +102,14 @@
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.Name}}</strong> <{{.Verification.SigningEmail}}></a>
<span class="pull-right"><span class="ui text">{{.i18n.Tr "repo.commits.gpg_key_id"}}:</span> {{.Verification.SigningKey.KeyID}}</span>
{{else}}
<i class="icons" title="{{.i18n.Tr "gpg.default_key"}}">
<i class="lock icon"></i>
<i class="tiny inverted cog icon centerlock"></i>
</i>
<span title="{{.i18n.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16}}</span>
<span class="ui text">{{.i18n.Tr "repo.commits.signed_by"}}:</span>
<img class="ui avatar image" src="{{AvatarLink .Verification.SigningEmail}}" />
<strong>{{.Verification.SigningUser.Name}}</strong> <{{.Verification.SigningEmail}}>
<span class="pull-right"><span class="ui text">{{.i18n.Tr "repo.commits.gpg_key_id"}}:</span> <i class="cogs icon" title="{{.i18n.Tr "gpg.default_key"}}"></i>{{.Verification.SigningKey.KeyID}}</span>
{{end}}
{{else if .Verification.Warning}}
<i class="unlock icon"></i>
{{svg "gitea-unlock" 16}}
<span class="ui text">{{.i18n.Tr .Verification.Reason}}</span>
<span class="pull-right"><span class="ui text">{{.i18n.Tr "repo.commits.gpg_key_id"}}:</span> <i class="warning icon"></i>{{.Verification.SigningKey.KeyID}}</span>
{{else}}
Expand Down
9 changes: 3 additions & 6 deletions templates/repo/shabox_badge.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
{{if .verification.Verified}}
<div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{$.root.i18n.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.root.i18n.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}">
{{if ne .verification.SigningUser.ID 0}}
<i class="lock icon"></i>
{{svg "gitea-lock" 16}}
<img class="ui signature avatar image" src="{{.verification.SigningUser.RelAvatarLink}}" />
{{else}}
<i title="{{.verification.Reason}}" class="icons">
<i class="lock icon"></i>
<i class="tiny inverted cog icon centerlock"></i>
</i>
<span title="{{$.root.i18n.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16}}</span>
<img class="ui signature avatar image" src="{{AvatarLink .verification.SigningEmail}}" />
{{end}}
</div>
{{else}}
<i title="{{$.root.i18n.Tr .verification.Reason}}" class="unlock icon"></i>
<span title="{{$.root.i18n.Tr .verification.Reason}}">{{svg "gitea-unlock" 16}}</span>
{{end}}
</div>
6 changes: 5 additions & 1 deletion web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,12 @@
margin-right: 0;
}

.svg {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this change?

Copy link
Contributor Author

@CirnoT CirnoT Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add proper margin on the right of svg inside flex container

margin: 0 .25em 0 0;
}

> div {
display: inline-flex;
display: flex;
align-items: center;
}
}
Expand Down
5 changes: 4 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ module.exports = {
serviceworker: [
resolve(__dirname, 'web_src/js/serviceworker.js'),
],
icons: glob('node_modules/@primer/octicons/build/svg/**/*.svg'),
icons: [
...glob('node_modules/@primer/octicons/build/svg/**/*.svg'),
...glob('assets/svg/*.svg'),
],
...themes,
},
devtool: false,
Expand Down