mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add cutpoint table popover to gauges
This commit is contained in:
parent
151dbb2a88
commit
514bdad484
3 changed files with 54 additions and 3 deletions
|
|
@ -27,6 +27,6 @@ export function initializePopovers() {
|
|||
document
|
||||
.querySelectorAll('[data-bs-toggle="popover"]')
|
||||
.forEach((popoverElement) => {
|
||||
new Popover(popoverElement, { trigger: "hover focus" });
|
||||
new Popover(popoverElement, { trigger: "hover focus", html: true });
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ class GaugePresenter
|
|||
end
|
||||
end
|
||||
|
||||
def cutpoint_for(zone)
|
||||
case zone
|
||||
when :watch
|
||||
@zones.watch_zone.low_benchmark.round(2)
|
||||
when :growth
|
||||
@zones.growth_zone.low_benchmark.round(2)
|
||||
when :approval
|
||||
@zones.approval_zone.low_benchmark.round(2)
|
||||
when :ideal
|
||||
@zones.ideal_zone.low_benchmark.round(2)
|
||||
end
|
||||
end
|
||||
|
||||
attr_reader :score
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,8 +1,41 @@
|
|||
<div class="d-flex flex-column align-items-center position-relative">
|
||||
<% if ENV["SCORES"].present? && ENV["SCORES"].upcase == "SHOW" %>
|
||||
<p>Score is : <%= gauge.score %> </p>
|
||||
<p>
|
||||
Score is: <%= gauge.score %>
|
||||
<i
|
||||
class="fas fa-exclamation-circle px-2"
|
||||
style="transform:rotate(180deg);"
|
||||
data-bs-toggle="popover"
|
||||
data-bs-title="Cut Points"
|
||||
data-bs-content=
|
||||
"
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<p class="col mb-1">Watch</p>
|
||||
<p class="col mb-1 text-end"><%= gauge.cutpoint_for(:watch) %></p>
|
||||
</div>
|
||||
<div class="row bg-color-gray-3 align-items-center">
|
||||
<p class="col mb-1">Growth</p>
|
||||
<p class="col mb-1 text-end"><%= gauge.cutpoint_for(:growth) %></p>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<p class="col mb-1">Approval</p>
|
||||
<p class="col mb-1 text-end"><%= gauge.cutpoint_for(:approval) %></p>
|
||||
</div>
|
||||
<div class="row bg-color-gray-3 align-items-center">
|
||||
<p class="col mb-1">Ideal</p>
|
||||
<p class="col mb-1 text-end"><%= gauge.cutpoint_for(:ideal) %></p>
|
||||
</div>
|
||||
</div>
|
||||
"
|
||||
></i>
|
||||
</p>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="d-flex align-items-end">
|
||||
<% if gauge_class == "gauge-graph-lg" %>
|
||||
<h3 class="px-4 mb-n1">1</h3>
|
||||
<% end %>
|
||||
<svg
|
||||
viewBox="<%= viewbox.x %> <%= viewbox.y %> <%= viewbox.width %> <%= viewbox.height %>"
|
||||
class="<%= gauge_class %>"
|
||||
|
|
@ -55,5 +88,10 @@
|
|||
/>
|
||||
<% end %>
|
||||
</svg>
|
||||
|
||||
<% if gauge_class == "gauge-graph-lg" %>
|
||||
<h3 class="px-4">5</h3>
|
||||
<% end %>
|
||||
</div>
|
||||
<span class="gauge-title <%= font_class %> fill-black"><%= gauge.title %></span>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue