diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb deleted file mode 100644 index e076a741..00000000 --- a/app/views/comments/_form.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%= form_for(@comment) do |f| %> - <% if @comment.errors.any? %> -
-

<%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:

- - -
- <% end %> - -
- <%= f.label :user_id %>
- <%= f.text_field :user_id %> -
-
- <%= f.label :file_id %>
- <%= f.text_field :file_id %> -
-
- <%= f.label :row %>
- <%= f.number_field :row %> -
-
- <%= f.label :column %>
- <%= f.number_field :column %> -
-
- <%= f.label :text %>
- <%= f.text_field :text %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/comments/_form.html.slim b/app/views/comments/_form.html.slim new file mode 100644 index 00000000..96149d69 --- /dev/null +++ b/app/views/comments/_form.html.slim @@ -0,0 +1,33 @@ += form_for(@comment) do |f| + - if @comment.errors.any? + #error_explanation + h2 + = pluralize(@comment.errors.count, "error") + | prohibited this comment from being saved: + + ul + - @comment.errors.full_messages.each do |message| + li= message + + .field + = f.label :user_id + br/ + = f.text_field :user_id + .field + = f.label :file_id + br/ + = f.text_field :file_id + .field + = f.label :row + br/ + = f.number_field :row + .field + = f.label :column + br/ + = f.number_field :column + .field + = f.label :text + br/ + = f.text_field :text + .actions + = f.submit diff --git a/app/views/comments/edit.html.erb b/app/views/comments/edit.html.erb deleted file mode 100644 index 12ea7f96..00000000 --- a/app/views/comments/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing comment

- -<%= render 'form' %> - -<%= link_to 'Show', @comment %> | -<%= link_to 'Back', comments_path %> diff --git a/app/views/comments/edit.html.slim b/app/views/comments/edit.html.slim new file mode 100644 index 00000000..dd0f49e3 --- /dev/null +++ b/app/views/comments/edit.html.slim @@ -0,0 +1,7 @@ +h1 Editing comment + += render 'form' + += link_to 'Show', @comment +| | += link_to 'Back', comments_path diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb deleted file mode 100644 index f9f83ff8..00000000 --- a/app/views/comments/index.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -

Listing comments

- - - - - - - - - - - - - - - <% @comments.each do |comment| %> - - - - - - - - - - - <% end %> - -
UserFileRowColumnText
<%= comment.user %><%= comment.file %><%= comment.row %><%= comment.column %><%= comment.text %><%= link_to 'Show', comment %><%= link_to 'Edit', edit_comment_path(comment) %><%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Comment', new_comment_path %> diff --git a/app/views/comments/index.html.slim b/app/views/comments/index.html.slim new file mode 100644 index 00000000..275a5042 --- /dev/null +++ b/app/views/comments/index.html.slim @@ -0,0 +1,24 @@ +h1 Listing comments + +table + thead + tr + th User + th File + th Row + th Column + th Text + th colspan="3" + tbody + - @comments.each do |comment| + tr + td= comment.user + td= comment.file + td= comment.row + td= comment.column + td= comment.text + td= link_to 'Show', comment + td= link_to 'Edit', edit_comment_path(comment) + td= link_to 'Destroy', comment, method: :delete, data: confirm: 'Are you sure?' +br/ += link_to 'New Comment', new_comment_path diff --git a/app/views/comments/new.html.erb b/app/views/comments/new.html.erb deleted file mode 100644 index 07a754a8..00000000 --- a/app/views/comments/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New comment

- -<%= render 'form' %> - -<%= link_to 'Back', comments_path %> diff --git a/app/views/comments/new.html.slim b/app/views/comments/new.html.slim new file mode 100644 index 00000000..1b985e65 --- /dev/null +++ b/app/views/comments/new.html.slim @@ -0,0 +1,5 @@ +h1 New comment + += render 'form' + += link_to 'Back', comments_path diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb deleted file mode 100644 index e6955fa0..00000000 --- a/app/views/comments/show.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -

<%= notice %>

- -

- User: - <%= @comment.user %> -

- -

- File: - <%= @comment.file %> -

- -

