Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2f58e69

Browse files
committedFeb 19, 2023
fix
1 parent 7eaf192 commit 2f58e69

File tree

9 files changed

+35
-52
lines changed

9 files changed

+35
-52
lines changed
 

‎templates/repo/diff/box.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
{{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
2525
</div>
2626
</div>
27-
<div class="diff-detail-actions gt-df gt-ac">
27+
<div class="diff-detail-actions gt-df gt-ac gt-w-100">
2828
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}}
2929
<progress id="viewed-files-summary" class="gt-mr-2" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress>
30-
<label for="viewed-files-summary" id="viewed-files-summary-label" class="gt-mr-3" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}">
30+
<label for="viewed-files-summary" id="viewed-files-summary-label" class="gt-mr-3 gt-f1" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}">
3131
{{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}}
3232
</label>
3333
{{end}}

‎templates/repo/diff/new_review.tmpl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<div class="ui top right pointing dropdown custom" id="review-box">
2-
<div class="ui tiny green button btn-review gt-ml-2 gt-mr-0">
1+
<div id="review-box">
2+
<button class="ui tiny green button gt-ml-2 gt-mr-0 js-btn-review">
33
{{.locale.Tr "repo.diff.review"}}
44
<span class="ui small label review-comments-counter" data-pending-comment-number="{{.PendingCodeCommentNumber}}">{{.PendingCodeCommentNumber}}</span>
55
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
6-
</div>
7-
<div class="menu review-box">
8-
<div class="ui clearing segment">
6+
</button>
7+
<div class="review-box-panel gt-hidden">
8+
<div class="ui segment">
99
<form class="ui form" action="{{.Link}}/reviews/submit" method="post">
1010
{{.CsrfTokenHtml}}
1111
<input type="hidden" name="commit_id" value="{{.AfterCommitID}}"/>

‎templates/repo/home.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{.locale.Tr "repo.find_file.go_to_file"}}</a>
7878
{{end}}
7979
{{if or .CanAddFile .CanUploadFile}}
80-
<button class="ui basic small compact dropdown jump icon button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
80+
<button class="ui basic compact dropdown jump icon button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
8181
<span class="text">{{.locale.Tr "repo.editor.add_file"}}</span>
8282
<div class="menu">
8383
{{if .CanAddFile}}

