Files
codeocean/app/views/tips/index.html.slim
Sebastian Serth a99da79550 Disable sorttable on tables without rows
Otherwise, the first element of the table body is being fetched which might result in an error for empty tables.

Fixes CODEOCEAN-JZ
2023-03-14 18:27:38 +01:00

21 lines
942 B
Plaintext

h1 = Tip.model_name.human(count: 2)
.table-responsive
table.table class="#{@tips.present? ? 'sortable' : ''}"
thead
tr
th = t('activerecord.attributes.tip.title')
th = t('activerecord.attributes.file.file_type')
th colspan=3 = t('shared.actions')
tbody
- @tips.each do |tip|
tr
td = link_to_if(policy(tip).show?, tip.title || tip.to_s, tip)
td = tip.file_type ? link_to_if(policy(tip.file_type).show?, tip.file_type.name, tip.file_type) : ''
td = link_to(t('shared.show'), tip) if policy(tip).show?
td = link_to(t('shared.edit'), edit_tip_path(tip)) if policy(tip).edit?
td = link_to(t('shared.destroy'), tip, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if tip.can_be_destroyed? && policy(tip).destroy?
= render('shared/pagination', collection: @tips)
p = render('shared/new_button', model: Tip, path: new_tip_path)