Add <symbol>
for a selected seat
When rendering the list of Seat
records for a Floor
, render <use>
elements referring to the new #seat-icon-selected
version of a
seat based on whether or not they’re in the visitor’s Cart
.
Desktop
Collapse app/views/seats/index.html.erb
Expand app/views/seats/index.html.erb
app/views/seats/index.html.erb
diff --git a/app/views/seats/index.html.erb b/app/views/seats/index.html.erb
index 50bbf62..4c72c60 100644
--- a/app/views/seats/index.html.erb
+++ b/app/views/seats/index.html.erb
@@ -29,6 +29,15 @@
<circle fill="#37b24d" r="12" cx="12" cy="12"></circle>
<circle fill="#ffffff" r="6" cx="12" cy="12"></circle>
</symbol>
+
+ <symbol
+ id="seat-icon-selected"
+ width="24"
+ height="24"
+ viewbox="0 0 24 24"
+ >
+ <circle fill="#37b24d" r="12" cx="12" cy="12"></circle>
+ </symbol>
</svg>
<% sections.each do |section| %>
@@ -39,7 +48,11 @@
aria-label="<%= seat.row_number %>"
>
<use
- xlink:href="#seat-icon-unselected"
+ <% if Current.cart.include?(seat) %>
+ xlink:href="#seat-icon-selected"
+ <% else %>
+ xlink:href="#seat-icon-unselected"
+ <% end %>
width="12px"
height="12px"
x="<%= seat.x %>"