Make board publication switch icons clickable

This commit is contained in:
Alexander Zaytsev
2025-12-08 16:22:43 +01:00
parent a9432ec6b4
commit a992be8143
+12 -6
View File
@@ -4,18 +4,22 @@
<div>Turn on the Public link to share this board with anyone in the world. They wont need to log in and they wont be able to see anything else in Fizzy.</div>
</header>
<% publication_switch_id = "board-#{board.id}-publication-switch" %>
<% if board.published? %>
<div class="border-radius pad fill-selected">
<div class="flex-inline center justify-between gap">
<span class="txt-large"><%= icon_tag "lock" %></span>
<label class="txt-large" for="<%= publication_switch_id %>">
<%= icon_tag "lock" %>
</label>
<label class="switch flex align-center justify-between">
<%= form_with url: board_publication_path(board), method: :delete, data: { controller: "form" } do |form| %>
<%= form.check_box :published, class: "switch__input", checked: true, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board) %>
<%= form.check_box :published, class: "switch__input", checked: true, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board), id: publication_switch_id %>
<span class="switch__btn round"></span>
<span class="for-screen-reader">Turn off the public link</span>
<% end %>
</label>
<span class="txt-large"><%= icon_tag "world" %></span>
<span class="txt-large" aria-hidden="true"><%= icon_tag "world" %></span>
</div>
<div class="flex align-center gap-half margin-block">
@@ -41,15 +45,17 @@
<% else %>
<div class="border-radius pad fill-shade">
<div class="flex-inline center justify-between gap">
<span class="txt-large"><%= icon_tag "lock" %></span>
<span class="txt-large" aria-hidden="true"><%= icon_tag "lock" %></span>
<label class="switch flex align-center justify-between">
<%= form_with url: board_publication_path(board), method: :post, data: { controller: "form" } do |form| %>
<%= form.check_box :published, class: "switch__input", checked: false, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board) %>
<%= form.check_box :published, class: "switch__input", checked: false, data: { action: "change->form#submit" }, disabled: !Current.user.can_administer_board?(@board), id: publication_switch_id %>
<span class="switch__btn round"></span>
<span class="for-screen-reader">Turn on the public link</span>
<% end %>
</label>
<span class="txt-large"><%= icon_tag "world" %></span>
<label class="txt-large" for="<%= publication_switch_id %>">
<%= icon_tag "world" %>
</label>
</div>
</div>
<% end %>