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
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
h1 = ErrorTemplateAttribute.model_name.human(count: 2)
|
||||
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@error_template_attributes.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th
|
||||
|
@ -1,7 +1,7 @@
|
||||
h1 = ErrorTemplate.model_name.human(count: 2)
|
||||
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@error_templates.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th = t('activerecord.attributes.error_template.name')
|
||||
|
@ -13,7 +13,7 @@ h2.mt-4
|
||||
= t 'error_templates.attributes'
|
||||
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@error_templates.error_template_attributes.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th
|
||||
|
@ -1,7 +1,7 @@
|
||||
h1 = @execution_environment
|
||||
|
||||
.table-responsive
|
||||
table.table.table-striped.sortable
|
||||
table.table.table-striped class="#{@execution_environment.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
- ['.exercise', '.users', '.score', '.maximum_score', '.stddev_score', '.percentage_correct', '.runs', '.worktime', '.stddev_worktime'].each do |title|
|
||||
|
@ -28,7 +28,7 @@ h1 = @exercise_collection
|
||||
|
||||
h4.mt-4 = t('activerecord.attributes.exercise_collections.exercises')
|
||||
.table-responsive#exercise-list
|
||||
table.table.sortable
|
||||
table.table class="#{@exercise_collection.items.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th = '#'
|
||||
|
@ -61,8 +61,9 @@ h1 = @exercise
|
||||
- if !policy(@exercise).detailed_statistics?
|
||||
- submissions = submissions.final
|
||||
- if submissions.any?
|
||||
- users = symbol.to_s.classify.constantize.where(id: submissions.joins(symbol).group(:user_id).select(:user_id).distinct)
|
||||
.table-responsive
|
||||
table.table.table-striped.sortable
|
||||
table.table.table-striped class="#{users.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th.header = t('.user')
|
||||
@ -71,7 +72,6 @@ h1 = @exercise
|
||||
th.header = t('.runs') if policy(@exercise).detailed_statistics?
|
||||
th.header = t('.worktime') if policy(@exercise).detailed_statistics?
|
||||
tbody
|
||||
- users = symbol.to_s.classify.constantize.where(id: submissions.joins(symbol).group(:user_id).select(:user_id).distinct)
|
||||
- users.each do |user|
|
||||
- if user_statistics[user.class.name][user.id] then us = user_statistics[user.class.name][user.id] else us = {"maximum_score" => nil, "runs" => nil}
|
||||
- label = "#{user.displayname}"
|
||||
|
@ -7,7 +7,7 @@ h1 = t('.title')
|
||||
|
||||
- if submissions.any?
|
||||
.table-responsive
|
||||
table.table.table-striped.sortable
|
||||
table.table.table-striped class="#{exercises.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th.header = t('.exercise')
|
||||
|
@ -17,7 +17,7 @@ h1 = RequestForComment.model_name.human(count: 2)
|
||||
{ class: 'form-control', multiple: true, "data-placeholder": t('request_for_comments.index.study_groups.placeholder') })
|
||||
|
||||
.table-responsive
|
||||
table.table.sortable.mt-4
|
||||
table.table.mt-4 class="#{@request_for_comments.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
h3 = t('activerecord.attributes.study_group.members')
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@members.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th = t('activerecord.attributes.exercise.selection')
|
||||
|
@ -12,7 +12,7 @@ h1
|
||||
|
||||
h2.mt-4 = t('activerecord.attributes.study_group.members')
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@study_group.users.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th = t('navigation.sections.users')
|
||||
|
@ -1,7 +1,7 @@
|
||||
h1 = Tip.model_name.human(count: 2)
|
||||
|
||||
.table-responsive
|
||||
table.sortable.table
|
||||
table.table class="#{@tips.present? ? 'sortable' : ''}"
|
||||
thead
|
||||
tr
|
||||
th = t('activerecord.attributes.tip.title')
|
||||
|
Reference in New Issue
Block a user