- description ||= nil
- cols ||= [:runner, :time, :name, :rival, :uploaded]
- runs = order_runs(runs).page(params[:page])
- if runs.empty?
center
i No runs matched!
- else
- if description.present?
.card-header.text-white = description
.table-responsive
table.card-body.table.table-striped.table-hover.mb-0
thead
tr
- if cols.include?(:owner_controls)
th.header.align-right
- if cols.include?(:runner)
th.header.align-right = th_sorter('Runner', 'user_id')
- if cols.include?(:time)
th.header.align-right = th_sorter('Time', 'time')
- if cols.include?(:name)
th Game + Category
- if cols.include?(:rival)
th.header.align-right Rival
- if cols.include?(:uploaded)
th.header.align-right = th_sorter('Uploaded', 'created_at')
tbody
- runs.includes(:user).each do |run|
tr id="run_#{run.id36}"
- if cols.include?(:owner_controls)
td.align-right
.dropdown
.kill-run-button id="dropdown_#{run.id36}" data={toggle: :dropdown} x
.dropdown-menu.bg-dark role=:menu aria={labelledby: "dropdown_#{run.id36}"}
= link_to ' Disown'.html_safe, '#', onclick: "window.disown_run('#{run.id36}');", class: 'dropdown-item text-danger'
= link_to ' Delete'.html_safe, '#', onclick: "window.delete_run('#{run.id36}');", class: 'dropdown-item text-danger'
- if cols.include?(:runner)
td.align-right
- if run.user && run.user.name
= link_to run.user, user_path(run.user), class: 'user-link'
- if run.user.silver_patron?
.gold-split title='Patron'
- else
| -
- if cols.include?(:time)
td.align-right = format_ms(run.realtime_duration_ms)
- if cols.include?(:name)
td = link_to run, run_path(run), class: 'run-link'
- if cols.include?(:rival)
td.align-right
small
- rival = run.user.rival_for(run.category)
- if rival.present? && rival.runs?(run.category)
- rival_run = rival.pb_for(run.category)
= link_to compare_path(run, rival_run), class: 'run-link stealth-link' do
= pretty_difference(run.duration_ms(Run::REAL), rival_run.duration_ms(Run::REAL))
' against
= rival
- if rival.silver_patron?
.gold-split title='Patron'
- elsif run.category.present?
= link_to '+', new_rivalry_path(category: run.category)
- if cols.include?(:uploaded)
td.align-right.nowrap class=('short' if run.short?) title=run.created_at = "#{time_ago_in_words(run.created_at)} ago"
.mx-auto
= paginate(runs, theme: 'twitter-bootstrap-4', pagination_class: 'mt-3')