From d5703d4a1bab58234c9e8e0e0e78c0cd26a90dce Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 31 Aug 2023 18:49:53 +0800 Subject: [PATCH] Remove "TODO" tasks from CSS file (#26835) 1. Use `gt-invisible` instead of `invisible`. 2. Use `gt-word-break` instead of `dont-break-out` (there is a slight different "hyphens", but I think it won't affect too much since it is only used for the "full name"). 3. Remove `.small.button:has(svg)` , now our buttons could layout SVG correctly, and actually I didn't see this CSS class is used in code. --- templates/repo/diff/section_split.tmpl | 8 ++++---- templates/repo/diff/section_unified.tmpl | 2 +- .../issue/labels/labels_selector_field.tmpl | 6 +++--- templates/repo/issue/new_form.tmpl | 2 +- .../repo/issue/view_content/sidebar.tmpl | 6 +++--- web_src/css/base.css | 20 ------------------- web_src/js/features/repo-diff.js | 4 ++-- web_src/js/features/repo-issue.js | 6 +++--- web_src/js/features/repo-legacy.js | 6 +++--- 9 files changed, 20 insertions(+), 40 deletions(-) diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index a1a5f5ba56..c543a2a061 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -47,7 +47,7 @@ {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* */}}{{end}}{{/* @@ -62,7 +62,7 @@ {{if $match.RightIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* */}}{{end}}{{/* @@ -79,7 +79,7 @@ {{if $line.LeftIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}{{/* - */}}{{/* */}}{{end}}{{/* @@ -94,7 +94,7 @@ {{if $line.RightIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}{{/* - */}}{{/* */}}{{end}}{{/* diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 98e382a0cb..f59832548f 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -52,7 +52,7 @@ {{else}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* */}}{{end}}{{/* diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl index bdec96e6ac..f8d38d035f 100644 --- a/templates/repo/issue/labels/labels_selector_field.tmpl +++ b/templates/repo/issue/labels/labels_selector_field.tmpl @@ -21,18 +21,18 @@
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}  {{RenderLabel $.Context .}} + {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}  {{RenderLabel $.Context .}} {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
{{end}}
- {{$previousExclusiveScope := "_no_scope"}} + {{$previousExclusiveScope = "_no_scope"}} {{range .OrgLabels}} {{$exclusiveScope := .ExclusiveScope}} {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}}
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}  {{RenderLabel $.Context .}} + {{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}  {{RenderLabel $.Context .}} {{if .Description}}
{{.Description | RenderEmoji $.Context}}{{end}}
{{end}} {{else}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index ca1ff287d0..fc1a3d087f 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -158,7 +158,7 @@
{{.locale.Tr "repo.issues.new.clear_assignees"}}
{{range .Assignees}} - + {{svg "octicon-check"}} {{ctx.AvatarUtils.Avatar . 28 "gt-mr-3"}}{{template "repo/search_name" .}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index ff4239bbb7..63a6a14a23 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -20,7 +20,7 @@ {{range .Reviewers}} {{if .User}} - {{svg "octicon-check"}} + {{svg "octicon-check"}} {{ctx.AvatarUtils.Avatar .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}} @@ -33,7 +33,7 @@ {{range .TeamReviewers}} {{if .Team}} - {{svg "octicon-check" 16}} + {{svg "octicon-check" 16}} {{svg "octicon-people" 16 "gt-ml-4 gt-mr-2"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}} @@ -229,7 +229,7 @@ {{$checked = true}} {{end}} {{end}} - {{svg "octicon-check"}} + {{svg "octicon-check"}} {{ctx.AvatarUtils.Avatar . 20 "gt-mr-3"}}{{template "repo/search_name" .}} diff --git a/web_src/css/base.css b/web_src/css/base.css index 7c65b6aaf1..20ddf01486 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -506,13 +506,6 @@ a.label, border-right-color: var(--color-primary); } -/* fix button enlarged vertically by svg icon */ -/* TODO: change to just `.small.button:has(svg)` but may have global side effects */ -.ui.action.input .small.button:has(svg) { - padding-top: 7px !important; - padding-bottom: 7px !important; -} - .ui.menu, .ui.vertical.menu { background: var(--color-menu); @@ -953,14 +946,6 @@ img.ui.avatar, filter: saturate(2); } -/* TODO: use gt-word-break instead */ -.dont-break-out { - overflow-wrap: break-word; - word-wrap: break-word; - word-break: break-all; - hyphens: auto; -} - .full.height { flex-grow: 1; padding-bottom: 80px; @@ -2014,11 +1999,6 @@ a.ui.basic.label:hover { margin-left: 0; } -/* TODO: replace it with gt-invisible */ -.invisible { - visibility: hidden; -} - .ui.segment, .ui.segments, .ui.attached.segment { diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js index b79ca0f5b1..864b28a3bb 100644 --- a/web_src/js/features/repo-diff.js +++ b/web_src/js/features/repo-diff.js @@ -64,9 +64,9 @@ function initRepoDiffConversationForm() { $form.closest('.conversation-holder').replaceWith($newConversationHolder); if ($form.closest('tr').data('line-type') === 'same') { - $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).addClass('gt-invisible'); } else { - $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('gt-invisible'); } $newConversationHolder.find('.dropdown').dropdown(); initCompReactionSelector($newConversationHolder); diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 194ffca57c..4f4103bb21 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -110,7 +110,7 @@ export function initRepoIssueSidebarList() { } filteredResponse.results.push({ name: `#${issue.number} ${htmlEscape(issue.title) - }
${htmlEscape(issue.repository.full_name)}
`, + }
${htmlEscape(issue.repository.full_name)}
`, value: issue.id, }); }); @@ -178,9 +178,9 @@ export function initRepoIssueCommentDelete() { const idx = $conversationHolder.data('idx'); const lineType = $conversationHolder.closest('tr').data('line-type'); if (lineType === 'same') { - $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).removeClass('gt-invisible'); } else { - $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).removeClass('gt-invisible'); } $conversationHolder.remove(); } diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 3b25c36538..51edf0bd12 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -150,7 +150,7 @@ export function initRepoCommentForm() { if ($(this).hasClass('checked')) { $(this).removeClass('checked'); - $(this).find('.octicon-check').addClass('invisible'); + $(this).find('.octicon-check').addClass('gt-invisible'); if (hasUpdateAction) { if (!($(this).data('id') in items)) { items[$(this).data('id')] = { @@ -164,7 +164,7 @@ export function initRepoCommentForm() { } } else { $(this).addClass('checked'); - $(this).find('.octicon-check').removeClass('invisible'); + $(this).find('.octicon-check').removeClass('gt-invisible'); if (hasUpdateAction) { if (!($(this).data('id') in items)) { items[$(this).data('id')] = { @@ -215,7 +215,7 @@ export function initRepoCommentForm() { $(this).parent().find('.item').each(function () { $(this).removeClass('checked'); - $(this).find('.octicon-check').addClass('invisible'); + $(this).find('.octicon-check').addClass('gt-invisible'); }); if (selector === 'select-reviewers-modify' || selector === 'select-assignees-modify') {