Sha256: ef25aa455c1fb0c7c92824ed7d2efe2bfefa0d787176132ff90e1928c6069d0d

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

<% if sql_query.data.count > 0 %>
  <div class='row'>
    <div class="large-11">
      <h4>Results</h4>
      <p>
        <span class="radius success label">Total: <%= pluralize sql_query.data.count, 'record' %></span>
        <span class="radius info label">Time: <%= sql_query.data.time %> seconds</span>
        <span class="radius secondary label"><a href="#" data-reveal-id="explain_modal" id='explain_modal_link'>Explain</a></span>
        <span class="radius warning label"><%= link_to raw("#{fa_icon('file-excel-o')} Export"), sql_csv_path(sql: sql), method: :post %></span>
      </p>
      <hr>
      <%= render 'explain', sql_query: sql_query, sql: sql %>
      <div class='scrollable'>
        <table>
          <thead>
            <tr>
              <% sql_query.data.columns.each do |column| %>
                <th><%= titleize_column(column) %></th>
              <% end %>
            </tr>
          </thead>
          <tbody>
            <% sql_query.data.rows.each do |row| %>
              <tr>
                <% row.each do |item| %>
                  <td class='query_result'><%= item %></td>
                <% end %>
              </tr>
            <% end %>
          </tbody>
          <% if sql_query.data.count > 10 %>
            <tfoot>
              <tr>
                <% sql_query.data.columns.each do |column| %>
                  <th><%= titleize_column(column) %></th>
                <% end %>
              </tr>
            </tfoot>
          <% end %>
        </table>
      </div>
    </div>
  </div>

<% else %>
  <p>
    <span class="radius success label">SQL command successfully executed</span>
    <span class="radius info label">Time: <%= sql_query.data.time %> seconds</span>
    <span class="radius secondary label"><a href="#" data-reveal-id="explain_modal" id='explain_modal_link'>Explain</a></span>
  </p>
  <%= render 'explain', sql_query: sql_query, sql: sql %>
<% end %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_db-0.2.1 app/views/rails_db/sql/_results.html.erb
rails_db-0.2 app/views/rails_db/sql/_results.html.erb
rails_db-0.1 app/views/rails_db/sql/_results.html.erb