- Row: - <%= @comment.row %> -

- -

- Column: - <%= @comment.column %> -

- -

- Text: - <%= @comment.text %> -

- -<%= link_to 'Edit', edit_comment_path(@comment) %> | -<%= link_to 'Back', comments_path %> diff --git a/app/views/comments/show.html.slim b/app/views/comments/show.html.slim new file mode 100644 index 00000000..24233d06 --- /dev/null +++ b/app/views/comments/show.html.slim @@ -0,0 +1,25 @@ +p#notice= notice + +p + strong User: + = @comment.user + +p + strong File: + = @comment.file + +p + strong Row: + = @comment.row + +p + strong Column: + = @comment.column + +p + strong Text: + = @comment.text + += link_to 'Edit', edit_comment_path(@comment) +| | += link_to 'Back', comments_path diff --git a/app/views/request_for_comments/_form.html.erb b/app/views/request_for_comments/_form.html.erb deleted file mode 100644 index 81f6ed65..00000000 --- a/app/views/request_for_comments/_form.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<%= form_for(@request_for_comment) do |f| %> - <% if @request_for_comment.errors.any? %> -
-

<%= pluralize(@request_for_comment.errors.count, "error") %> prohibited this request_for_comment from being saved:

- - -
- <% end %> - -
- <%= f.label :user_id %>
- <%= f.number_field :user_id %> -
-
- <%= f.label :exercise_id %>
- <%= f.number_field :exercise_id %> -
-
- <%= f.label :file_id %>
- <%= f.number_field :file_id %> -
-
- <%= f.label :user_type %>
- <%= f.text_field :user_type %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/request_for_comments/_form.html.slim b/app/views/request_for_comments/_form.html.slim new file mode 100644 index 00000000..f24ddd22 --- /dev/null +++ b/app/views/request_for_comments/_form.html.slim @@ -0,0 +1,28 @@ += form_for(@request_for_comment) do |f| + - if @request_for_comment.errors.any? + #error_explanation + h2 + = pluralize(@request_for_comment.errors.count, "error") + | prohibited this request_for_comment from being saved: + ul + - @request_for_comment.errors.full_messages.each do |message| + li= message + + .field + = f.label :user_id + br/ + = f.number_field :user_id + .field + = f.label :exercise_id + br/ + = f.number_field :exercise_id + .field + = f.label :file_id + br/ + = f.number_field :file_id + .field + = f.label :user_type + br/ + = f.text_field :user_type + .actions + = f.submit diff --git a/app/views/request_for_comments/show.html.erb b/app/views/request_for_comments/show.html.slim similarity index 67% rename from app/views/request_for_comments/show.html.erb rename to app/views/request_for_comments/show.html.slim index 2bc57dc8..a55764c4 100644 --- a/app/views/request_for_comments/show.html.erb +++ b/app/views/request_for_comments/show.html.slim @@ -1,116 +1,87 @@ -
-

- <% if @request_for_comment.solved? %> - - <% end %> - <%= link_to(@request_for_comment.exercise.title, [:implement, @request_for_comment.exercise]) %> -

-

- <% - user = @request_for_comment.user - submission = @request_for_comment.submission - testruns = Testrun.where(:submission_id => @request_for_comment.submission) - %> - <%= user.displayname %> | <%= @request_for_comment.created_at.localtime %> -

