Skip to content

Commit

Permalink
CSS class for busy-turbo-frame loading indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
cavis committed Aug 2, 2023
1 parent e4d1f02 commit 63fd937
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
20 changes: 20 additions & 0 deletions app/assets/stylesheets/shared/busy.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.prx-show-busy {
display: none !important;
}
.prx-visible-busy {
visibility: hidden !important;
}
turbo-frame[busy] {
.prx-show-busy {
display: initial !important;
}
.prx-hide-busy {
display: none !important;
}
.prx-visible-busy {
visibility: initial !important;
}
.prx-invisible-busy {
visibility: hidden !important;
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/shared/shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// global layout
@import "mixins";
@import "reboot";
@import "busy";
@import "button";
@import "card";
@import "episode-card";
Expand Down
18 changes: 13 additions & 5 deletions app/views/podcast_planner/_form_draft.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@
<%= t(".title.calendar") %>
</h5>

<button type="submit" class="btn btn-primary d-inline" disabled data-planner-target="button" data-turbo="false">
<%= t(".label.create") %>
<span data-planner-target="count"><%= @planner.dates&.count.to_i %></span>
<span data-planner-target="label" data-singular="<%= t(".label.draft") %>" data-plural="<%= t(".label.draft").pluralize %>">
<%= t(".label.draft").pluralize(@planner.dates&.count.to_i) %>
<button type="submit" class="btn btn-primary position-relative" disabled data-planner-target="button" data-turbo="false">
<span class="prx-invisible-busy">
<%= t(".label.create") %>
<span data-planner-target="count"><%= @planner.dates&.count.to_i %></span>
<span data-planner-target="label" data-singular="<%= t(".label.draft") %>" data-plural="<%= t(".label.draft").pluralize %>">
<%= t(".label.draft").pluralize(@planner.dates&.count.to_i) %>
</span>
</span>

<div class="prx-show-busy position-absolute top-0 start-0 w-100 h-100">
<div class="d-flex align-items-center justify-content-center h-100">
<span class="spinner-border" role="status" aria-hidden="true"></span>
</div>
</div>
</button>
</div>

Expand Down

0 comments on commit 63fd937

Please sign in to comment.