Last active
January 5, 2019 14:08
-
-
Save bchewy/607a21c3b2598482b60ee4fdf559a596 to your computer and use it in GitHub Desktop.
RoR Developer's Debug Menu for JSON data.
This file contains hidden or 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
| <!--Developer's debug menu at bottom of index page--> | |
| <div id="accordion"> | |
| <div class="card"> | |
| <div class="card-header" id="headingOne"> | |
| <h5 class="mb-0"> | |
| <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> | |
| Developer Debug Menu (click to toggle) | |
| </button> | |
| </h5> | |
| </div> | |
| <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordion"> | |
| <div class="card-body"> | |
| <div class="container"> | |
| <h4>Developers debug menu</h4> | |
| <h6>RAW JSON</h6> | |
| <div class="jumbotron"> | |
| <%= @json_object.inspect %> | |
| </div> | |
| <h6>JSON (Data)</h6> | |
| <table class="table table-bordered"> | |
| <thead> | |
| <tr> | |
| <th>EventID</th> | |
| <th>Event Name</th> | |
| <th>Admin Contact</th> | |
| <th>No of People</th> | |
| <th>No of Teams</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <!-- @json_object is the object holding the json data. --> | |
| <% if @json_object.nil? %> | |
| <span>the json return is empty</span> | |
| <% else %> | |
| <% @json_object.each do |key, value| %> | |
| <tr> | |
| <!-- Add a new column for your JSON key --> | |
| <td><%= value['eventID'] %></td> | |
| <td><%= value['eventName'] %></td> | |
| <td><%= value['eventAdminEmail'] %></td> | |
| <td><%= value['eventNoOfPpl'] %></td> | |
| <td><%= value['eventNoTeams'] %></td> | |
| </tr> | |
| <% end %> | |
| <% end %> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment