diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-02-19 12:06:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 12:06:14 +0800 |
commit | d32af84a1002ceb235c86e4ac569c866ab7816d4 (patch) | |
tree | 3832638122aac31fdc2215f85873629fd8ef2fd2 /templates/repo/issue | |
parent | 6221a6fd5450692ae27e5602b41fc9ebd9150736 (diff) | |
download | gitea-d32af84a1002ceb235c86e4ac569c866ab7816d4.tar.gz gitea-d32af84a1002ceb235c86e4ac569c866ab7816d4.zip |
Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, remove inline style=display:none (#22950)
Close #22847
This PR:
* introduce Gitea's own `showElem` and related functions
* remove jQuery show/hide
* remove .hide class
* remove inline style=display:none
From now on:
do not use:
* "[hidden]" attribute: it's too weak, can not be applied to an element
with "display: flex"
* ".hidden" class: it has been polluted by Fomantic UI in many cases
* inline style="display: none": it's difficult to tweak
* jQuery's show/hide/toggle: it can not show/hide elements with
"display: xxx !important"
only use:
* this ".gt-hidden" class
* showElem/hideElem/toggleElem functions in "utils/dom.js"
cc: @silverwind , this is the all-in-one PR
Diffstat (limited to 'templates/repo/issue')
-rw-r--r-- | templates/repo/issue/branch_selector_field.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/labels/label.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/labels/labels_sidebar.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/list.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/milestone_issues.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/pull_merge_instruction.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 8 |
12 files changed, 31 insertions, 31 deletions
diff --git a/templates/repo/issue/branch_selector_field.tmpl b/templates/repo/issue/branch_selector_field.tmpl index 0d87b0687c..51eb5e26a0 100644 --- a/templates/repo/issue/branch_selector_field.tmpl +++ b/templates/repo/issue/branch_selector_field.tmpl @@ -39,7 +39,7 @@ <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector">{{.}}</div> {{end}} </div> - <div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}}" style="display: none"> + <div id="tag-list" class="scrolling menu reference-list-menu {{if not .Issue}}new-issue{{end}} gt-hidden"> {{if .Reference}} <div class="item text small" data-id="" data-id-selector="#ref_selector"><strong><a href="#">{{.locale.Tr "repo.clear_ref"}}</a></strong></div> {{end}} diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl index 87d8f0c41c..6e9177aec2 100644 --- a/templates/repo/issue/labels/label.tmpl +++ b/templates/repo/issue/labels/label.tmpl @@ -1,5 +1,5 @@ <a - class="item {{if not .label.IsChecked}}hide{{end}}" + class="item {{if not .label.IsChecked}}gt-hidden{{end}}" id="label_{{.label.ID}}" href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} > diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl index e2ef38d625..bd878d6f5c 100644 --- a/templates/repo/issue/labels/labels_sidebar.tmpl +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -1,5 +1,5 @@ <div class="ui labels list"> - <span class="no-select item {{if .ctx.HasSelectedLabel}}hide{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span> + <span class="no-select item {{if .ctx.HasSelectedLabel}}gt-hidden{{end}}">{{.ctx.locale.Tr "repo.issues.new.no_label"}}</span> <span class="labels-list"> {{range .ctx.Labels}} {{template "repo/issue/labels/label" dict "root" $.root "label" .}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 0e4969a706..2b1bea822f 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -199,7 +199,7 @@ </div> </div> </div> - <div id="issue-actions" class="ui stackable grid hide"> + <div id="issue-actions" class="ui stackable grid gt-hidden"> <div class="six wide column"> {{template "repo/issue/openclose" .}} </div> diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 57012bddb6..fca9597446 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -135,7 +135,7 @@ </div> </div> </div> - <div id="issue-actions" class="ui stackable grid hide"> + <div id="issue-actions" class="ui stackable grid gt-hidden"> <div class="six wide column"> {{template "repo/issue/openclose" .}} </div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 2a6fcaa995..8346d07a13 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -134,7 +134,7 @@ </div> </div> <div class="ui select-milestone list"> - <span class="no-select item {{if .Milestone}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span> + <span class="no-select item {{if .Milestone}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span> <div class="selected"> {{if .Milestone}} <a class="item muted sidebar-item-link" href="{{.RepoLink}}/issues?milestone={{.Milestone.ID}}"> @@ -198,7 +198,7 @@ </div> </div> <div class="ui select-project list"> - <span class="no-select item {{if .Project}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span> + <span class="no-select item {{if .Project}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span> <div class="selected"> {{if .Project}} <a class="item muted sidebar-item-link" href="{{.RepoLink}}/projects/{{.Project.ID}}"> @@ -236,11 +236,11 @@ </div> </div> <div class="ui assignees list"> - <span class="no-select item {{if .HasSelectedLabel}}hide{{end}}"> + <span class="no-select item {{if .HasSelectedLabel}}gt-hidden{{end}}"> {{.locale.Tr "repo.issues.new.no_assignees"}} </span> {{range .Assignees}} - <a class="hide item gt-p-2 muted" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}"> + <a class="item gt-p-2 muted gt-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}"> {{avatar $.Context . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}} </a> {{end}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index ab419472ed..887dd2c42d 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -77,8 +77,8 @@ <span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span> {{end}} </div> - <div id="issue-{{.Issue.ID}}-raw" class="raw-content hide">{{.Issue.Content}}</div> - <div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div> + <div id="issue-{{.Issue.ID}}-raw" class="raw-content gt-hidden">{{.Issue.Content}}</div> + <div class="edit-content-zone gt-hidden" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}" data-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/attachments" data-view-attachment-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/view-attachments"></div> {{if .Issue.Attachments}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Issue.Attachments "Content" .Issue.RenderedContent}} {{end}} @@ -194,7 +194,7 @@ {{template "repo/issue/view_content/sidebar" .}} </div> -<div class="hide" id="edit-content-form"> +<div class="gt-hidden" id="edit-content-form"> <div class="ui comment form"> <div class="ui top tabular menu"> <a class="active write item">{{$.locale.Tr "write"}}</a> @@ -224,7 +224,7 @@ {{template "repo/issue/view_content/reference_issue_dialog" .}} -<div class="hide" id="no-content"> +<div class="gt-hidden" id="no-content"> <span class="no-content">{{.locale.Tr "repo.issues.no_content"}}</span> </div> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 5bd5c8b48e..b81c3c7f03 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -77,8 +77,8 @@ <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> {{end}} </div> - <div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> + <div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> {{if .Attachments}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} @@ -449,8 +449,8 @@ <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> {{end}} </div> - <div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> + <div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> {{if .Attachments}} {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} @@ -576,8 +576,8 @@ <span class="no-content">{{$.locale.Tr "repo.issues.no_content"}}</span> {{end}} </div> - <div id="issuecomment-{{.ID}}-raw" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> + <div class="edit-content-zone gt-hidden" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> </div> {{$reactions := .Reactions.GroupByType}} {{if $reactions}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index dff6b5daaa..862d5d9a1b 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -456,7 +456,7 @@ {{if $.StillCanManualMerge}} <div class="ui divider"></div> - <div class="ui form manually-merged-fields" style="display: none"> + <div class="ui form manually-merged-fields gt-hidden"> <form action="{{.Link}}/merge" method="post"> {{.CsrfTokenHtml}} <div class="field"> diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index 5a7f6e867b..78deed9567 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,6 +1,6 @@ <div class="ui divider"></div> <div class="instruct-toggle"> {{$.locale.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div> -<div class="instruct-content gt-mt-3" style="display:none"> +<div class="instruct-content gt-mt-3 gt-hidden"> <div><h3 class="gt-di">{{$.locale.Tr "step1"}} </h3>{{$.locale.Tr "repo.pulls.merge_instruction_step1_desc"}}</div> <div class="ui secondary segment"> {{if eq $.Issue.PullRequest.Flow 0}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 8cd34ede6e..2b24825b5f 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -50,7 +50,7 @@ </div> <div class="ui assignees list"> - <span class="no-select item {{if or .OriginalReviews .PullReviewers}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_reviewers"}}</span> + <span class="no-select item {{if or .OriginalReviews .PullReviewers}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_reviewers"}}</span> <div class="selected"> {{range .PullReviewers}} <div class="item gt-mb-2"> @@ -202,7 +202,7 @@ </div> </div> <div class="ui select-milestone list"> - <span class="no-select item {{if .Issue.Milestone}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span> + <span class="no-select item {{if .Issue.Milestone}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_milestone"}}</span> <div class="selected"> {{if .Issue.Milestone}} <a class="item muted sidebar-item-link" href="{{.RepoLink}}/milestone/{{.Issue.Milestone.ID}}"> @@ -259,7 +259,7 @@ </div> </div> <div class="ui select-project list"> - <span class="no-select item {{if .Issue.ProjectID}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span> + <span class="no-select item {{if .Issue.ProjectID}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_projects"}}</span> <div class="selected"> {{if .Issue.ProjectID}} <a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}"> @@ -308,7 +308,7 @@ </div> </div> <div class="ui assignees list"> - <span class="no-select item {{if .Issue.Assignees}}hide{{end}}">{{.locale.Tr "repo.issues.new.no_assignees"}}</span> + <span class="no-select item {{if .Issue.Assignees}}gt-hidden{{end}}">{{.locale.Tr "repo.issues.new.no_assignees"}}</span> <div class="selected"> {{range .Issue.Assignees}} <div class="item"> @@ -423,7 +423,7 @@ <div class="ui divider"></div> <span class="text"><strong>{{.locale.Tr "repo.issues.due_date"}}</strong></span> <div class="ui form" id="deadline-loader"> - <div class="ui negative message" id="deadline-err-invalid-date" style="display: none;"> + <div class="ui negative message gt-hidden" id="deadline-err-invalid-date"> {{svg "octicon-x" 16 "close icon"}} {{.locale.Tr "repo.issues.due_date_invalid"}} </div> @@ -447,7 +447,7 @@ {{end}} {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} - <div {{if ne .Issue.DeadlineUnix 0}} style="display: none;"{{end}} id="deadlineForm"> + <div {{if ne .Issue.DeadlineUnix 0}} class="gt-hidden"{{end}} id="deadlineForm"> <form class="ui fluid action input issue-due-form" action="{{AppSubUrl}}/{{PathEscape .Repository.Owner.Name}}/{{PathEscape .Repository.Name}}/issues/{{.Issue.Index}}/deadline" method="post" id="update-issue-deadline-form"> {{$.CsrfTokenHtml}} <input required placeholder="{{.locale.Tr "repo.issues.due_date_form"}}" {{if gt .Issue.DeadlineUnix 0}}value="{{.Issue.DeadlineUnix.Format "2006-01-02"}}"{{end}} type="date" name="deadlineDate" id="deadlineDate"> diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 7ba6198b62..b43253f90b 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -8,14 +8,14 @@ <h1> <span id="issue-title">{{RenderIssueTitle $.Context .Issue.Title $.RepoLink $.Repository.ComposeMetas | RenderCodeBlock}}</span> <span class="index">#{{.Issue.Index}}</span> - <div id="edit-title-input" class="ui input gt-ml-4" style="display: none"> + <div id="edit-title-input" class="ui input gt-ml-4 gt-hidden"> <input value="{{.Issue.Title}}" maxlength="255" autocomplete="off"> </div> </h1> {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .Repository.IsArchived)}} <div class="edit-buttons"> - <button id="cancel-edit-title" class="ui basic button secondary in-edit" style="display: none">{{.locale.Tr "repo.issues.cancel"}}</button> - <button id="save-edit-title" class="ui primary button in-edit" style="display: none" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.locale.Tr "repo.issues.save"}}</button> + <button id="cancel-edit-title" class="ui basic button secondary in-edit gt-hidden">{{.locale.Tr "repo.issues.cancel"}}</button> + <button id="save-edit-title" class="ui primary button in-edit gt-hidden" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title" {{if .Issue.IsPull}}data-target-update-url="{{$.RepoLink}}/pull/{{.Issue.Index}}/target_branch"{{end}}>{{.locale.Tr "repo.issues.save"}}</button> </div> {{end}} </div> @@ -61,7 +61,7 @@ {{$.locale.Tr "repo.pulls.title_desc" .NumCommits $headHref $baseHref | Safe}} </span> {{end}} - <span id="pull-desc-edit" style="display: none"> + <span id="pull-desc-edit gt-hidden"> <div class="ui floating filter dropdown"> <div class="ui basic small button"> <span class="text">{{.locale.Tr "repo.pulls.compare_compare"}}: {{$.HeadTarget}}</span> |