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

Version Path
blazer-2.1.0 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.9 app/views/blazer/queries/schema.html.erb
blazer-2.0.2 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.8 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.7 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.6 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.5 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.4 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.3 app/views/blazer/queries/schema.html.erb
sql-jarvis-2.0.2 app/views/blazer/queries/schema.html.erb
blazer-2.0.1 app/views/blazer/queries/schema.html.erb