‎web_src/js/features/common-global.js

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export function initGlobalEnterQuickSubmit() {
6060
export function initGlobalButtonClickOnEnter() {
6161
$(document).on('keypress', '.ui.button', (e) => {
6262
if (e.keyCode === 13 || e.keyCode === 32) { // enter key or space bar
63+
if (e.target.nodeName === 'BUTTON') return; // button already handles space&enter correctly
6364
$(e.target).trigger('click');
6465
e.preventDefault();
6566
}

‎web_src/js/features/repo-issue.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ export function initRepoPullRequestReview() {
470470
assignMenuAttributes(form.find('.menu'));
471471
});
472472

473-
const $reviewBox = $('.review-box');
473+
const $reviewBox = $('.review-box-panel');
474474
if ($reviewBox.length === 1) {
475475
(async () => {
476476
// the editor's height is too large in some cases, and the panel cannot be scrolled with page now because there is `.repository .diff-detail-box.sticky { position: sticky; }`
@@ -487,12 +487,12 @@ export function initRepoPullRequestReview() {
487487
return;
488488
}
489489

490-
$('.btn-review').on('click', function (e) {
490+
$('.js-btn-review').on('click', function (e) {
491491
e.preventDefault();
492-
$(this).closest('.dropdown').find('.menu').toggle('visible'); // eslint-disable-line
493-
}).closest('.dropdown').find('.close').on('click', function (e) {
492+
toggleElem($(this).parent().find('.review-box-panel'));
493+
}).parent().find('.review-box-panel .close').on('click', function (e) {
494494
e.preventDefault();
495-
$(this).closest('.menu').toggle('visible'); // eslint-disable-line
495+
hideElem($(this).closest('.review-box-panel'));
496496
});
497497

498498
$(document).on('click', 'a.add-code-comment', async function (e) {

‎web_src/less/_base.less

+5-16
Original file line numberDiff line numberDiff line change
@@ -2477,24 +2477,13 @@ table th[data-sortt-desc] {
24772477
}
24782478
}
24792479

2480-
/* fix up SVG dropdown triangles because fomantic thinks they are icon fonts */
2481-
/* see https://github.com/go-gitea/gitea/issues/14014 */
2482-
.ui.dropdown > .dropdown.icon,
2483-
.btn-review > .dropdown.icon {
2484-
height: auto !important;
2485-
margin-left: .5rem !important;
2486-
margin-top: -1px !important;
2487-
margin-bottom: -1px !important;
2488-
margin-right: -.5rem !important;
2480+
.ui.dropdown .svg.dropdown.icon,
2481+
.svg.dropdown.icon {
2482+
margin-top: 0 !important; // reset the "ui.selection.dropdown > .dropdown.icon {margin-top}", for the Issue Dependencies dropdown
2483+
margin-right: -.5rem !important; // fix up SVG dropdown triangles because Fomantic thinks they are icon fonts
2484+
height: auto; // reset the ".ui.dropdown > .dropdown.icon {height}", otherwise the icon would be too small
24892485
}
2490-
.ui.button.dropdown > .dropdown.icon,
2491-
.btn-review > .dropdown.icon {
2492-
float: right !important;
24932486

2494-
@media (max-width: 480px) {
2495-
display: none;
2496-
}
2497-
}
24982487
.ui.selection.dropdown > .search.icon,
24992488
.ui.selection.dropdown > .delete.icon,
25002489
.ui.selection.dropdown > .dropdown.icon {

‎web_src/less/_editor.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414

1515
.editor-toolbar {
16-
opacity: 1 !important;
16+
max-width: calc(100vw - 80px);
1717
border-color: var(--color-secondary);
1818
}
1919

‎web_src/less/_repository.less

-5
Original file line numberDiff line numberDiff line change
@@ -2888,11 +2888,6 @@
28882888
margin-top: 10px;
28892889
}
28902890

2891-
.repo-button-row .dropdown > .dropdown.icon {
2892-
margin-left: .25rem !important;
2893-
margin-right: 0 !important;
2894-
}
2895-
28962891
.wiki .repo-button-row {
28972892
margin-bottom: 0;
28982893
}

‎web_src/less/_review.less

+15-17
Original file line numberDiff line numberDiff line change
@@ -220,47 +220,45 @@ a.blob-excerpt:hover {
220220

221221
// See the comment of createCommentEasyMDE() for the review editor
222222
// EasyMDE's options can not handle minHeight & maxHeight together correctly, we have to set minHeight in JS code
223-
#review-box .CodeMirror-scroll {
223+
.review-box-panel .CodeMirror-scroll {
224224
min-height: 80px;
225225
max-height: calc(100vh - 360px);
226226
}
227227

228228
@media @mediaSm {
229-
#review-box > .menu {
230-
> .ui.segment {
231-
width: 94vw;
232-
}
233-
234-
.editor-toolbar {
235-
overflow-x: auto;
236-
}
237-
}
238-
239-
#review-box .CodeMirror-scroll {
229+
.review-box-panel .CodeMirror-scroll {
240230
max-width: calc(100vw - 70px);
241231
}
242232
}
243233

244234
@media @mediaMd {
245-
#review-box .CodeMirror-scroll {
235+
.review-box-panel .CodeMirror-scroll {
246236
max-width: 700px;
247237
}
248238
}
249239

250240
@media @mediaLg {
251-
#review-box .CodeMirror-scroll {
241+
.review-box-panel .CodeMirror-scroll {
252242
max-width: 800px;
253243
}
254244
}
255245

256246
@media @mediaXl {
257-
#review-box .CodeMirror-scroll {
247+
.review-box-panel .CodeMirror-scroll {
258248
max-width: 900px;
259249
}
260250
}
261251

262-
.review-box > .segment {
263-
border: none !important;
252+
#review-box {
253+
position: relative;
254+
}
255+
256+
.review-box-panel {
257+
position: absolute;
258+
min-width: max-content;
259+
top: 45px;
260+
right: -5px;
261+
z-index: 2;
264262
}
265263

266264
#review-box .review-comments-counter {

0 commit comments

Comments
 (0)
Please sign in to comment.