diffux/diffux

View on GitHub
app/views/snapshots/_review_list.html.haml

Summary

Maintainability
Test Coverage
:ruby
  index             = @review_list.index(@snapshot)
  previous_snapshot = @review_list[index - 1] if index > 0
  next_snapshot     = @review_list[index + 1]

%ul.pager
  %li.previous{ class: ('disabled' unless previous_snapshot) }
    :ruby
      href = if previous_snapshot
               snapshot_path(previous_snapshot)
             else
               'javascript:;'
             end
    = link_to href, data: { keyboard_shortcut: 'K [' } do
      %i.glyphicon.glyphicon-arrow-left
      = t('.previous_in_sweep')

  %li.next{ class: ('disabled' unless next_snapshot) }
    :ruby
      href = if next_snapshot
               snapshot_path(next_snapshot)
             else
               'javascript:;'
             end
    = link_to href, data: { keyboard_shortcut: 'J ]' } do
      = t('.next_in_sweep')
      %i.glyphicon.glyphicon-arrow-right