catarse/dbhero

View on GitHub
app/views/dbhero/dataclips/_clip_table.html.slim

Summary

Maintainability
Test Coverage
- show_public_link = defined?(show_public_link) ? show_public_link : false
- if Dbhero.max_rows_limit >= @dataclip.q_result.rows.size
  .section
    .row
      .col.s6.style-text-field
        - if show_public_link
          .input-field
            i.tiny.mdi-social-share.prefix
            input#icon_prefix.validate type="text" value=dataclip_url(@dataclip)
            label for="icon_prefix"
              strong PUBLIC URL
        - else
          p style="margin-top: 40px; margin-bottom: 0;"
            | total rows returned 
            strong= @dataclip.total_rows
      .col.s6.right-align style="margin-top: 25px;"
        a class='dropdown-button btn' href='#' data-activates='export-drop' Export

        ul id='export-drop' class='dropdown-content'
          li
            = link_to 'csv', dataclip_path(@dataclip, format: 'csv')
          li
            = link_to 'google drive', dataclip_path(@dataclip, export_gdrive: true)

      .col.s12 style="overflow: auto;"
        table#clip_table.cell-border.striped data-page-length='300'
          thead.grey.lighten-2
            tr
              - @dataclip.q_result.columns.each do |column|
                th= column
          tbody
            - @dataclip.q_result.rows.each do |row|
              tr
                - row.each do |value|
                  td style="min-width: 200px;"= value
- else
  .section
    .row
      .col.s12.center-align
        h2.flow-text this clip is too large, please download the csv:
      .col.s12.center-align
        = link_to "download csv", dataclip_url(@dataclip, format: :csv), class: "btn"