petities/petitions.eu

View on GitHub
app/views/petitions/_signatures.html.slim

Summary

Maintainability
Test Coverage
div.page
  section
    h2.petition-section-title= t('show.signatures.title')
    - if user_signed_in? && current_user.has_role?(:admin, @petition) && @petition.get_count > 0
      h3.whitespace= t('signatures.petitioner_instructions')

    div.petition-signatures-container data={page: 1, behavior: 'load-remote', url: latest_petition_signatures_url(@petition)}
      div.clearfix

    div.navigation-bar
      - if @petition.get_count == 0
        div.whitespace = t('edit.petition.no_signatures_yet')
      - elsif @petition.get_count > 12
        a.navigation-loadmore.button href='javascript:void(0);' data={behavior: 'load-more-signatures'} 
          = t('show.signatures.more')

      div.clearfix

      = link_to t('show.signatures.to_all'), petition_signatures_path(@petition), class: 'navigation-toall'

      - if policy(@petition).export? && @petition.get_count > 2
        div.whitespace
          = link_to t('petition.pdf'), petition_export_path(@petition, :pdf), target: :blank, class: 'button'

          = link_to t('petition.csv'), petition_export_path(@petition, :csv), target: :blank, class: 'button button-aside'