Skip to content

Fix "delete" modal dialog for issue/PR #27015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions templates/devtest/fomantic-modal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
</form>
</div>

<div id="test-modal-form-4" class="ui mini modal">
<div class="header">Form dialog (layout 4)</div>
<div class="content">
<div class="ui input gt-w-100"><input name="user_input"></div>
</div>
<form method="post">
{{template "base/modal_actions_confirm" (dict "locale" $.locale "ModalButtonTypes" "confirm")}}
</form>
</div>

<div class="ui g-modal-confirm modal" id="test-modal-default">
<div class="header">{{svg "octicon-file"}} Default dialog <span>title</span></div>
<div class="content">
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@
</form>
</div>
</div>
<button class="gt-mt-2 fluid ui show-modal button" data-modal="#delete">
<button class="gt-mt-2 fluid ui show-modal button" data-modal="#sidebar-delete-issue">
{{svg "octicon-trash"}}
{{.locale.Tr "repo.issues.delete"}}
</button>
<div class="ui g-modal-confirm modal" id="delete">
<div class="ui g-modal-confirm modal" id="sidebar-delete-issue">
<div class="header">
{{if .Issue.IsPull}}
{{.locale.Tr "repo.pulls.delete.title"}}
Expand Down
4 changes: 3 additions & 1 deletion web_src/css/modules/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ However, Gitea uses the following layouts:
* <div .modal><div .content><div .actions/></div></div>
* <div .modal><form><div .content/><div .actions/></form></div>
* <div .modal><div .content><form><div .actions/></form></div></div>
* <div .modal><div .content></div><form><div .actions/></form></div>
* ...
These inconsistent layouts should be refactored to simple ones.
*/
Expand All @@ -47,7 +48,8 @@ These inconsistent layouts should be refactored to simple ones.
}

.ui.modal > .actions,
.ui.modal .content + .actions {
.ui.modal .content + .actions,
.ui.modal .content + form > .actions {
Copy link
Member

@silverwind silverwind Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these fomantic's selectors or our own? If our own, maybe we can simplify.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

@silverwind silverwind Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, well it could be simplified to .content .actions or even .ui.modal .actions, but leaving that up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not feel it is safe to use content or actions without a strict rule. It would cause pollution because many one-word classes (including "content") have been used everywhere.

Copy link
Contributor Author

@wxiaoguang wxiaoguang Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another (strong) reason is that the content itself has paddings, so the actions inside it shouldn't have padding again. But the actions following it should still have the padding. Line 60 comment: /* if the "actions" is in the "content", some paddings are already added by the "content" */

Declaring these style explicitly is good for maintainability.

background: var(--color-secondary-bg);
border-color: var(--color-secondary);
padding: 1rem;
Expand Down