Files
codeocean/app/views/request_for_comments/index.html.slim
Sebastian Serth 7cc4fb00c6 RfCs: Allow filtering for any states
We want to differentiate between those RfCs explicitly marked as solved, those potentially solved since the author reached the maximum score, and those being unsolved where the author has not yet reached the full score yet.
2024-04-24 12:18:47 +02:00

55 lines
3.4 KiB
Plaintext

h1 = RequestForComment.model_name.human(count: 2)
= render(layout: 'shared/form_filters') do |f|
.col-md-9.col
.row.align-items-center
- if params[:exercise_id].nil?
.col-auto
= f.label(:exercise_title_cont, t('activerecord.attributes.request_for_comments.exercise'), class: 'visually-hidden form-label')
= f.search_field(:exercise_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.request_for_comments.exercise'))
.col-auto.mt-3.mt-md-0
= f.label(:title_cont, t('request_for_comments.solved'), class: 'visually-hidden form-label')
= f.select(:state, [[t('request_for_comments.show_all'), RequestForComment::ALL], [t('request_for_comments.show_unsolved'), RequestForComment::ONGOING], [t('request_for_comments.show_soft_solved'), RequestForComment::SOFT_SOLVED], [t('request_for_comments.show_solved'), RequestForComment::SOLVED]])
- unless current_user.consumer.rfc_visibility_study_group?
.row
.col
= f.label(:submission_study_group_id_eq, t('request_for_comments.index.study_groups.placeholder'), class: 'visually-hidden form-label')
= f.grouped_collection_select(:submission_study_group_id_in, @study_groups_grouping, :second, :first, :id, :to_s, {},
{class: 'form-control', multiple: true, 'data-placeholder': t('request_for_comments.index.study_groups.placeholder')})
.table-responsive
table.table.mt-4 class=(@request_for_comments.present? ? 'sortable' : '')
thead
tr
th
i.fa-regular.fa-lightbulb aria-hidden='true' title = t('request_for_comments.solved') align='right'
th.sorttable_nosort = sort_link(@search, :title, t('activerecord.attributes.request_for_comments.exercise'))
th = t('activerecord.attributes.request_for_comments.question')
th
i.fa-solid.fa-comment aria-hidden='true' title = t('request_for_comments.comments') align='center'
th = t('activerecord.attributes.request_for_comments.username')
th = t('activerecord.attributes.request_for_comments.requested_at')
th = t('activerecord.attributes.request_for_comments.last_update')
tbody
- @request_for_comments.each do |request_for_comment|
tr data-id=request_for_comment.id
- if request_for_comment.solved?
td
span.fa-solid.fa-check aria-hidden='true'
- elsif request_for_comment.full_score_reached
td
span.fa-solid.fa-check.text-secondary-emphasis aria-hidden='true'
- else
td = ''
td = link_to_if(policy(request_for_comment).show?, request_for_comment.submission.exercise.title, request_for_comment)
- if request_for_comment.has_attribute?(:question) && request_for_comment.question.present?
td = truncate(request_for_comment.question, length: 200)
- else
td = '-'
td = request_for_comment.comments.size
td = link_to_if(request_for_comment.user && policy(request_for_comment.user).show?, request_for_comment.user.displayname, request_for_comment.user)
td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.created_at))
td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.last_comment.nil? ? request_for_comment.updated_at : request_for_comment.last_comment))
= render('shared/pagination', collection: @request_for_comments)