Skip to content

Commit 0b416f2

Browse files
committed
improve modal buttons
1 parent 4c0ea70 commit 0b416f2

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

templates/base/modal_actions_confirm.tmpl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
Template Attributes:
33
* locale
44

5-
Two buttons:
6-
5+
Two buttons (negative, positive):
76
* ModalButtonTypes: "yes" (default) or "confirm"
8-
* ModalButtonColors: "green-red" (default) / "blue" / "yellow"
7+
* ModalButtonColors: "green" (default) / "blue" / "yellow"
98
* ModalButtonCancelText
109
* ModalButtonOkText
1110

12-
Single button:
13-
11+
Single danger button (GitHub-like):
1412
* ModalButtonDangerText "This action will destroy your data"
1513

1614
The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal internally
@@ -28,16 +26,13 @@ The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal
2826
{{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}}
2927
{{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}}
3028

31-
{{$styleNegative := "red"}}
3229
{{$stylePositive := "green"}}
3330
{{if eq .ModalButtonColors "blue"}}
34-
{{$styleNegative = "secondary basic"}}
3531
{{$stylePositive = "blue"}}
3632
{{else if eq .ModalButtonColors "yellow"}}
37-
{{$styleNegative = "secondary basic"}}
3833
{{$stylePositive = "yellow"}}
3934
{{end}}
40-
<button class="ui {{$styleNegative}} cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button>
35+
<button class="ui secondary basic cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button>
4136
<button class="ui {{$stylePositive}} ok button">{{svg "octicon-check"}} {{$textPositive}}</button>
4237
{{end}}
4338
</div>

templates/devtest/fomantic-modal.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<script type="module">
3939
for (const el of $('.ui.modal')) {
4040
const $btn = $('<button>').text(`Show ${el.id}`).on('click', () => {
41-
$(el).modal('show');
41+
$(el).modal({onApprove() {alert('confirmed');}}).modal('show');
4242
});
4343
$('.modal-buttons').append($btn);
4444
}

templates/status/500.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{template "base/head" .}}
2-
<div role="main" aria-label="{{.Title}}" class="page-content gt-w-screen status-page-500">
2+
<div role="main" aria-label="{{.Title}}" class="page-content status-page-500">
33
<p class="gt-mt-5 center"><img src="{{AssetUrlPrefix}}/img/500.png" alt="Internal Server Error"></p>
44
<div class="ui divider"></div>
55

web_src/css/modules/modal.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
.ui.modal .actions > .ui.button.danger {
5252
display: block;
53-
width: 80%;
53+
width: 100%;
5454
margin: 0 auto;
5555
text-align: center;
5656
}

0 commit comments

Comments
 (0)