Skip to content

Commit 9946353

Browse files
Remove fomantic button module (#30475)
CSS-only module. Button colors are reduced to this: <img width="639" alt="Screenshot 2024-04-14 at 15 36 07" src="https://github.com/go-gitea/gitea/assets/115237/882d6c02-d1de-44f2-b707-db02a9f5070d"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 4c6e2da commit 9946353

21 files changed

+253
-2991
lines changed

templates/admin/notice.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</div>
5050
</div>
5151
</div>
52-
<button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}">
52+
<button class="ui small button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}">
5353
<span class="text">{{ctx.Locale.Tr "admin.notices.delete_selected"}}</span>
5454
</button>
5555
</th>

templates/admin/repo/unadopted.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<input type="hidden" name="action" value="delete">
5555
<input type="hidden" name="q" value="{{$.Keyword}}">
5656
<input type="hidden" name="page" value="{{$.CurrentPage}}">
57-
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
57+
{{template "base/modal_actions_confirm"}}
5858
</form>
5959
</div>
6060
</div>

templates/base/modal_actions_confirm.tmpl

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{/*
22
Two buttons (negative, positive):
33
* ModalButtonTypes: "yes" (default) or "confirm"
4-
* ModalButtonColors: "primary" (default) / "blue" / "yellow"
54
* ModalButtonCancelText
65
* ModalButtonOkText
76

@@ -22,14 +21,7 @@ The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal
2221
{{end}}
2322
{{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}}
2423
{{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}}
25-
26-
{{$stylePositive := "primary"}}
27-
{{if eq .ModalButtonColors "blue"}}
28-
{{$stylePositive = "blue"}}
29-
{{else if eq .ModalButtonColors "yellow"}}
30-
{{$stylePositive = "yellow"}}
31-
{{end}}
3224
<button class="ui cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button>
33-
<button class="ui {{$stylePositive}} ok button">{{svg "octicon-check"}} {{$textPositive}}</button>
25+
<button class="ui primary ok button">{{svg "octicon-check"}} {{$textPositive}}</button>
3426
{{end}}
3527
</div>

templates/devtest/fomantic-modal.tmpl

+9-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{{template "base/head" .}}
22
<div class="page-content devtest ui container">
33
{{template "base/alert" .}}
4+
<div class="modal-buttons flex-text-block tw-flex-wrap"></div>
5+
<script type="module">
6+
for (const el of $('.ui.modal')) {
7+
const $btn = $('<button class="ui button">').text(`${el.id}`).on('click', () => {
8+
$(el).modal({onApprove() {alert('confirmed')}}).modal('show');
9+
});
10+
$('.modal-buttons').append($btn);
11+
}
12+
</script>
413

514
<div id="test-modal-form-1" class="ui mini modal">
615
<div class="header">Form dialog (layout 1)</div>
@@ -54,33 +63,11 @@
5463
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
5564
</div>
5665

57-
<div class="ui g-modal-confirm modal" id="test-modal-blue">
58-
<div class="header">Blue dialog</div>
59-
<div class="content">hello, this is the modal dialog content</div>
60-
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "blue")}}
61-
</div>
62-
63-
<div class="ui g-modal-confirm modal" id="test-modal-yellow">
64-
<div class="header">yellow dialog</div>
65-
<div class="content">hello, this is the modal dialog content</div>
66-
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
67-
</div>
68-
6966
<div class="ui g-modal-confirm modal" id="test-modal-danger">
7067
{{svg "octicon-x" 16 "inside close"}}
7168
<div class="header">dangerous action dialog</div>
7269
<div class="content">hello, this is the modal dialog content, this is a dangerous operation</div>
7370
{{template "base/modal_actions_confirm" (dict "ModalButtonDangerText" "I know and must do this is dangerous operation")}}
7471
</div>
75-
76-
<div class="modal-buttons flex-text-block tw-flex-wrap"></div>
77-
<script type="module">
78-
for (const el of $('.ui.modal')) {
79-
const $btn = $('<button>').text(`${el.id}`).on('click', () => {
80-
$(el).modal({onApprove() {alert('confirmed')}}).modal('show');
81-
});
82-
$('.modal-buttons').append($btn);
83-
}
84-
</script>
8572
</div>
8673
{{template "base/footer" .}}

templates/devtest/gitea-ui.tmpl

+3-39
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,13 @@
2929
<button class="ui basic button">Basic Unclassed</button>
3030
<button class="ui primary button">Primary</button>
3131
<button class="ui basic primary button">Basic Primary</button>
32-
<button class="ui negative button">Negative</button>
33-
<button class="ui basic negative button">Basic Negative</button>
34-
<button class="ui positive button">Positive</button>
35-
<button class="ui basic positive button">Basic Positive</button>
3632
</li>
3733
<li class="sample-group">
3834
<h2>Recommended colors:</h2>
3935
<button class="ui red button">Red</button>
4036
<button class="ui basic red button">Basic Red</button>
41-
<button class="ui primary button">Green</button>
42-
<button class="ui basic primary button">Basic Green</button>
43-
<button class="ui blue button">Blue</button>
44-
<button class="ui basic blue button">Basic Blue</button>
45-
<button class="ui orange button">Orange</button>
46-
<button class="ui basic orange button">Basic Orange</button>
47-
<button class="ui yellow button">Yellow</button>
48-
<button class="ui basic yellow button">Basic Yellow</button>
49-
</li>
50-
<li class="sample-group">
51-
<h2>Supported but not recommended:</h2>
52-
<p>Do not use if there is no strong requirement. Do not use grey/black buttons, they don't work well with dark theme.</p>
53-
<button class="ui secondary button">Secondary</button>
54-
<button class="ui basic secondary button">Basic Secondary</button>
55-
<button class="ui olive button">Olive</button>
56-
<button class="ui basic olive button">Basic Olive</button>
57-
<button class="ui teal button">Teal</button>
58-
<button class="ui basic teal button">Basic Teal</button>
59-
<button class="ui violet button">Violet</button>
60-
<button class="ui basic violet button">Basic Violet</button>
61-
<button class="ui purple button">Purple</button>
62-
<button class="ui basic purple button">Basic Purple</button>
63-
<button class="ui pink button">Pink</button>
64-
<button class="ui basic pink button">Basic Pink</button>
65-
<button class="ui brown button">Brown</button>
66-
<button class="ui basic brown button">Basic Brown</button>
37+
<button class="ui green button">Green</button>
38+
<button class="ui basic green button">Basic Green</button>
6739
</li>
6840
<li class="sample-group">
6941
<h2>Inline / Plain:</h2>
@@ -198,7 +170,7 @@
198170
<button class="ui basic button">labeled button</button>
199171
<a class="ui basic label">123</a>
200172
</div>
201-
<button class="ui yellow button">{{svg "octicon-x" 16}} button with very very very very very very very very long text</button>
173+
<button class="ui button">{{svg "octicon-x" 16}} button with very very very very very very very very long text</button>
202174
</div>
203175

204176
<h2>Input with SVG</h2>
@@ -271,10 +243,6 @@
271243
<span class="text">button dropdown</span>
272244
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
273245
</div>
274-
<div class="ui dropdown large button">
275-
<span class="text">large dropdown</span>
276-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
277-
</div>
278246
</div>
279247

280248
<div>
@@ -290,10 +258,6 @@
290258
<span class="text">button compact</span>
291259
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
292260
</div>
293-
<div class="ui dropdown large compact button">
294-
<span class="text">large compact</span>
295-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
296-
</div>
297261
</div>
298262

299263
<div>

templates/org/team/sidebar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</div>
8080
{{if .IsOrganizationOwner}}
8181
<div class="ui bottom attached segment">
82-
<a class="ui teal small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}}</a>
82+
<a class="ui small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}}</a>
8383
</div>
8484
{{end}}
8585
</div>

templates/repo/code/recently_pushed_new_branches.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{$branchLink := HTMLFormat `<a href="%s/src/branch/%s">%s</a>` $.RepoLink (PathEscapeSegments .Name) .Name}}
66
{{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}}
77
</div>
8-
<a role="button" class="ui compact positive button tw-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo .Name}}">
8+
<a role="button" class="ui compact green button tw-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo .Name}}">
99
{{ctx.Locale.Tr "repo.pulls.compare_changes"}}
1010
</a>
1111
</div>

templates/repo/diff/compare.tmpl

+8-16
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,15 @@
184184
{{end}}
185185
{{else if and .PageIsComparePull (gt .CommitCount 0)}}
186186
{{if .HasPullRequest}}
187-
<div class="ui segment grid title">
188-
<div class="twelve wide column issue-title">
189-
{{ctx.Locale.Tr "repo.pulls.has_pull_request" (print $.RepoLink "/pulls/" .PullRequest.Issue.Index) $.RepoRelPath .PullRequest.Index}}
190-
<h1>
191-
<span id="issue-title">{{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx)}}</span>
192-
<span class="index">#{{.PullRequest.Issue.Index}}</span>
193-
</h1>
194-
</div>
195-
<div class="four wide column middle aligned text right">
196-
{{- if .PullRequest.HasMerged -}}
197-
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button purple show-form">{{svg "octicon-git-merge" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
198-
{{else if .Issue.IsClosed}}
199-
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button red show-form">{{svg "octicon-issue-closed" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
200-
{{else}}
201-
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button primary show-form">{{svg "octicon-git-pull-request" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
202-
{{end}}
187+
<div class="ui segment flex-text-block tw-gap-4">
188+
{{template "shared/issueicon" .}}
189+
<div class="issue-title tw-break-anywhere">
190+
{{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}}
191+
<span class="index">#{{.PullRequest.Issue.Index}}</span>
203192
</div>
193+
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui compact button primary">
194+
{{ctx.Locale.Tr "repo.pulls.view"}}
195+
</a>
204196
</div>
205197
{{else}}
206198
{{if and $.IsSigned (not .Repository.IsArchived)}}

templates/repo/issue/view_content/sidebar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@
572572
</form>
573573
{{end}}
574574

575-
<button class="tw-mt-1 fluid ui show-modal button {{if .Issue.IsLocked}} negative {{end}}" data-modal="#lock">
575+
<button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock">
576576
{{if .Issue.IsLocked}}
577577
{{svg "octicon-key"}}
578578
{{ctx.Locale.Tr "repo.issues.unlock"}}

templates/repo/settings/lfs.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</p>
4545
<form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post">
4646
{{$.CsrfTokenHtml}}
47-
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
47+
{{template "base/modal_actions_confirm"}}
4848
</form>
4949
</div>
5050
</div>

templates/repo/settings/lfs_pointers.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</a>
3838
</td>
3939
<td>
40-
<a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui brown button tw-font-mono">
40+
<a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui button tw-font-mono">
4141
{{ShortSha .Oid}}
4242
</a>
4343
</td>

templates/repo/settings/webhook/history.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="ui right">
77
<!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button -->
88
<span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}">
9-
<button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
9+
<button class="ui tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
1010
<span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
1111
</button>
1212
</span>

templates/user/settings/applications.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<div class="content">
110110
<p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p>
111111
</div>
112-
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
112+
{{template "base/modal_actions_confirm"}}
113113
</div>
114114

115115
{{template "user/settings/layout_footer" .}}

web_src/css/base.css

-8
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,6 @@ input:-webkit-autofill:active,
663663
font-size: 0.75em;
664664
}
665665

666-
.ui.form .ui.button {
667-
font-weight: var(--font-weight-normal);
668-
}
669-
670666
/* popover box shadows */
671667
.ui.dropdown .menu,
672668
.ui.upward.dropdown > .menu,
@@ -1347,10 +1343,6 @@ table th[data-sortt-desc] .svg {
13471343
vertical-align: middle;
13481344
}
13491345

1350-
.ui.ui.button {
1351-
justify-content: center;
1352-
}
1353-
13541346
.ui.dropdown .ui.label .svg {
13551347
vertical-align: middle;
13561348
}

web_src/css/helpers.css

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ only use:
5252
*/
5353
.tw-hidden.tw-hidden { display: none !important; }
5454

55+
/* proposed class from https://github.com/tailwindlabs/tailwindcss/pull/12128 */
56+
.tw-break-anywhere { overflow-wrap: anywhere !important; }
57+
5558
@media (max-width: 767.98px) {
5659
/* double selector so it wins over .tw-flex (old .gt-df) etc */
5760
.not-mobile.not-mobile {

0 commit comments

Comments
 (0)