Sha256: dfaec7e15ba5a1f88195344aa9efaf6075a300cea8a856dfe514af027bf2e970

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

<% if sql_query.data.count > 0 %>
  <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-text-o')} Export to CSV"), sql_csv_path(sql: sql, format: 'csv'), method: :post %></span>
      <span class="radius warning label"><%= link_to raw("#{fa_icon('file-excel-o')} Export to Excel"), sql_xls_path(sql: sql, format: 'xls'), 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>
<% 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

4 entries across 4 versions & 1 rubygems

Version Path
rails_db-1.0 app/views/rails_db/sql/_results.html.erb
rails_db-0.9.9 app/views/rails_db/sql/_results.html.erb
rails_db-0.9 app/views/rails_db/sql/_results.html.erb
rails_db-0.8 app/views/rails_db/sql/_results.html.erb