Show list of feedback messages for specific exercises
This commit is contained in:
@ -94,3 +94,15 @@ a.file-heading {
|
|||||||
top: 100%;
|
top: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.feedback {
|
||||||
|
.text {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.difficulty {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.worktime {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -6,7 +6,7 @@ class ExercisesController < ApplicationController
|
|||||||
|
|
||||||
before_action :handle_file_uploads, only: [:create, :update]
|
before_action :handle_file_uploads, only: [:create, :update]
|
||||||
before_action :set_execution_environments, only: [:create, :edit, :new, :update]
|
before_action :set_execution_environments, only: [:create, :edit, :new, :update]
|
||||||
before_action :set_exercise, only: MEMBER_ACTIONS + [:clone, :implement, :working_times, :intervention, :search, :run, :statistics, :submit, :reload]
|
before_action :set_exercise, only: MEMBER_ACTIONS + [:clone, :implement, :working_times, :intervention, :search, :run, :statistics, :submit, :reload, :feedback]
|
||||||
before_action :set_external_user, only: [:statistics]
|
before_action :set_external_user, only: [:statistics]
|
||||||
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
before_action :set_file_types, only: [:create, :edit, :new, :update]
|
||||||
before_action :set_course_token, only: [:implement]
|
before_action :set_course_token, only: [:implement]
|
||||||
@ -90,6 +90,11 @@ class ExercisesController < ApplicationController
|
|||||||
collect_set_and_unset_exercise_tags
|
collect_set_and_unset_exercise_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def feedback
|
||||||
|
authorize!
|
||||||
|
@feedbacks = @exercise.user_exercise_feedbacks.paginate(page: params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
def import_proforma_xml
|
def import_proforma_xml
|
||||||
begin
|
begin
|
||||||
user = user_for_oauth2_request()
|
user = user_for_oauth2_request()
|
||||||
|
@ -20,6 +20,7 @@ class Exercise < ActiveRecord::Base
|
|||||||
has_many :exercise_tags
|
has_many :exercise_tags
|
||||||
has_many :tags, through: :exercise_tags
|
has_many :tags, through: :exercise_tags
|
||||||
accepts_nested_attributes_for :exercise_tags
|
accepts_nested_attributes_for :exercise_tags
|
||||||
|
has_many :user_exercise_feedbacks
|
||||||
|
|
||||||
has_many :external_users, source: :user, source_type: ExternalUser, through: :submissions
|
has_many :external_users, source: :user, source_type: ExternalUser, through: :submissions
|
||||||
has_many :internal_users, source: :user, source_type: InternalUser, through: :submissions
|
has_many :internal_users, source: :user, source_type: InternalUser, through: :submissions
|
||||||
|
@ -12,7 +12,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
|
|||||||
@user.internal_user?
|
@user.internal_user?
|
||||||
end
|
end
|
||||||
|
|
||||||
[:clone?, :destroy?, :edit?, :statistics?, :update?].each do |action|
|
[:clone?, :destroy?, :edit?, :statistics?, :update?, :feedback?].each do |action|
|
||||||
define_method(action) { admin? || author?}
|
define_method(action) { admin? || author?}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
15
app/views/exercises/feedback.html.slim
Normal file
15
app/views/exercises/feedback.html.slim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
h1 = @exercise
|
||||||
|
|
||||||
|
ul.list-unstyled.panel-group#files
|
||||||
|
- @feedbacks.each do |feedback|
|
||||||
|
li.panel.panel-default
|
||||||
|
.panel-heading role="tab" id="heading"
|
||||||
|
div.clearfix
|
||||||
|
span = feedback.user.name
|
||||||
|
.panel-collapse role="tabpanel"
|
||||||
|
.panel-body.feedback
|
||||||
|
.text = feedback.feedback_text
|
||||||
|
.difficulty = "#{t('user_exercise_feedback.difficulty')} #{feedback.difficulty}" if feedback.difficulty
|
||||||
|
.worktime = "#{t('user_exercise_feedback.working_time')} #{feedback.user_estimated_worktime}" if feedback.user_estimated_worktime
|
||||||
|
|
||||||
|
= render('shared/pagination', collection: @feedbacks)
|
@ -47,6 +47,7 @@ h1 = Exercise.model_name.human(count: 2)
|
|||||||
span.sr-only Toggle Dropdown
|
span.sr-only Toggle Dropdown
|
||||||
ul.dropdown-menu.pull-right role="menu"
|
ul.dropdown-menu.pull-right role="menu"
|
||||||
li = link_to(t('shared.show'), exercise) if policy(exercise).show?
|
li = link_to(t('shared.show'), exercise) if policy(exercise).show?
|
||||||
|
li = link_to(t('activerecord.models.user_exercise_feedback.other'), feedback_exercise_path(exercise)) if policy(exercise).feedback?
|
||||||
li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(exercise).destroy?
|
li = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete) if policy(exercise).destroy?
|
||||||
li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post) if policy(exercise).clone?
|
li = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post) if policy(exercise).clone?
|
||||||
|
|
||||||
|
@ -328,6 +328,7 @@ de:
|
|||||||
clone: Duplizieren
|
clone: Duplizieren
|
||||||
implement: Implementieren
|
implement: Implementieren
|
||||||
test_files: Test-Dateien
|
test_files: Test-Dateien
|
||||||
|
feedback: Feedback
|
||||||
statistics:
|
statistics:
|
||||||
average_score: Durchschnittliche Punktzahl
|
average_score: Durchschnittliche Punktzahl
|
||||||
final_submissions: Finale Abgaben
|
final_submissions: Finale Abgaben
|
||||||
|
@ -328,6 +328,7 @@ en:
|
|||||||
clone: Duplicate
|
clone: Duplicate
|
||||||
implement: Implement
|
implement: Implement
|
||||||
test_files: Test Files
|
test_files: Test Files
|
||||||
|
feedback: Feedback
|
||||||
statistics:
|
statistics:
|
||||||
average_score: Average Score
|
average_score: Average Score
|
||||||
final_submissions: Final Submissions
|
final_submissions: Final Submissions
|
||||||
|
@ -76,6 +76,7 @@ Rails.application.routes.draw do
|
|||||||
post :intervention
|
post :intervention
|
||||||
post :search
|
post :search
|
||||||
get :statistics
|
get :statistics
|
||||||
|
get :feedback
|
||||||
get :reload
|
get :reload
|
||||||
post :submit
|
post :submit
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user