code.gitea.io/gitea@v1.22.3/templates/repo/commit_page.tmpl (about)

     1  {{template "base/head" .}}
     2  <div role="main" aria-label="{{.Title}}" class="page-content repository diff">
     3  	{{template "repo/header" .}}
     4  	<div class="ui container fluid padded">
     5  		{{$class := ""}}
     6  		{{if .Commit.Signature}}
     7  			{{$class = (print $class " isSigned")}}
     8  			{{if .Verification.Verified}}
     9  				{{if eq .Verification.TrustStatus "trusted"}}
    10  					{{$class = (print $class " isVerified")}}
    11  				{{else if eq .Verification.TrustStatus "untrusted"}}
    12  					{{$class = (print $class " isVerifiedUntrusted")}}
    13  				{{else}}
    14  					{{$class = (print $class " isVerifiedUnmatched")}}
    15  				{{end}}
    16  			{{else if .Verification.Warning}}
    17  				{{$class = (print $class " isWarning")}}
    18  			{{end}}
    19  		{{end}}
    20  		<div class="ui top attached header clearing segment tw-relative commit-header {{$class}}">
    21  			<div class="tw-flex tw-mb-4 tw-gap-1">
    22  				<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
    23  				{{if not $.PageIsWiki}}
    24  					<div class="commit-header-buttons">
    25  						<a class="ui primary tiny button" href="{{.SourcePath}}">
    26  							{{ctx.Locale.Tr "repo.diff.browse_source"}}
    27  						</a>
    28  						{{if and ($.Permission.CanWrite ctx.Consts.RepoUnitTypeCode) (not $.Repository.IsArchived) (not .IsDeleted)}}{{- /* */ -}}
    29  							<div class="ui dropdown primary tiny button">
    30  								{{ctx.Locale.Tr "repo.commit.operations"}}
    31  								{{svg "octicon-triangle-down" 14 "dropdown icon"}}
    32  								<div class="menu">
    33  									<div class="ui header">{{ctx.Locale.Tr "repo.commit.operations"}}</div>
    34  									<div class="divider"></div>
    35  									<div class="item show-create-branch-modal"
    36  										data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}}
    37  										data-branch-from="{{ShortSha .CommitID}}"
    38  										data-branch-from-urlcomponent="{{.CommitID}}"
    39  										data-modal="#create-branch-modal">
    40  										{{ctx.Locale.Tr "repo.branch.create_branch_operation"}}
    41  									</div>
    42  									<div class="item show-create-branch-modal"
    43  										data-content="{{ctx.Locale.Tr "repo.branch.new_branch_from" (.CommitID)}}" {{/* used by the form */}}
    44  										data-branch-from="{{ShortSha .CommitID}}"
    45  										data-branch-from-urlcomponent="{{.CommitID}}"
    46  										data-modal="#create-tag-modal"
    47  										data-modal-from-span="#modal-create-tag-from-span"
    48  										data-modal-form="#create-tag-form">
    49  										{{ctx.Locale.Tr "repo.tag.create_tag_operation"}}
    50  									</div>
    51  									<div class="item show-modal revert-button"
    52  										data-modal="#cherry-pick-modal"
    53  										data-modal-cherry-pick-type="revert"
    54  										data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.revert-header" (ShortSha .CommitID)}}"
    55  										data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.revert-content"}}"
    56  										data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.revert"}}">{{ctx.Locale.Tr "repo.commit.revert"}}</div>
    57  									<div class="item cherry-pick-button show-modal"
    58  										data-modal="#cherry-pick-modal"
    59  										data-modal-cherry-pick-type="cherry-pick"
    60  										data-modal-cherry-pick-header="{{ctx.Locale.Tr "repo.commit.cherry-pick-header" (ShortSha .CommitID)}}"
    61  										data-modal-cherry-pick-content="{{ctx.Locale.Tr "repo.commit.cherry-pick-content"}}"
    62  										data-modal-cherry-pick-submit="{{ctx.Locale.Tr "repo.commit.cherry-pick"}}">{{ctx.Locale.Tr "repo.commit.cherry-pick"}}</div>
    63  									<div class="ui g-modal-confirm modal" id="cherry-pick-modal">
    64  										<div class="header">
    65  											<span id="cherry-pick-header"></span>
    66  										</div>
    67  										<div class="content">
    68  											<p id="cherry-pick-content" class="branch-dropdown"></p>
    69  											{{template "repo/branch_dropdown" dict "root" .
    70  												"noTag" true "disableCreateBranch" true
    71  												"branchForm" "branch-dropdown-form"
    72  												"branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" ""
    73  												"setAction" true "submitForm" true}}
    74  											<form method="get" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form">
    75  												<input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}">
    76  												<input type="hidden" name="refType" value="branch">
    77  												<input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br>
    78  												<button type="submit" id="cherry-pick-submit" class="ui primary button"></button>
    79  											</form>
    80  										</div>
    81  									</div>
    82  									<div class="ui small modal" id="create-branch-modal">
    83  										<div class="header">
    84  											{{ctx.Locale.Tr "repo.branch.new_branch"}}
    85  										</div>
    86  										<div class="content">
    87  											<form class="ui form" id="create-branch-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
    88  												{{.CsrfTokenHtml}}
    89  												<div class="field">
    90  													<label>
    91  														{{ctx.Locale.Tr "repo.branch.new_branch_from" (`<span class="text" id="modal-create-branch-from-span"></span>`|SafeHTML)}}
    92  													</label>
    93  												</div>
    94  												<div class="required field">
    95  													<label for="new_branch_name">{{ctx.Locale.Tr "repo.branch.name"}}</label>
    96  													<input id="new_branch_name" name="new_branch_name" required>
    97  												</div>
    98  
    99  												<div class="text right actions">
   100  													<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
   101  													<button class="ui primary button">{{ctx.Locale.Tr "repo.branch.confirm_create_branch"}}</button>
   102  												</div>
   103  											</form>
   104  										</div>
   105  									</div>
   106  									<div class="ui small modal" id="create-tag-modal">
   107  										<div class="header">
   108  											{{ctx.Locale.Tr "repo.tag.create_tag_operation"}}
   109  										</div>
   110  										<div class="content">
   111  											<form class="ui form" id="create-tag-form" action="" data-base-action="{{.RepoLink}}/branches/_new/commit/" method="post">
   112  												{{.CsrfTokenHtml}}
   113  												<input type="hidden" name="create_tag" value="true">
   114  												<div class="field">
   115  													<label>
   116  														{{ctx.Locale.Tr "repo.tag.create_tag_from" (`<span class="text" id="modal-create-tag-from-span"></span>`|SafeHTML)}}
   117  													</label>
   118  												</div>
   119  												<div class="required field">
   120  													<label for="new_branch_name">{{ctx.Locale.Tr "repo.release.tag_name"}}</label>
   121  													<input id="new_branch_name" name="new_branch_name" required>
   122  												</div>
   123  
   124  												<div class="text right actions">
   125  													<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
   126  													<button class="ui primary button">{{ctx.Locale.Tr "repo.tag.confirm_create_tag"}}</button>
   127  												</div>
   128  											</form>
   129  										</div>
   130  									</div>
   131  								</div>
   132  							</div>
   133  						{{end}}
   134  					</div>
   135  				{{end}}
   136  			</div>
   137  			{{if IsMultilineCommitMessage .Commit.Message}}
   138  				<pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre>
   139  			{{end}}
   140  			{{template "repo/commit_load_branches_and_tags" .}}
   141  		</div>
   142  		<div class="ui{{if not .Commit.Signature}} bottom{{end}} attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}">
   143  				<div class="tw-flex tw-items-center author">
   144  					{{if .Author}}
   145  						{{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}}
   146  						{{if .Author.FullName}}
   147  							<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
   148  						{{else}}
   149  							<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
   150  						{{end}}
   151  					{{else}}
   152  						{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "tw-mr-2"}}
   153  						<strong>{{.Commit.Author.Name}}</strong>
   154  					{{end}}
   155  					<span class="text grey tw-ml-2" id="authored-time">{{TimeSince .Commit.Author.When ctx.Locale}}</span>
   156  					{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
   157  						<span class="text grey tw-mx-2">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
   158  						{{if ne .Verification.CommittingUser.ID 0}}
   159  							{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "tw-mx-2"}}
   160  							<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
   161  						{{else}}
   162  							{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "tw-mr-2"}}
   163  							<strong>{{.Commit.Committer.Name}}</strong>
   164  						{{end}}
   165  					{{end}}
   166  				</div>
   167  				<div class="tw-flex tw-items-center">
   168  					{{if .Parents}}
   169  						<div>
   170  							<span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
   171  							{{range .Parents}}
   172  								{{if $.PageIsWiki}}
   173  									<a class="ui primary sha label" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .}}">{{ShortSha .}}</a>
   174  								{{else}}
   175  									<a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{PathEscape .}}">{{ShortSha .}}</a>
   176  								{{end}}
   177  							{{end}}
   178  						</div>
   179  					{{end}}
   180  					<div class="item">
   181  						<span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
   182  						<span class="ui primary sha label">{{ShortSha .CommitID}}</span>
   183  					</div>
   184  				</div>
   185  		</div>
   186  		{{if .Commit.Signature}}
   187  			<div class="ui bottom attached message tw-text-left tw-flex tw-items-center tw-justify-between commit-header-row tw-flex-wrap tw-mb-0 {{$class}}">
   188  				<div class="tw-flex tw-items-center">
   189  					{{if .Verification.Verified}}
   190  						{{if ne .Verification.SigningUser.ID 0}}
   191  							{{svg "gitea-lock" 16 "tw-mr-2"}}
   192  							{{if eq .Verification.TrustStatus "trusted"}}
   193  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
   194  							{{else if eq .Verification.TrustStatus "untrusted"}}
   195  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
   196  							{{else}}
   197  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
   198  							{{end}}
   199  							{{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}}
   200  							<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
   201  						{{else}}
   202  							<span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span>
   203  							<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
   204  							{{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}}
   205  							<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
   206  						{{end}}
   207  					{{else}}
   208  						{{svg "gitea-unlock" 16 "tw-mr-2"}}
   209  						<span class="ui text">{{ctx.Locale.Tr .Verification.Reason}}</span>
   210  					{{end}}
   211  				</div>
   212  				<div class="tw-flex tw-items-center">
   213  					{{if .Verification.Verified}}
   214  						{{if ne .Verification.SigningUser.ID 0}}
   215  							{{svg "octicon-verified" 16 "tw-mr-2"}}
   216  							{{if .Verification.SigningSSHKey}}
   217  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
   218  								{{.Verification.SigningSSHKey.Fingerprint}}
   219  							{{else}}
   220  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
   221  								{{.Verification.SigningKey.PaddedKeyID}}
   222  							{{end}}
   223  						{{else}}
   224  							{{svg "octicon-unverified" 16 "tw-mr-2"}}
   225  							{{if .Verification.SigningSSHKey}}
   226  								<span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
   227  								{{.Verification.SigningSSHKey.Fingerprint}}
   228  							{{else}}
   229  								<span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
   230  								{{.Verification.SigningKey.PaddedKeyID}}
   231  							{{end}}
   232  						{{end}}
   233  					{{else if .Verification.Warning}}
   234  						{{svg "octicon-unverified" 16 "tw-mr-2"}}
   235  						{{if .Verification.SigningSSHKey}}
   236  							<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
   237  							{{.Verification.SigningSSHKey.Fingerprint}}
   238  						{{else}}
   239  							<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
   240  							{{.Verification.SigningKey.PaddedKeyID}}
   241  						{{end}}
   242  					{{else}}
   243  						{{if .Verification.SigningKey}}
   244  							{{if ne .Verification.SigningKey.KeyID ""}}
   245  								{{svg "octicon-verified" 16 "tw-mr-2"}}
   246  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
   247  								{{.Verification.SigningKey.PaddedKeyID}}
   248  							{{end}}
   249  						{{end}}
   250  						{{if .Verification.SigningSSHKey}}
   251  							{{if ne .Verification.SigningSSHKey.Fingerprint ""}}
   252  								{{svg "octicon-verified" 16 "tw-mr-2"}}
   253  								<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
   254  								{{.Verification.SigningSSHKey.Fingerprint}}
   255  							{{end}}
   256  						{{end}}
   257  					{{end}}
   258  				</div>
   259  			</div>
   260  		{{end}}
   261  		{{if .NoteRendered}}
   262  			<div class="ui top attached header segment git-notes">
   263  				{{svg "octicon-note" 16 "tw-mr-2"}}
   264  				{{ctx.Locale.Tr "repo.diff.git-notes"}}:
   265  				{{if .NoteAuthor}}
   266  					<a href="{{.NoteAuthor.HomeLink}}">
   267  						{{if .NoteAuthor.FullName}}
   268  							<strong>{{.NoteAuthor.FullName}}</strong>
   269  						{{else}}
   270  							<strong>{{.NoteCommit.Author.Name}}</strong>
   271  						{{end}}
   272  					</a>
   273  				{{else}}
   274  					<strong>{{.NoteCommit.Author.Name}}</strong>
   275  				{{end}}
   276  				<span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span>
   277  			</div>
   278  			<div class="ui bottom attached info segment git-notes">
   279  				<pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>
   280  			</div>
   281  		{{end}}
   282  		{{template "repo/diff/box" .}}
   283  	</div>
   284  </div>
   285  {{template "base/footer" .}}