-
-
-
- <%= t('activerecord.attributes.exercise.description') %> -
-
- - <%= render_markdown(@request_for_comment.exercise.description) %> -
-
+.list-group + h4#exercise_caption.list-group-item-heading data-comment-exercise-url=create_comment_exercise_request_for_comment_path data-exercise-id="#{@request_for_comment.exercise.id}" data-rfc-id="#{@request_for_comment.id}" + - if @request_for_comment.solved? + span.fa.fa-check aria-hidden="true" + = link_to(@request_for_comment.exercise.title, [:implement, @request_for_comment.exercise]) + p.list-group-item-text + - user = @request_for_comment.user + - submission = @request_for_comment.submission + - testruns = Testrun.where(:submission_id => @request_for_comment.submission) + = user.displayname + | | #{@request_for_comment.created_at.localtime} + .rfc + .description + h5 + = t('activerecord.attributes.exercise.description') + .text + span.fa.fa-chevron-up.collapse-button + = render_markdown(@request_for_comment.exercise.description) -
-
- <%= t('activerecord.attributes.request_for_comments.question')%> -
-
- <% question = @request_for_comment.question %> - <%= question.nil? or question.empty? ? t('request_for_comments.no_question') : question %> -
-
+ .question + h5.mt-4 + = t('activerecord.attributes.request_for_comments.question') + .text + - question = @request_for_comment.question + = question.nil? or question.empty? ? t('request_for_comments.no_question') : question - <% if policy(@request_for_comment).mark_as_solved? and not @request_for_comment.solved? %> - <%= render('mark_as_solved') %> - <% end %> - - <% if testruns.size > 0 %> -
- <% output_runs = testruns.select { |run| run.cause == 'run' } %> - <% if output_runs.size > 0 %> -
<%= t('request_for_comments.runtime_output') %>
- - <% end %> + - if policy(@request_for_comment).mark_as_solved? and not @request_for_comment.solved? + = render('mark_as_solved') - <% assess_runs = testruns.select { |run| run.cause == 'assess' } %> - <% if assess_runs.size > 0 %> -
<%= t('request_for_comments.test_results') %>
-
- <% assess_runs.each do |testrun| %> -
-
- -
- <% end %> -
- <% end %> -
- <% end %> + - if testruns.size > 0 + .testruns + - output_runs = testruns.select {|run| run.cause == 'run'} + - if output_runs.size > 0 + h5.mt-4= t('request_for_comments.runtime_output') + .collapsed.testrun-output.text + span.fa.fa-chevron-down.collapse-button + - output_runs.each do |testrun| + - output = testrun.try(:output) + - if output + - messages = output.scan(/{(?:(?:".+?":".+?")+?,?)+}/) + - messages.map! {|el| JSON.parse(el)} + - messages.keep_if {|message| message['cmd'] == 'write'} + - messages.map! {|message| message['data']} + - output = messages.join '' + pre= output or t('request_for_comments.no_output') - <% if @current_user.admin? && user.is_a?(ExternalUser) %> - <%= render('admin_menu') %> - <% end %> + - assess_runs = testruns.select {|run| run.cause == 'assess'} + - if assess_runs.size > 0 + h5.mt-4= t('request_for_comments.test_results') + .testrun-assess-results + - assess_runs.each do |testrun| + .testrun-container + div class=("result #{testrun.passed ? 'passed' : 'failed'}") + .collapsed.testrun-output.text + span.fa.fa-chevron-down.collapse-button + pre= testrun.output or t('request_for_comments.no_output') -
+ - if @current_user.admin? && user.is_a?(ExternalUser) + = render('admin_menu') -
-
- <%= t('request_for_comments.howto_title') %> -
-
- <%= render_markdown(t('request_for_comments.howto')) %> -
-
-
-
+ hr/ -
- -<% submission.files.each do |file| %> - <%= (file.path or "") + "/" + file.name + file.file_type.file_extension %>
-    <%= t('request_for_comments.click_here') %> -
<%= file.content %> -
-<% end %> + .howto + h5.mt-4 + = t('request_for_comments.howto_title') + .text + = render_markdown(t('request_for_comments.howto')) -<%= render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.dialogtitle'), template: 'exercises/_comment_dialogcontent') %> +.d-none.sanitizer +/! + | do not put a carriage return in the line below. it will be present in the presentation of the source code, otherwise. + | also, all settings from the rails model needed for the editor configuration in the JavaScript are attached to the editor as data attributes here. +- submission.files.each do |file| + = (file.path or "") + "/" + file.name + file.file_type.file_extension + br/ + |    + i.fa.fa-arrow-down aria-hidden="true" + = t('request_for_comments.click_here') + #commentitor.editor data-file-id="#{file.id}" data-mode="#{file.file_type.editor_mode}" data-read-only="true" + = file.content - diff --git a/app/views/searches/destroy.html.erb b/app/views/searches/destroy.html.erb deleted file mode 100644 index e69de29b..00000000