Skip to content

Commit bed0e4b

Browse files
authored
Merge pull request #2009 from nqst/clickable-checkbox-labels
Make toggle switch labels clickable
2 parents 0e9350d + 5846ded commit bed0e4b

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

app/assets/stylesheets/utilities.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
pointer-events: none;
117117
}
118118

119+
.cursor-pointer { cursor: pointer; }
120+
119121
/* Padding */
120122
.pad { padding: var(--block-space) var(--inline-space); }
121123
.pad-double { padding: var(--block-space-double) var(--inline-space-double); }

app/views/boards/edit/_publication.html.erb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
<% if board.published? %>
88
<div class="border-radius pad fill-selected">
9-
<div class="flex-inline center justify-between gap">
10-
<span class="txt-large"><%= icon_tag "lock" %></span>
11-
<label class="switch flex align-center justify-between">
12-
<%= form_with url: board_publication_path(board), method: :delete, data: { controller: "form" } do |form| %>
9+
<%= form_with url: board_publication_path(board), method: :delete, class: "flex-inline center justify-between gap", data: { controller: "form" } do |form| %>
10+
<label class="flex gap cursor-pointer">
11+
<span class="txt-large"><%= icon_tag "lock" %></span>
12+
<span class="switch flex align-center justify-between">
1313
<%= form.check_box :published, class: "switch__input", checked: true, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board) %>
1414
<span class="switch__btn round"></span>
15-
<span class="for-screen-reader">Turn off the public link</span>
16-
<% end %>
15+
</span>
16+
<span class="for-screen-reader">Turn off the public link</span>
1717
</label>
18-
<span class="txt-large"><%= icon_tag "world" %></span>
19-
</div>
18+
<span class="txt-large" aria-hidden="true"><%= icon_tag "world" %></span>
19+
<% end %>
2020

2121
<div class="flex align-center gap-half margin-block">
2222
<%= text_field_tag :publication_url, published_board_url(board), readonly: true, class: "full-width input fill-white" %>
@@ -40,17 +40,17 @@
4040
</div>
4141
<% else %>
4242
<div class="border-radius pad fill-shade">
43-
<div class="flex-inline center justify-between gap">
44-
<span class="txt-large"><%= icon_tag "lock" %></span>
45-
<label class="switch flex align-center justify-between">
46-
<%= form_with url: board_publication_path(board), method: :post, data: { controller: "form" } do |form| %>
43+
<%= form_with url: board_publication_path(board), method: :post, class: "flex-inline center justify-between gap", data: { controller: "form" } do |form| %>
44+
<span class="txt-large" aria-hidden="true"><%= icon_tag "lock" %></span>
45+
<label class="flex gap cursor-pointer">
46+
<span class="switch flex align-center justify-between">
4747
<%= form.check_box :published, class: "switch__input", checked: false, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board) %>
4848
<span class="switch__btn round"></span>
49-
<span class="for-screen-reader">Turn on the public link</span>
50-
<% end %>
49+
</span>
50+
<span class="txt-large"><%= icon_tag "world" %></span>
51+
<span class="for-screen-reader">Turn on the public link</span>
5152
</label>
52-
<span class="txt-large"><%= icon_tag "world" %></span>
53-
</div>
53+
<% end %>
5454
</div>
5555
<% end %>
5656
<% end %>

app/views/webhooks/edit.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="flex flex-column gap-half">
1616
<%= form.label :actions do %>
1717
<strong>Events</strong><br>
18-
<p class="margin-none txt-x-small txt-subtle">Trigger a call to the Payload URL when these things occur:</p>
18+
<p class="margin-none txt-x-small txt-subtle">Trigger a call to the Payload URL when:</p>
1919
<% end %>
2020
<%= render "webhooks/form/actions", form: form %>
2121
</div>

app/views/webhooks/form/_actions.html.erb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
webhook_action_options,
55
:first,
66
:last do |item| %>
7-
<li class="list-style-none margin-none flex align-center gap">
8-
<label class="switch toggler__visible-when-off flex-item-no-shrink txt-x-small">
9-
<%= item.check_box(class: "switch__input") %>
10-
<span class="switch__btn round"></span>
11-
<span class="for-screen-reader"><%= item.text %></span>
7+
<li class="list-style-none margin-none">
8+
<label class="toggler__visible-when-off flex align-center gap cursor-pointer">
9+
<span class="switch txt-x-small flex-item-no-shrink">
10+
<%= item.check_box(class: "switch__input") %>
11+
<span class="switch__btn round"></span>
12+
</span>
13+
<span class="min-width"><%= item.text %></span>
1214
</label>
13-
<span><%= item.text %></span>
1415
</li>
1516
<% end %>
1617
</ul>

app/views/webhooks/new.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div class="flex flex-column gap-half">
3232
<%= form.label :actions do %>
3333
<strong>Events</strong><br>
34-
<p class="margin-none txt-x-small txt-subtle">Trigger a call to the Payload URL when these things occur:</p>
34+
<p class="margin-none txt-x-small txt-subtle">Trigger a call to the Payload URL when:</p>
3535
<% end %>
3636
<%= render "webhooks/form/actions", form: form %>
3737
</div>

0 commit comments

Comments
 (0)