Skip to content

Commit 072b029

Browse files
authored
Simplify review UI (#31062)
Instead of always displaying all available actions as buttons, merge them into a single dropdown menu, same as GitHub. That decreases visual overload and is more mobile-friendly, while not losing any functionality. ## Screenshots <details><summary>Before</summary> ![grafik](https://github.com/go-gitea/gitea/assets/51889757/b957fab0-4cc7-4cf5-a6c8-33f571be7b19) </details> <details><summary>After (unexpanded)</summary> ![grafik](https://github.com/go-gitea/gitea/assets/51889757/c8fd3428-4092-4295-bd55-c243409ba90d) </details> <details><summary>After (expanded)</summary> ![grafik](https://github.com/go-gitea/gitea/assets/51889757/c0eada91-54be-42ce-9db1-0db56d971438) </details>
1 parent 6e140b5 commit 072b029

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

Diff for: templates/repo/diff/box.tmpl

+19-14
Original file line numberDiff line numberDiff line change
@@ -159,25 +159,30 @@
159159
{{if and $isReviewFile $file.HasChangedSinceLastReview}}
160160
<span class="changed-since-last-review unselectable not-mobile">{{ctx.Locale.Tr "repo.pulls.has_changed_since_last_review"}}</span>
161161
{{end}}
162-
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
163-
<button class="ui basic tiny button unescape-button not-mobile">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button>
164-
<button class="ui basic tiny button escape-button tw-hidden">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button>
165-
{{end}}
166-
{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
167-
{{if $file.IsDeleted}}
168-
<a class="ui basic tiny button" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
169-
{{else}}
170-
<a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
171-
{{if and $.Repository.CanEnableEditor $.CanEditFile (not $file.IsLFSFile) (not $file.IsBin)}}
172-
<a class="ui basic tiny button" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a>
173-
{{end}}
174-
{{end}}
175-
{{end}}
176162
{{if $isReviewFile}}
177163
<label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.AfterCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}">
178164
<input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{ctx.Locale.Tr "repo.pulls.has_viewed_file"}}
179165
</label>
180166
{{end}}
167+
<div class="ui dropdown basic">
168+
{{svg "octicon-kebab-horizontal" 18 "icon tw-mx-2"}}
169+
<div class="ui menu">
170+
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
171+
<button class="unescape-button item">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button>
172+
<button class="escape-button tw-hidden item">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button>
173+
{{end}}
174+
{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
175+
{{if $file.IsDeleted}}
176+
<a class="item" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
177+
{{else}}
178+
<a class="item" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
179+
{{if and $.Repository.CanEnableEditor $.CanEditFile (not $file.IsLFSFile) (not $file.IsBin)}}
180+
<a class="item" rel="nofollow" href="{{$.HeadRepoLink}}/_edit/{{PathEscapeSegments $.HeadBranchName}}/{{PathEscapeSegments $file.Name}}?return_uri={{print $.BackToLink "#diff-" $file.NameHash | QueryEscape}}">{{ctx.Locale.Tr "repo.editor.edit_this_file"}}</a>
181+
{{end}}
182+
{{end}}
183+
{{end}}
184+
</div>
185+
</div>
181186
</div>
182187
</h4>
183188
<div class="diff-file-body ui attached unstackable table segment" {{if and $file.IsViewed $.IsShowingAllCommits}}data-folded="true"{{end}}>

0 commit comments

Comments
 (0)