Sha256: f150f05d7f03474324630b7fb480fca48fde9a4abdbca1aab7ad0642ccac8b85
Contents?: true
Size: 1.54 KB
Versions: 11
Compression:
Stored size: 1.54 KB
Contents
<% blazer_title "Schema: #{@data_source.name}" %> <h1>Schema: <%= @data_source.name %></h1> <hr /> <div id="header"> <input id="search" type="text" placeholder="Start typing a table or column" style="width: 300px; display: inline-block;" class="search form-control" /> </div> <% @schema.each do |table| %> <table class="table schema-table"> <thead> <tr> <th colspan="2"> <%= table[:table] %> <% if table[:schema] != "public" %> <span class="text-muted" style="font-weight: normal;"><%= table[:schema] %></span> <% end %> </th> </tr> </thead> <tbody> <% table[:columns].each do |column| %> <tr> <td style="width: 60%;"><%= column[:name] %></td> <td class="text-muted"><%= column[:data_type] %></td> </tr> <% end %> </tbody> </table> <% end %> <script> $("#search").on("keyup", function() { var value = $(this).val().toLowerCase() $(".schema-table").filter(function() { // if found in table name, show entire table // if just found in rows, show row var found = $(this).find("thead").text().toLowerCase().indexOf(value) > -1 if (found) { $(this).find("tbody tr").toggle(true) } else { $(this).find("tbody tr").filter(function() { var found2 = $(this).text().toLowerCase().indexOf(value) > -1 $(this).toggle(found2) if (found2) { found = true } }) } $(this).toggle(found) }) }).focus() </script>
Version data entries
11 entries across 11 versions & 2 rubygems