forked from seanpdoyle/select-your-own-seat
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render Seats for a Venue with SVG elements
For comparison [see this commit][commit] There's nothing exciting to show off in this commit, but that's also the point. Superglue is really a multi-page application. We include all the content together on the same `index.json.props` just as we would when we're working with just a single `index.html.erb`. Then we modify the JSX markup to account for the new incoming props. Of note! The very next commit is a cherry-pick of the test on the original select-your-own-seat branch. There were no additional changes to make the tests work! [commit]: seanpdoyle@216b59c
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
class SeatsController < ApplicationController | ||
def index | ||
venue = Venue.find_by!(slug: params[:venue_id]) | ||
floor = venue.floors.find_by!(slug: params[:floor_id]) | ||
sections = floor.sections.includes(:seats) | ||
|
||
render(locals: { | ||
venue: venue, | ||
floor: floor, | ||
sections: sections, | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
json.venue_name venue.name | ||
|
||
json.sections do | ||
json.array! sections do |section| | ||
json.seats do | ||
json.array! section.seats do |seat| | ||
json.x seat.x | ||
json.y seat.y | ||
end | ||
end | ||
end | ||
end |