Add filters to index page
This commit is contained in:
@ -21,7 +21,8 @@ class UserExerciseFeedbacksController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@uefs = UserExerciseFeedback.order(:id).paginate(page: params[:page])
|
@search = UserExerciseFeedback.all.search params[:q]
|
||||||
|
@uefs = @search.result.includes(:execution_environment).order(:id).paginate(page: params[:page])
|
||||||
authorize!
|
authorize!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@ class UserExerciseFeedback < ActiveRecord::Base
|
|||||||
include Creation
|
include Creation
|
||||||
|
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
has_one :execution_environment, through: :exercise
|
||||||
|
|
||||||
validates :user_id, uniqueness: { scope: [:exercise_id, :user_type] }
|
validates :user_id, uniqueness: { scope: [:exercise_id, :user_type] }
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
"User Exercise Feedback"
|
"User Exercise Feedback"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
h1 = UserExerciseFeedback.model_name.human(count: 2)
|
h1 = UserExerciseFeedback.model_name.human(count: 2)
|
||||||
|
|
||||||
|
= render(layout: 'shared/form_filters') do |f|
|
||||||
|
.form-group
|
||||||
|
= f.label(:execution_environment_id_eq, t('activerecord.attributes.exercise.execution_environment'), class: 'sr-only')
|
||||||
|
= f.collection_select(:execution_environment_id_eq, ExecutionEnvironment.with_exercises, :id, :name, class: 'form-control', prompt: t('activerecord.attributes.exercise.execution_environment'))
|
||||||
|
.form-group
|
||||||
|
= f.label(:exercise_title_cont, t('activerecord.attributes.request_for_comments.exercise'), class: 'sr-only')
|
||||||
|
= f.search_field(:exercise_title_cont, class: 'form-control', placeholder: t('activerecord.attributes.request_for_comments.exercise'))
|
||||||
|
|
||||||
.table-responsive
|
.table-responsive
|
||||||
table.table
|
table.table
|
||||||
thead
|
thead
|
||||||
|
Reference in New Issue
Block a user