From 827f30b9e7cd04b92e4feefd4e8a92170e83e936 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 16:01:07 +0200 Subject: [PATCH 01/10] Wrap tags in collapsable container --- app/views/exercises/_form.html.slim | 33 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index 5ab8502b..25966cf0 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -38,19 +38,28 @@ .form-group = f.label(t('activerecord.attributes.exercise.worktime')) = f.number_field "expected_worktime_minutes", value: @exercise.expected_worktime_seconds / 60, in: 1..1000, step: 1 + h2 Tags - .table-responsive - table.table#tags-table - thead - tr - th = t('activerecord.attributes.exercise.selection') - th = sort_link(@search, :title, t('activerecord.attributes.tag.name')) - th = t('activerecord.attributes.tag.difficulty') - = collection_check_boxes :exercise, :tag_ids, @exercise_tags, :tag_id, :id do |b| - tr - td = b.check_box - td = b.object.tag.name - td = number_field "tag_factors[#{b.object.tag.id}]", :factor, :value => b.object.factor, in: 1..10, step: 1 + ul.list-unstyled.panel-group + li.panel.panel-default + .panel-heading role="tab" id="heading" + a.file-heading data-toggle="collapse" href="#tag-collapse" + div.clearfix role="button" + span Click to expand/collapse... + .panel-collapse.collapse id="tag-collapse" role="tabpanel" + .table-responsive + table.table#tags-table + thead + tr + th = t('activerecord.attributes.exercise.selection') + th = sort_link(@search, :title, t('activerecord.attributes.tag.name')) + th = t('activerecord.attributes.tag.difficulty') + = collection_check_boxes :exercise, :tag_ids, @exercise_tags, :tag_id, :id do |b| + tr + td = b.check_box + td = b.object.tag.name + td = number_field "tag_factors[#{b.object.tag.id}]", :factor, :value => b.object.factor, in: 1..10, step: 1 + h2 = t('activerecord.attributes.exercise.files') ul#files.list-unstyled.panel-group = f.fields_for :files do |files_form| From a6bc971659cbb04e36dd1520e531656ec2cc6ce8 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 16:15:17 +0200 Subject: [PATCH 02/10] Add I18n for tags --- app/views/exercises/_form.html.slim | 4 ++-- config/locales/de.yml | 2 ++ config/locales/en.yml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index 25966cf0..bb4aa851 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -39,13 +39,13 @@ = f.label(t('activerecord.attributes.exercise.worktime')) = f.number_field "expected_worktime_minutes", value: @exercise.expected_worktime_seconds / 60, in: 1..1000, step: 1 - h2 Tags + h2 = t('exercises.form.tags') ul.list-unstyled.panel-group li.panel.panel-default .panel-heading role="tab" id="heading" a.file-heading data-toggle="collapse" href="#tag-collapse" div.clearfix role="button" - span Click to expand/collapse... + span = t('exercises.form.click_to_collapse') .panel-collapse.collapse id="tag-collapse" role="tabpanel" .table-responsive table.table#tags-table diff --git a/config/locales/de.yml b/config/locales/de.yml index 62fc76b5..0f066fde 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -260,6 +260,8 @@ de: path: 'Pfad der Datei im Projektverzeichnis. Kann auch leer gelassen werden.' form: add_file: Datei hinzufügen + tags: "Tags" + click_to_collapse: "Zum Aus-/Einklappen hier klicken..." implement: alert: text: 'Ihr Browser unterstützt nicht alle Funktionalitäten, die %{application_name} benötigt. Bitte nutzen Sie einen modernen Browser, um %{application_name} zu besuchen.' diff --git a/config/locales/en.yml b/config/locales/en.yml index 1e13f929..f3aa6735 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -260,6 +260,8 @@ en: path: "The file's path in the project tree. Can be left blank." form: add_file: Add file + tags: "Tags" + click_to_collapse: "Click to expand/collapse..." implement: alert: text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.' From 8c6b3c8e57d65990c17ab4a3e081c78a623c039c Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 16:23:09 +0200 Subject: [PATCH 03/10] Add space below exercise form --- app/assets/stylesheets/exercises.css.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/exercises.css.scss b/app/assets/stylesheets/exercises.css.scss index eb1b5300..73c0b26e 100644 --- a/app/assets/stylesheets/exercises.css.scss +++ b/app/assets/stylesheets/exercises.css.scss @@ -62,7 +62,9 @@ a.file-heading { fill: #ffd897; } - +.container > form > .actions { + margin-bottom: 200px; +} .d3-tip { line-height: 1; From acf2bfb28e311c50792274706fa3f173437b81ca Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 16:24:21 +0200 Subject: [PATCH 04/10] Collapse files by default --- app/views/exercises/_file_form.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index 065eca66..3c43cd65 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -5,7 +5,7 @@ li.panel.panel-default a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{id}" div.clearfix role="button" span = f.object.name - .panel-collapse.collapse-in id="collapse#{id}" role="tabpanel" + .panel-collapse.collapse id="collapse#{id}" role="tabpanel" .panel-body .clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right') .form-group From bbf94859eb7d28e1851f8edd90e0246f78873bfb Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 16:31:30 +0200 Subject: [PATCH 05/10] Enable expanding multiple files at the same time --- app/views/exercises/_file_form.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index 3c43cd65..b1c292cd 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -2,7 +2,7 @@ li.panel.panel-default .panel-heading role="tab" id="heading" - a.file-heading data-toggle="collapse" data-parent="#files" href="#collapse#{id}" + a.file-heading data-toggle="collapse" href="#collapse#{id}" div.clearfix role="button" span = f.object.name .panel-collapse.collapse id="collapse#{id}" role="tabpanel" From 10600045f4837b9758d0003f257546ae58954a3e Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 17:09:27 +0200 Subject: [PATCH 06/10] Auto-expand new files --- app/views/exercises/_file_form.html.slim | 2 +- app/views/exercises/_form.html.slim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index b1c292cd..5ed70fcb 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -5,7 +5,7 @@ li.panel.panel-default a.file-heading data-toggle="collapse" href="#collapse#{id}" div.clearfix role="button" span = f.object.name - .panel-collapse.collapse id="collapse#{id}" role="tabpanel" + .panel-collapse.collapse class=('in' if new_file) id="collapse#{id}" role="tabpanel" .panel-body .clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right') .form-group diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index bb4aa851..b70ef447 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -63,10 +63,10 @@ h2 = t('activerecord.attributes.exercise.files') ul#files.list-unstyled.panel-group = f.fields_for :files do |files_form| - = render('file_form', f: files_form) + = render('file_form', f: files_form, new_file: false) a#add-file.btn.btn-default.btn-sm.pull-right href='#' = t('.add_file') ul#dummies.hidden = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form| - = render('file_form', f: files_form) + = render('file_form', f: files_form, new_file: true) .actions = render('shared/submit_button', f: f, object: @exercise) \ No newline at end of file From d5aed4f7b64a301acae796da444feb1ab20526c1 Mon Sep 17 00:00:00 2001 From: Maximilian Grundke Date: Thu, 21 Sep 2017 17:15:01 +0200 Subject: [PATCH 07/10] Don't rely on parameter; use non-existing file name as indicator instead --- app/views/exercises/_file_form.html.slim | 2 +- app/views/exercises/_form.html.slim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/exercises/_file_form.html.slim b/app/views/exercises/_file_form.html.slim index 5ed70fcb..75deeeb5 100644 --- a/app/views/exercises/_file_form.html.slim +++ b/app/views/exercises/_file_form.html.slim @@ -5,7 +5,7 @@ li.panel.panel-default a.file-heading data-toggle="collapse" href="#collapse#{id}" div.clearfix role="button" span = f.object.name - .panel-collapse.collapse class=('in' if new_file) id="collapse#{id}" role="tabpanel" + .panel-collapse.collapse class=('in' if f.object.name.nil?) id="collapse#{id}" role="tabpanel" .panel-body .clearfix = link_to(t('shared.destroy'), '#', class:'btn btn-warning btn-sm discard-file pull-right') .form-group diff --git a/app/views/exercises/_form.html.slim b/app/views/exercises/_form.html.slim index b70ef447..bb4aa851 100644 --- a/app/views/exercises/_form.html.slim +++ b/app/views/exercises/_form.html.slim @@ -63,10 +63,10 @@ h2 = t('activerecord.attributes.exercise.files') ul#files.list-unstyled.panel-group = f.fields_for :files do |files_form| - = render('file_form', f: files_form, new_file: false) + = render('file_form', f: files_form) a#add-file.btn.btn-default.btn-sm.pull-right href='#' = t('.add_file') ul#dummies.hidden = f.fields_for(:files, CodeOcean::File.new, child_index: 'index') do |files_form| - = render('file_form', f: files_form, new_file: true) + = render('file_form', f: files_form) .actions = render('shared/submit_button', f: f, object: @exercise) \ No newline at end of file From f62b8f12c4e14c0ecec1bc154cedaf67739af1f8 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Thu, 21 Sep 2017 17:35:48 +0200 Subject: [PATCH 08/10] remove email adress from statistics view (also for admins) --- app/views/exercises/statistics.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercises/statistics.html.slim b/app/views/exercises/statistics.html.slim index 89b7d6a1..d39c514b 100644 --- a/app/views/exercises/statistics.html.slim +++ b/app/views/exercises/statistics.html.slim @@ -35,7 +35,7 @@ h1 = @exercise tbody - @exercise.send(symbol).distinct().each do |user| - if user_statistics[user.id] then us = user_statistics[user.id] else us = {"maximum_score" => nil, "runs" => nil} - - label = current_user.teacher? ? "#{user.name}" : "#{user.name} (#{user.email})" + - label = "#{user.displayname}" tr td = link_to_if symbol==:external_users, label, {controller: "exercises", action: "statistics", external_user_id: user.id, id: @exercise.id} td = us['maximum_score'] or 0 From dad1c2f1a3712d02e58ebb9395b19c5252457d6e Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 27 Sep 2017 09:50:45 +0200 Subject: [PATCH 09/10] change margin top to margin bottom on request_for_comment editor (commentitor). --- app/assets/stylesheets/request-for-comments.css.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/request-for-comments.css.scss b/app/assets/stylesheets/request-for-comments.css.scss index 8fb7bfea..e4b56e2e 100644 --- a/app/assets/stylesheets/request-for-comments.css.scss +++ b/app/assets/stylesheets/request-for-comments.css.scss @@ -1,5 +1,5 @@ #commentitor { - margin-top: 2rem; + margin-bottom: 2rem; height: 600px; background-color:#f9f9f9 } From af67208fd3b9d942e7adfb67d11d9fe0aba67663 Mon Sep 17 00:00:00 2001 From: Ralf Teusner Date: Wed, 27 Sep 2017 11:59:59 +0200 Subject: [PATCH 10/10] added token to proxy exercise view, also added locale --- app/views/proxy_exercises/index.html.slim | 2 +- app/views/proxy_exercises/show.html.slim | 1 + config/locales/de.yml | 1 + config/locales/en.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/proxy_exercises/index.html.slim b/app/views/proxy_exercises/index.html.slim index 2a8067c1..80e8084c 100644 --- a/app/views/proxy_exercises/index.html.slim +++ b/app/views/proxy_exercises/index.html.slim @@ -10,7 +10,7 @@ h1 = ProxyExercise.model_name.human(count: 2) thead tr th = sort_link(@search, :title, t('activerecord.attributes.proxy_exercise.title')) - th = "Token" + th = t('activerecord.attributes.exercise.token') th = t('activerecord.attributes.proxy_exercise.files_count') th colspan=6 = t('shared.actions') tbody diff --git a/app/views/proxy_exercises/show.html.slim b/app/views/proxy_exercises/show.html.slim index c1888d79..2649cbb5 100644 --- a/app/views/proxy_exercises/show.html.slim +++ b/app/views/proxy_exercises/show.html.slim @@ -10,6 +10,7 @@ h1 = row(label: 'exercise.title', value: @proxy_exercise.title) = row(label: 'proxy_exercise.files_count', value: @exercises.count) = row(label: 'exercise.description', value: @proxy_exercise.description) += row(label: 'exercise.token', value: @proxy_exercise.token) h3 Exercises .table-responsive table.table diff --git a/config/locales/de.yml b/config/locales/de.yml index 0f066fde..2ab23322 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -42,6 +42,7 @@ de: allow_file_creation: "Dateierstellung erlauben" difficulty: Schwierigkeitsgrad worktime: "vermutete Arbeitszeit in Minuten" + token: "Aufgaben-Token" proxy_exercise: title: Title files_count: Anzahl der Aufgaben diff --git a/config/locales/en.yml b/config/locales/en.yml index f3aa6735..e2cba090 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -42,6 +42,7 @@ en: allow_file_creation: "Allow file creation" difficulty: Difficulty worktime: "Expected worktime in minutes" + token: "Exercise Token" proxy_exercise: title: Title files_count: Exercises Count