Merge pull request #141 from openHPI/fix-user-exercise-feedback-ui

Update exercise feedback UI
This commit is contained in:
rteusner
2017-11-22 14:07:17 +01:00
committed by GitHub
6 changed files with 77 additions and 29 deletions

View File

@ -95,14 +95,43 @@ a.file-heading {
left: 0;
}
.feedback {
.text {
.feedback-page {
.header {
font-weight: bold;
margin-bottom: 10px;
}
.difficulty {
font-weight: bold;
.value {
border: 1px solid grey;
padding: 10px;
margin-bottom: 10px;
}
.worktime {
.no-feedback {
font-weight: bold;
margin-top: 50px;
}
.feedback-header {
display: flex;
.username {
flex-grow: 1;
font-weight: bold;
}
.date {}
}
.feedback {
.text {
margin-bottom: 10px;
}
.difficulty {
font-weight: bold;
}
.worktime {
font-weight: bold;
}
}
}

View File

@ -1,15 +1,24 @@
h1 = @exercise
h1 = link_to(@exercise, exercise_path(@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
.feedback-page
.header = t('activerecord.attributes.exercise.description')
.value = render_markdown(@exercise.description)
= render('shared/pagination', collection: @feedbacks)
.header = t('activerecord.models.user_exercise_feedback.other')
- if @feedbacks.nil? or @feedbacks.size == 0
.no-feedback = t('user_exercise_feedback.no_feedback')
ul.list-unstyled.panel-group
- @feedbacks.each do |feedback|
li.panel.panel-default
.panel-heading role="tab" id="heading"
div.clearfix.feedback-header
span.username = link_to(feedback.user.name, statistics_external_user_exercise_path(id: @exercise.id, external_user_id: feedback.user.id))
span.date = feedback.created_at
.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)

View File

@ -662,6 +662,7 @@ de:
estimated_time_20_to_30: "zwischen 20 und 30 Minuten"
estimated_time_more_30: "mehr als 30 Minuten"
working_time: "Geschätze Bearbeitungszeit für diese Aufgabe:"
no_feedback: "Es wurde noch kein Feedback zu dieser Aufgabe gegeben."
error_templates:
hints:
signature: "Ein regulärer Ausdruck in Ruby-Syntax und ohne führende und schließende \"/\""

View File

@ -662,6 +662,7 @@ en:
estimated_time_20_to_30: "between 20 and 30 minutes"
estimated_time_more_30: "more than 30 minutes"
working_time: "Estimated time working on this exercise:"
no_feedback: "There is no feedback for this exercise yet."
error_templates:
hints:
signature: "A regular expression in Ruby syntax without leading and trailing \"/\""

View File

@ -0,0 +1,6 @@
class AddTimestampsToUserExerciseFeedbacks < ActiveRecord::Migration
def up
add_column :user_exercise_feedbacks, :created_at, :datetime, null: false, default: Time.now
add_column :user_exercise_feedbacks, :updated_at, :datetime, null: false, default: Time.now
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20171002131135) do
ActiveRecord::Schema.define(version: 20171120153705) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -123,14 +123,14 @@ ActiveRecord::Schema.define(version: 20171002131135) do
create_table "exercises", force: :cascade do |t|
t.text "description"
t.integer "execution_environment_id"
t.string "title", limit: 255
t.string "title", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
t.text "instructions"
t.boolean "public"
t.string "user_type", limit: 255
t.string "token", limit: 255
t.string "user_type", limit: 255
t.string "token", limit: 255
t.boolean "hide_file_tree"
t.boolean "allow_file_creation"
t.boolean "allow_auto_completion", default: false
@ -347,13 +347,15 @@ ActiveRecord::Schema.define(version: 20171002131135) do
end
create_table "user_exercise_feedbacks", force: :cascade do |t|
t.integer "exercise_id", null: false
t.integer "user_id", null: false
t.string "user_type", null: false
t.integer "difficulty"
t.integer "working_time_seconds"
t.string "feedback_text"
t.integer "user_estimated_worktime"
t.integer "exercise_id", null: false
t.integer "user_id", null: false
t.string "user_type", null: false
t.integer "difficulty"
t.integer "working_time_seconds"
t.string "feedback_text"
t.integer "user_estimated_worktime"
t.datetime "created_at", default: '2017-11-20 18:20:25', null: false
t.datetime "updated_at", default: '2017-11-20 18:20:25', null: false
end
create_table "user_exercise_interventions", force: :cascade do |t|