transferred Code Ocean from original repository to GitHub
This commit is contained in:
6
app/views/exercises/_code_field.html.slim
Normal file
6
app/views/exercises/_code_field.html.slim
Normal file
@@ -0,0 +1,6 @@
|
||||
.form-group class="form-group-#{attribute.to_s.gsub('_', '-')}"
|
||||
= form.label(attribute, label)
|
||||
|
|
||||
a.toggle-input href='#' = t('shared.upload_file')
|
||||
= form.text_area(attribute, class: 'code-field form-control', rows: 5)
|
||||
= form.file_field(attribute, class: 'alternative-input form-control', disabled: true)
|
34
app/views/exercises/_editor.html.slim
Normal file
34
app/views/exercises/_editor.html.slim
Normal file
@@ -0,0 +1,34 @@
|
||||
#editor.row data-exercise-id=exercise.id data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path
|
||||
.col-sm-3 = render('editor_file_tree', files: @files)
|
||||
#frames.col-sm-9
|
||||
- @files.each do |file|
|
||||
= render('editor_frame', exercise: exercise, file: file)
|
||||
#editor-buttons.btn-group
|
||||
= render('editor_button', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => exercise_path(exercise)}, icon: 'fa fa-history', id: 'start-over', label: t('exercises.editor.start_over'))
|
||||
= render('editor_button', data: {:'data-message-success' => t('submissions.create.success'), :'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-save', id: 'save', label: t('exercises.editor.save'), title: t('.tooltips.save'))
|
||||
.btn-group
|
||||
= render('editor_button', icon: 'fa fa-desktop', id: 'render', label: t('exercises.editor.render'))
|
||||
= render('editor_button', data: {:'data-message-failure' => t('exercises.editor.run_failure'), :'data-message-success' => t('exercises.editor.run_success'), :'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-play', id: 'run', label: t('exercises.editor.run'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r'))
|
||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-stop', id: 'stop', label: t('exercises.editor.stop'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + r'))
|
||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-rocket', id: 'test', label: t('exercises.editor.test'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + t'))
|
||||
button.btn.btn-primary.dropdown-toggle data-toggle='dropdown' type='button'
|
||||
span.caret
|
||||
span.sr-only Toggle Dropdown
|
||||
ul.dropdown-menu role='menu'
|
||||
li
|
||||
a#dropdown-render data-cause='render' href='#'
|
||||
i.fa.fa-desktop
|
||||
= t('exercises.editor.render')
|
||||
li
|
||||
a#dropdown-run data-cause='run' href='#'
|
||||
i.fa.fa-play
|
||||
= t('exercises.editor.run')
|
||||
li
|
||||
a#dropdown-stop href='#'
|
||||
i.fa.fa-stop
|
||||
= t('exercises.editor.stop')
|
||||
li
|
||||
a#dropdown-test data-cause='test' href='#'
|
||||
i.fa.fa-rocket
|
||||
= t('exercises.editor.test')
|
||||
= render('editor_button', data: {:'data-placement' => 'top', :'data-tooltip' => true}, icon: 'fa fa-trophy', id: 'assess', label: t('exercises.editor.score'), title: t('shared.tooltips.shortcut', shortcut: 'ALT + s'))
|
4
app/views/exercises/_editor_button.html.slim
Normal file
4
app/views/exercises/_editor_button.html.slim
Normal file
@@ -0,0 +1,4 @@
|
||||
button.btn class=(local_assigns[:classes] || 'btn-primary') *(local_assigns[:data] || {}) id=id title=local_assigns[:title] type='button'
|
||||
i.fa.fa-circle-o-notch.fa-spin
|
||||
i class=icon
|
||||
= label
|
9
app/views/exercises/_editor_file_tree.html.slim
Normal file
9
app/views/exercises/_editor_file_tree.html.slim
Normal file
@@ -0,0 +1,9 @@
|
||||
#files data-entries=FileTree.new(files).to_js_tree
|
||||
|
||||
hr
|
||||
|
||||
= render('editor_button', classes: 'btn-block btn-primary btn-sm', data: {:'data-cause' => 'file'}, icon: 'glyphicon glyphicon-plus', id: 'create-file', label: t('exercises.editor.create_file'))
|
||||
= render('editor_button', classes: 'btn-block btn-warning btn-sm', data: {:'data-cause' => 'file', :'data-message-confirm' => t('shared.confirm_destroy')}, icon: 'glyphicon glyphicon-trash', id: 'destroy-file', label: t('exercises.editor.destroy_file'))
|
||||
= render('editor_button', classes: 'btn-block btn-primary btn-sm', icon: 'fa fa-download', id: 'download', label: t('exercises.editor.download'))
|
||||
|
||||
= render('shared/modal', id: 'modal-file', template: 'code_ocean/files/_form', title: t('exercises.editor.create_file'))
|
13
app/views/exercises/_editor_frame.html.slim
Normal file
13
app/views/exercises/_editor_frame.html.slim
Normal file
@@ -0,0 +1,13 @@
|
||||
.frame data-executable=file.file_type.executable? data-filename=file.name_with_extension data-renderable=file.file_type.renderable? data-role=file.role
|
||||
- if file.file_type.binary?
|
||||
- if file.file_type.renderable?
|
||||
- if file.file_type.audio?
|
||||
= audio_tag(file.native_file.url, controls: true)
|
||||
- elsif file.file_type.image?
|
||||
= image_tag(file.native_file.url)
|
||||
- elsif file.file_type.video?
|
||||
= video_tag(file.native_file.url, controls: true)
|
||||
- else
|
||||
= link_to(file.native_file.file.name_with_extension, file.native_file.url)
|
||||
- else
|
||||
.editor data-file-id=file.ancestor_id data-indent-size=file.file_type.indent_size data-mode=file.file_type.editor_mode data-read-only=file.read_only = file.content
|
31
app/views/exercises/_file_form.html.slim
Normal file
31
app/views/exercises/_file_form.html.slim
Normal file
@@ -0,0 +1,31 @@
|
||||
li.panel.panel-default
|
||||
.panel-body
|
||||
.form-group
|
||||
= f.label(:name, t('activerecord.attributes.file.name'))
|
||||
= f.text_field(:name, class: 'form-control')
|
||||
.form-group
|
||||
= f.label(:path, t('activerecord.attributes.file.path'))
|
||||
= f.text_field(:path, class: 'form-control')
|
||||
.help-block = t('.hints.path')
|
||||
.form-group
|
||||
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'))
|
||||
= f.collection_select(:file_type_id, @file_types, :id, :name, {}, class: 'form-control')
|
||||
.form-group
|
||||
= f.label(:role, t('activerecord.attributes.file.role'))
|
||||
= f.select(:role, CodeOcean::File::TEACHER_DEFINED_ROLES.map { |role| [t("files.roles.#{role}"), role] }, {include_blank: true}, class: 'form-control')
|
||||
.checkbox
|
||||
label
|
||||
= f.check_box(:hidden)
|
||||
= t('activerecord.attributes.file.hidden')
|
||||
.checkbox
|
||||
label
|
||||
= f.check_box(:read_only)
|
||||
= t('activerecord.attributes.file.read_only')
|
||||
.form-group
|
||||
= f.label(:name, t('activerecord.attributes.file.feedback_message'))
|
||||
= f.text_area(:feedback_message, class: 'form-control', disabled: !f.object.teacher_defined_test?, maxlength: 255)
|
||||
.help-block = t('.hints.feedback_message')
|
||||
.form-group
|
||||
= f.label(:role, t('activerecord.attributes.file.weight'))
|
||||
= f.number_field(:weight, class: 'form-control', disabled: !f.object.teacher_defined_test?, min: 1, step: 'any')
|
||||
= render('code_field', attribute: :content, form: f, label: t('activerecord.attributes.file.content'))
|
27
app/views/exercises/_form.html.slim
Normal file
27
app/views/exercises/_form.html.slim
Normal file
@@ -0,0 +1,27 @@
|
||||
= form_for(@exercise, multipart: true) do |f|
|
||||
= render('shared/form_errors', object: @exercise)
|
||||
.form-group
|
||||
= f.label(:title)
|
||||
= f.text_field(:title, class: 'form-control', required: true)
|
||||
.form-group
|
||||
= f.label(:description)
|
||||
= f.text_area(:description, class: 'form-control')
|
||||
.form-group
|
||||
= f.label(:execution_environment_id)
|
||||
= f.collection_select(:execution_environment_id, @execution_environments, :id, :name, {}, class: 'form-control')
|
||||
.form-group
|
||||
= f.label(:instructions)
|
||||
= f.hidden_field(:instructions)
|
||||
.form-control.markdown
|
||||
.checkbox
|
||||
label
|
||||
= f.check_box(:public)
|
||||
= t('activerecord.attributes.exercise.public')
|
||||
h2 = t('activerecord.attributes.exercise.files')
|
||||
ul#files.list-unstyled
|
||||
= f.fields_for :files do |files_form|
|
||||
= 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)
|
||||
.actions = render('shared/submit_button', f: f, object: @exercise)
|
3
app/views/exercises/edit.html.slim
Normal file
3
app/views/exercises/edit.html.slim
Normal file
@@ -0,0 +1,3 @@
|
||||
h1 = @exercise
|
||||
|
||||
= render('form')
|
69
app/views/exercises/implement.html.slim
Normal file
69
app/views/exercises/implement.html.slim
Normal file
@@ -0,0 +1,69 @@
|
||||
h1 = @exercise
|
||||
|
||||
span.badge.pull-right.score
|
||||
|
||||
p.lead = @exercise.description
|
||||
|
||||
ul.nav.nav-justified.nav-tabs role='tablist'
|
||||
li.active
|
||||
a data-placement='top' data-toggle='tab' data-tooltip=true href='#instructions' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 1')
|
||||
i.fa.fa-question
|
||||
= t('activerecord.attributes.exercise.instructions')
|
||||
li
|
||||
a data-placement='top' data-toggle='tab' data-tooltip=true href='#workspace' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 2')
|
||||
i.fa.fa-code
|
||||
= t('.workspace')
|
||||
li
|
||||
a data-placement='top' data-toggle='tab' data-tooltip=true href='#outputInformation' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 3')
|
||||
i.fa.fa-terminal
|
||||
= t('.output')
|
||||
li
|
||||
a data-placement='top' data-toggle='tab' data-tooltip=true href='#progress' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 4')
|
||||
i.fa.fa-line-chart
|
||||
= t('.progress')
|
||||
|
||||
hr
|
||||
|
||||
.tab-content
|
||||
#instructions.tab-pane.active
|
||||
p = render_markdown(@exercise.instructions)
|
||||
br
|
||||
p.text-center
|
||||
a#start.btn.btn-lg.btn-success
|
||||
i.fa.fa-code
|
||||
= t('.start')
|
||||
#workspace.tab-pane = render('editor', exercise: @exercise, files: @files, submission: @submission)
|
||||
#outputInformation.tab-pane data-message-no-output=t('.no_output')
|
||||
#hint
|
||||
.panel.panel-warning
|
||||
.panel-heading = t('.hint')
|
||||
.panel-body
|
||||
#output
|
||||
pre = t('.no_output_yet')
|
||||
|
||||
#flowrHint.panel.panel-info(role='tab')
|
||||
.panel-heading = 'Gain more insights here'
|
||||
.panel-body
|
||||
|
||||
#progress.tab-pane
|
||||
#results
|
||||
h2 = t('.results')
|
||||
p.test-count == t('.test_count', count: 0)
|
||||
ul.list-unstyled
|
||||
ul#dummies.hidden.list-unstyled
|
||||
li.panel.panel-default
|
||||
.panel-heading
|
||||
h3.panel-title == t('.file', number: 0)
|
||||
.panel-body
|
||||
= row(label: '.passed_tests', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
||||
= row(label: 'activerecord.attributes.submission.score', value: t('shared.out_of', maximum_value: 0, value: 0).html_safe)
|
||||
= row(label: '.feedback')
|
||||
= row(label: '.output', value: link_to(t('shared.show'), '#'))
|
||||
#score data-maximum-score=@exercise.maximum_score data-score=@submission.try(:score)
|
||||
h4
|
||||
span == "#{t('activerecord.attributes.submission.score')}: "
|
||||
span.score
|
||||
.progress
|
||||
.progress-bar role='progressbar'
|
||||
br
|
||||
p.text-center = render('editor_button', classes: 'btn-lg btn-success', data: {:'data-message-confirm' => t('exercises.editor.confirm_submit'), :'data-url' => submit_exercise_path(@exercise)}, icon: 'fa fa-send', id: 'submit', label: t('exercises.editor.submit'))
|
34
app/views/exercises/index.html.slim
Normal file
34
app/views/exercises/index.html.slim
Normal file
@@ -0,0 +1,34 @@
|
||||
h1 = Exercise.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(:title_cont, t('activerecord.attributes.exercise.title'), class: 'sr-only')
|
||||
= f.search_field(:title_cont, class: 'form-control', placeholder: t('activerecord.attributes.exercise.title'))
|
||||
|
||||
.table-responsive
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th = sort_link(@search, :title, t('activerecord.attributes.exercise.title'))
|
||||
th = sort_link(@search, :user_id, t('activerecord.attributes.exercise.user'))
|
||||
th = sort_link(@search, :execution_environment_id, t('activerecord.attributes.exercise.execution_environment'))
|
||||
th = t('activerecord.attributes.exercise.public')
|
||||
th colspan=6 = t('shared.actions')
|
||||
tbody
|
||||
- @exercises.each do |exercise|
|
||||
tr
|
||||
td = exercise.title
|
||||
td = link_to(exercise.author, exercise.author)
|
||||
td = link_to(exercise.execution_environment, exercise.execution_environment)
|
||||
td = symbol_for(exercise.public?)
|
||||
td = link_to(t('shared.show'), exercise)
|
||||
td = link_to(t('shared.edit'), edit_exercise_path(exercise))
|
||||
td = link_to(t('shared.destroy'), exercise, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
|
||||
td = link_to(t('.clone'), clone_exercise_path(exercise), data: {confirm: t('shared.confirm_destroy')}, method: :post)
|
||||
td = link_to(t('.implement'), implement_exercise_path(exercise))
|
||||
td = link_to(t('shared.statistics'), statistics_exercise_path(exercise))
|
||||
|
||||
p = render('shared/new_button', model: Exercise)
|
3
app/views/exercises/new.html.slim
Normal file
3
app/views/exercises/new.html.slim
Normal file
@@ -0,0 +1,3 @@
|
||||
h1 = t('shared.new_model', model: Exercise.model_name.human)
|
||||
|
||||
= render('form')
|
28
app/views/exercises/show.html.slim
Normal file
28
app/views/exercises/show.html.slim
Normal file
@@ -0,0 +1,28 @@
|
||||
- content_for :head do
|
||||
= javascript_include_tag('http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js')
|
||||
= stylesheet_link_tag('http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css')
|
||||
|
||||
h1
|
||||
= @exercise
|
||||
= render('shared/edit_button', object: @exercise)
|
||||
|
||||
= row(label: 'exercise.title', value: @exercise.title)
|
||||
= row(label: 'exercise.user', value: link_to(@exercise.author, @exercise.author))
|
||||
= row(label: 'exercise.description', value: @exercise.description)
|
||||
= row(label: 'exercise.execution_environment', value: link_to(@exercise.execution_environment, @exercise.execution_environment))
|
||||
= row(label: 'exercise.instructions', value: render_markdown(@exercise.instructions))
|
||||
= row(label: 'exercise.maximum_score', value: @exercise.maximum_score)
|
||||
= row(label: 'exercise.public', value: @exercise.public?)
|
||||
= row(label: 'exercise.embedding_parameters') do
|
||||
= content_tag(:input, nil, class: 'form-control', readonly: true, value: embedding_parameters(@exercise))
|
||||
|
||||
h2 = t('activerecord.attributes.exercise.files')
|
||||
|
||||
ul.list-unstyled
|
||||
- @exercise.files.each do |file|
|
||||
li.panel.panel-default
|
||||
.panel-heading
|
||||
h3.panel-title = file.name_with_extension
|
||||
.panel-body
|
||||
.clearfix = link_to(t('shared.destroy'), file, class:'btn btn-warning btn-sm pull-right', data: {confirm: t('shared.confirm_destroy')}, method: :delete)
|
||||
= render('shared/file', file: file)
|
3
app/views/exercises/show.json.jbuilder
Normal file
3
app/views/exercises/show.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.set! :files do
|
||||
json.array! @exercise.files.visible, :content, :id
|
||||
end
|
9
app/views/exercises/statistics.html.slim
Normal file
9
app/views/exercises/statistics.html.slim
Normal file
@@ -0,0 +1,9 @@
|
||||
h1 = @exercise
|
||||
|
||||
= row(label: '.participants', value: @exercise.users.count)
|
||||
- [:intermediate, :final].each do |scope|
|
||||
= row(label: ".#{scope}_submissions") do
|
||||
= "#{@exercise.submissions.send(scope).count} (#{t('.users', count: @exercise.submissions.send(scope).distinct.count(:user_id, :user_type))})"
|
||||
= row(label: '.average_score') do
|
||||
p == @exercise.average_score ? t('shared.out_of', maximum_value: @exercise.maximum_score, value: @exercise.average_score) : empty
|
||||
p = progress_bar(@exercise.average_percentage)
|
Reference in New Issue
Block a user