transferred Code Ocean from original repository to GitHub

This commit is contained in:
Hauke Klement
2015-01-22 09:51:49 +01:00
commit 4cbf9970b1
683 changed files with 11979 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
- if current_user.try(:internal?)
ul.breadcrumb
- if model = Kernel.const_get(controller_name.classify) rescue nil
- object = model.find_by(id: params[:id])
- if model.try(:nested_resource?)
li = model.model_name.human(count: 2)
- if object
li = object
- else
li = link_to(model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))
- if object
li = link_to(object, send(:"#{model.model_name.singular}_path", object))
li.active
- if translation_present?("shared.#{params[:action]}")
= t("shared.#{params[:action]}")
- else
= t("#{controller_name}.index.#{params[:action]}")
- else
li.active = t("breadcrumbs.#{params[:action]}")

View File

@@ -0,0 +1,3 @@
#flash data-message-failure=t('shared.message_failure')
- %w[danger info notice success warning].each do |severity|
p.alert.flash class="alert-#{severity == 'notice' ? 'success' : severity}" id="flash-#{severity}" = flash[severity]

View File

@@ -0,0 +1,7 @@
li.dropdown
a.dropdown-toggle data-toggle='dropdown' href='#'
= t("locales.#{I18n.locale}")
span.caret
ul.dropdown-menu role='menu'
- I18n.available_locales.sort_by { |locale| t("locales.#{locale}") }.each do |locale|
li = link_to(t("locales.#{locale}"), url_for(params.merge(locale: locale)))

View File

@@ -0,0 +1,11 @@
- if current_user.try(:internal?)
ul.nav.navbar-nav
li.dropdown
a.dropdown-toggle data-toggle='dropdown' href='#'
= t('shared.administration')
span.caret
ul.dropdown-menu role='menu'
- models = [ExecutionEnvironment, Exercise, Consumer, ExternalUser, FileType, InternalUser, Submission].sort_by { |model| model.model_name.human(count: 2) }
- models.each do |model|
- if policy(model).index?
li = link_to(model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"))

View File

@@ -0,0 +1,20 @@
- if current_user
- if current_user.internal?
li.dropdown
a.dropdown-toggle data-toggle='dropdown' href='#'
i.glyphicon.glyphicon-user
= current_user
span.caret
ul.dropdown-menu role='menu'
li = link_to(t('consumers.show.link'), current_user.consumer) if current_user.consumer
li = link_to(t('internal_users.show.link'), current_user)
li = link_to(t('sessions.destroy.link'), sign_out_path, method: :delete)
- else
li
p.navbar-text
i.glyphicon.glyphicon-user
= current_user
- else
li = link_to(sign_in_path) do
i.fa.fa-sign-in
= t('sessions.new.link')

View File

@@ -0,0 +1,9 @@
- unless local_assigns[:modal]
h1 = t('shared.help.headline')
h2 = t('shared.help.general_help')
== Forgery(:lorem_ipsum).paragraphs(10, html: true)
- if local_assigns.has_key?(:execution_environment)
h2 = t('shared.help.execution_environment_specific_help', execution_environment: execution_environment)
= render_markdown(execution_environment.help)

View File

@@ -0,0 +1,3 @@
h1 = t('breadcrumbs.welcome')
p = Forgery(:lorem_ipsum).words(100)

View File

@@ -0,0 +1,9 @@
= form_for(CodeOcean::File.new) do |f|
.form-group
= f.label(:name, t('activerecord.attributes.file.name'))
= f.text_field(:name, class: 'form-control', required: true)
.form-group
= f.label(:file_type_id, t('activerecord.attributes.file.file_type_id'))
= f.collection_select(:file_type_id, FileType.where(binary: false), :id, :name, {}, class: 'form-control')
= f.hidden_field(:context_id)
.actions = render('shared/submit_button', f: f, object: CodeOcean::File.new)

View File

@@ -0,0 +1 @@
json.extract! @file, :id, :name_with_extension

View File

@@ -0,0 +1,12 @@
= form_for(@consumer, multipart: true) do |f|
= render('shared/form_errors', object: @consumer)
.form-group
= f.label(:name)
= f.text_field(:name, class: 'form-control', required: true)
.form-group
= f.label(:oauth_key)
= f.text_field(:oauth_key, class: 'form-control', required: true)
.form-group
= f.label(:oauth_secret)
= f.text_field(:oauth_secret, class: 'form-control', required: true)
.actions = render('shared/submit_button', f: f, object: @consumer)

View File

@@ -0,0 +1,3 @@
h1 = @consumer
= render('form')

View File

@@ -0,0 +1,17 @@
h1 = Consumer.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.consumer.name')
th colspan=3 = t('shared.actions')
tbody
- @consumers.each do |consumer|
tr
td = consumer.name
td = link_to(t('shared.show'), consumer)
td = link_to(t('shared.edit'), edit_consumer_path(consumer))
td = link_to(t('shared.destroy'), consumer, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
p = render('shared/new_button', model: Consumer)

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: Consumer.model_name.human)
= render('form')

View File

@@ -0,0 +1,8 @@
h1
= @consumer
= render('shared/edit_button', object: @consumer) if policy(@consumer).edit?
= row(label: 'consumer.name', value: @consumer.name)
- %w[oauth_key oauth_secret].each do |attribute|
= row(label: "consumer.#{attribute}") do
= content_tag(:input, nil, class: 'form-control', readonly: true, value: @consumer.send(attribute))

View File

@@ -0,0 +1,17 @@
h1 = ::Error.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('.count')
th = t('activerecord.attributes.error.message')
th = t('shared.created_at')
th = t('shared.actions')
tbody
- @errors.each do |error|
tr
td = error.count
td = error.message
td = l(error.created_at, format: :short)
td = link_to(t('shared.show'), execution_environment_error_path(params[:execution_environment_id], error))

View File

@@ -0,0 +1,4 @@
h1 = ::Error.model_name.human
= row(label: 'error.message', value: @error.message)
= row(label: 'shared.created_at', value: l(@error.created_at, format: :short))

View File

@@ -0,0 +1,35 @@
= form_for(@execution_environment) do |f|
= render('shared/form_errors', object: @execution_environment)
.form-group
= f.label(:name)
= f.text_field(:name, class: 'form-control', required: true)
.form-group
= f.label(:docker_image)
|  
a.toggle-input href='#' = t('shared.new')
= f.select(:docker_image, @docker_images, {}, class: 'form-control')
= f.text_field(:docker_image, class: 'alternative-input form-control', disabled: true)
.help-block == t('.hints.docker_image')
.form-group
= f.label(:exposed_ports)
= f.text_field(:exposed_ports, class: 'form-control', placeholder: '3000, 4000')
.help-block == t('.hints.exposed_ports')
.form-group
= f.label(:permitted_execution_time)
= f.number_field(:permitted_execution_time, class: 'form-control', min: 1)
.form-group
= f.label(:run_command)
= f.text_field(:run_command, class: 'form-control', placeholder: 'command %{filename}', required: true)
.help-block == t('.hints.command')
.form-group
= f.label(:test_command)
= f.text_field(:test_command, class: 'form-control', placeholder: 'command %{filename}')
.help-block == t('.hints.command')
.form-group
= f.label(:testing_framework)
= f.select(:testing_framework, @testing_framework_adapters, {include_blank: true}, class: 'form-control')
.form-group
= f.label(:help)
= f.hidden_field(:help)
.form-control.markdown
.actions = render('shared/submit_button', f: f, object: @execution_environment)

View File

@@ -0,0 +1,3 @@
h1 = @execution_environment
= render('form')

View File

@@ -0,0 +1,23 @@
h1 = ExecutionEnvironment.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.execution_environment.name')
th = t('activerecord.attributes.execution_environment.user')
th colspan=4 = t('shared.actions')
th colspan=2 = t('shared.resources')
tbody
- @execution_environments.each do |execution_environment|
tr
td = execution_environment.name
td = link_to(execution_environment.author, execution_environment.author)
td = link_to(t('shared.show'), execution_environment)
td = link_to(t('shared.edit'), edit_execution_environment_path(execution_environment))
td = link_to(t('shared.destroy'), execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
td = link_to(t('.shell'), shell_execution_environment_path(execution_environment))
td = link_to(t('activerecord.models.error.other'), execution_environment_errors_path(execution_environment.id))
td = link_to(t('activerecord.models.hint.other'), execution_environment_hints_path(execution_environment.id))
p = render('shared/new_button', model: ExecutionEnvironment)

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: ExecutionEnvironment.model_name.human)
= render('form')

View File

@@ -0,0 +1,8 @@
h1 = @execution_environment
#shell data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @execution_environment.permitted_execution_time) data-url=execute_command_execution_environment_path(@execution_environment)
.form-group
label for='command' = t('.command')
input#command.form-control type='text'
pre#output data-message-no-output=t('exercises.implement.no_output')
p = t('exercises.implement.no_output_yet')

View File

@@ -0,0 +1,10 @@
h1
= @execution_environment
= render('shared/edit_button', object: @execution_environment)
= row(label: 'execution_environment.name', value: @execution_environment.name)
= row(label: 'execution_environment.user', value: link_to(@execution_environment.author, @execution_environment.author))
- [:docker_image, :exposed_ports, :permitted_execution_time, :run_command, :test_command].each do |attribute|
= row(label: "execution_environment.#{attribute}", value: @execution_environment.send(attribute))
= row(label: 'execution_environment.testing_framework', value: @testing_framework_adapter.try(:framework_name))
= row(label: 'execution_environment.help', value: render_markdown(@execution_environment.help))

View 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)

View 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'))

View 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

View 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'))

View 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

View 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'))

View 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)

View File

@@ -0,0 +1,3 @@
h1 = @exercise
= render('form')

View 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'))

View 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)

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: Exercise.model_name.human)
= render('form')

View 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)

View File

@@ -0,0 +1,3 @@
json.set! :files do
json.array! @exercise.files.visible, :content, :id
end

View 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)

View File

@@ -0,0 +1,15 @@
h1 = ExternalUser.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.external_user.name')
th = t('activerecord.attributes.external_user.consumer')
th = t('shared.actions')
tbody
- @users.each do |user|
tr
td = user.name
td = link_to(user.consumer, user.consumer)
td = link_to(t('shared.show'), user)

View File

@@ -0,0 +1,5 @@
h1 = @user.name
= row(label: 'external_user.name', value: @user.name)
= row(label: 'external_user.email', value: @user.email)
= row(label: 'external_user.consumer', value: link_to(@user.consumer, @user.consumer))

View File

@@ -0,0 +1,27 @@
= form_for(@file_type) do |f|
= render('shared/form_errors', object: @file_type)
.form-group
= f.label(:name)
= f.text_field(:name, class: 'form-control', required: true)
.form-group
= f.label(:editor_mode)
= f.select(:editor_mode, @editor_modes, {}, class: 'form-control')
.form-group
= f.label(:file_extension)
= f.text_field(:file_extension, class: 'form-control', placeholder: '.rb')
.form-group
= f.label(:indent_size)
= f.number_field(:indent_size, class: 'form-control', placeholder: 2, required: true)
.checkbox
label
= f.check_box(:binary)
= t('activerecord.attributes.file_type.binary')
.checkbox
label
= f.check_box(:executable)
= t('activerecord.attributes.file_type.executable')
.checkbox
label
= f.check_box(:renderable)
= t('activerecord.attributes.file_type.renderable')
.actions = render('shared/submit_button', f: f, object: @file_type)

View File

@@ -0,0 +1,3 @@
h1 = @file_type
= render('form')

View File

@@ -0,0 +1,21 @@
h1 = FileType.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.file_type.name')
th = t('activerecord.attributes.file_type.user')
th = t('activerecord.attributes.file_type.file_extension')
th colspan=3 = t('shared.actions')
tbody
- @file_types.each do |file_type|
tr
td = file_type.name
td = link_to(file_type.author, file_type.author)
td = file_type.file_extension
td = link_to(t('shared.show'), file_type)
td = link_to(t('shared.edit'), edit_file_type_path(file_type))
td = link_to(t('shared.destroy'), file_type, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
p = render('shared/new_button', model: FileType)

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: FileType.model_name.human)
= render('form')

View File

@@ -0,0 +1,8 @@
h1
= @file_type
= render('shared/edit_button', object: @file_type)
= row(label: 'file_type.name', value: @file_type.name)
= row(label: 'file_type.user', value: link_to(@file_type.author, @file_type.author))
- [:editor_mode, :file_extension, :indent_size, :binary, :executable, :renderable].each do |attribute|
= row(label: "file_type.#{attribute}", value: @file_type.send(attribute))

View File

@@ -0,0 +1,17 @@
= form_for(@hint, multipart: true, url: execution_environment_hints_path(params[:execution_environment_id])) do |f|
= render('shared/form_errors', object: @hint)
.form-group
= f.label(:name)
= f.text_field(:name, class: 'form-control', required: true)
.form
= f.label(:locale)
= f.select(:locale, I18n.available_locales.map { |locale| [t("locales.#{locale}"), locale] }, {}, class: 'form-control')
.form-group
= f.label(:message)
= f.text_field(:message, class: 'form-control', placeholder: "'$2' has no method '$1'.", required: true)
.help-block = t('.hints.message')
.form-group
= f.label(:regular_expression)
= f.text_field(:regular_expression, class: 'form-control', placeholder: 'undefined method (\w+) for (\w+)', required: true)
.help-block = t('.hints.regular_expression')
.actions = render('shared/submit_button', f: f, object: @hint)

View File

@@ -0,0 +1,3 @@
h1 = @hint
= render('form')

View File

@@ -0,0 +1,19 @@
h1 = Hint.model_name.human(count: 2)
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.hint.name')
th = t('activerecord.attributes.hint.locale')
th colspan=3 = t('shared.actions')
tbody
- @hints.each do |hint|
tr
td = hint.name
td = t("locales.#{hint.locale}")
td = link_to(t('shared.show'), execution_environment_hint_path(params[:execution_environment_id], hint.id))
td = link_to(t('shared.edit'), edit_execution_environment_hint_path(params[:execution_environment_id], hint.id))
td = link_to(t('shared.destroy'), execution_environment_hint_path(params[:execution_environment_id], hint.id), data: {confirm: t('shared.confirm_destroy')}, method: :delete)
p = render('shared/new_button', model: Hint, path: new_execution_environment_hint_path(params[:execution_environment_id]))

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: Hint.model_name.human)
= render('form')

View File

@@ -0,0 +1,8 @@
h1
= @hint
= render('shared/edit_button', object: @hint, path: edit_execution_environment_hint_path(params[:execution_environment_id], @hint.id))
= row(label: 'hint.name', value: @hint.name)
= row(label: 'hint.locale', value: t("locales.#{@hint.locale}"))
= row(label: 'hint.message', value: @hint.message)
= row(label: 'hint.regular_expression', value: code_tag(@hint.regular_expression))

View File

@@ -0,0 +1,15 @@
= form_for(@user) do |f|
= render('shared/form_errors', object: @user)
.form-group
= f.label(:consumer_id)
= f.collection_select(:consumer_id, Consumer.all.sort_by(&:name), :id, :name, {}, class: 'form-control')
.form-group
= f.label(:email)
= f.text_field(:email, class: 'form-control', required: true)
.form-group
= f.label(:name)
= f.text_field(:name, class: 'form-control', required: true)
.form-group
= f.label(:role)
= f.select(:role, User::ROLES.map { |role| [t("users.roles.#{role}"), role] }, {}, class: 'form-control')
.actions = render('shared/submit_button', f: f, object: @user)

View File

@@ -0,0 +1,12 @@
h1 = t('.headline')
= form_for(@user, url: activate_internal_user_path) do |f|
= render('shared/form_errors', object: @user)
.form-group
= f.label(:password)
= f.password_field(:password, class: 'form-control', required: true)
.form-group
= f.label(:password_confirmation)
= f.password_field(:password_confirmation, class: 'form-control', required: true)
= f.hidden_field(:activation_token)
.actions = submit_tag(t('.submit'), class: 'btn btn-default')

View File

@@ -0,0 +1,3 @@
h1 = @user
= render('form')

View File

@@ -0,0 +1,7 @@
h1 = t('.headline')
= form_tag do
.form-group
= label_tag(:email, t('activerecord.attributes.internal_user.email'))
= text_field_tag(:email, params[:email], autofocus: true, class: 'form-control', required: true)
.actions = submit_tag(t('.submit'), class: 'btn btn-default')

View File

@@ -0,0 +1,34 @@
h1 = InternalUser.model_name.human(count: 2)
= render(layout: 'shared/form_filters') do |f|
.form-group
= f.label(:consumer_id_eq, t('activerecord.attributes.internal_user.consumer'), class: 'sr-only')
= f.collection_select(:consumer_id_eq, Consumer.with_users, :id, :name, class: 'form-control', prompt: t('activerecord.attributes.internal_user.consumer'))
.form-group
= f.label(:email_cont, t('activerecord.attributes.internal_user.email'), class: 'sr-only')
= f.search_field(:email_cont, class: 'form-control', placeholder: t('activerecord.attributes.internal_user.email'))
.form-group
= f.label(:role_eq, t('activerecord.attributes.internal_user.role'), class: 'sr-only')
= f.select(:role_eq, User::ROLES.map { |role| [t("users.roles.#{role}"), role] }, {}, class: 'form-control', prompt: t('activerecord.attributes.internal_user.role'))
.table-responsive
table.table
thead
tr
th = t('activerecord.attributes.internal_user.name')
th = t('activerecord.attributes.internal_user.consumer')
th = t('activerecord.attributes.internal_user.role')
th colspan=3 = t('shared.actions')
tbody
- @users.each do |user|
tr
td = user.name
td = user.consumer ? link_to(user.consumer, user.consumer) : empty
td = t("users.roles.#{user.role}")
td = link_to(t('shared.show'), user)
td = link_to(t('shared.edit'), edit_internal_user_path(user))
td
- if policy(user).destroy?
= link_to(t('shared.destroy'), user, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
p = render('shared/new_button', model: InternalUser)

View File

@@ -0,0 +1,3 @@
h1 = t('shared.new_model', model: InternalUser.model_name.human)
= render('form')

View File

@@ -0,0 +1,12 @@
h1 = t('.headline')
= form_for(@user, url: reset_password_internal_user_path) do |f|
= render('shared/form_errors', object: @user)
.form-group
= f.label(:password)
= f.password_field(:password, class: 'form-control', required: true)
.form-group
= f.label(:password_confirmation)
= f.password_field(:password_confirmation, class: 'form-control', required: true)
= f.hidden_field(:reset_password_token)
.actions = submit_tag(t('.submit'), class: 'btn btn-default')

View File

@@ -0,0 +1,10 @@
h1
= @user
- if policy(@user).edit?
= render('shared/edit_button', object: @user)
= row(label: 'internal_user.email', value: @user.email)
= row(label: 'internal_user.name', value: @user.name)
= row(label: 'internal_user.consumer', value: @user.consumer ? link_to(@user.consumer, @user.consumer) : nil)
= row(label: 'internal_user.role', value: t("users.roles.#{@user.role}"))
= row(label: 'internal_user.activated', value: @user.activated?)

View File

@@ -0,0 +1,40 @@
doctype html
html lang='en'
head
meta charset='utf8'
meta name='viewport' content='width=device-width, initial-scale=1'
title = application_name
link href=asset_path('favicon.png') rel='icon' type='image/png'
= stylesheet_link_tag('//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css')
= stylesheet_link_tag('//maxcdn.bootstrapcdn.com/bootswatch/3.3.0/yeti/bootstrap.min.css')
= stylesheet_link_tag('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css')
= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track' => true)
= javascript_include_tag('application', 'data-turbolinks-track' => true)
= javascript_include_tag('//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js')
= javascript_include_tag('//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js')
= yield(:head)
= csrf_meta_tags
body
nav.navbar.navbar-default role='navigation'
.container
.navbar-header
button.navbar-toggle data-target='#navbar-collapse' data-toggle='collapse' type='button'
span.sr-only Toggle navigation
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand href=root_path
i.fa.fa-code
= application_name
#navbar-collapse.collapse.navbar-collapse
= render('navigation')
ul.nav.navbar-nav.navbar-right
= render('locale_selector')
li = link_to(t('shared.help.link'), '#modal-help', data: {toggle: 'modal'})
= render('session')
.container data-controller=controller_name
= render('breadcrumbs')
= render('flash')
= yield
- template_variables = {execution_environment: @exercise.execution_environment} if action_name == 'implement'
= render('shared/modal', classes: 'modal-lg', id: 'modal-help', template: 'application/help', template_variables: template_variables, title: t('shared.help.headline'))

View File

@@ -0,0 +1,15 @@
h1 = t('.headline')
p
== t(".success_#{params[:outcome] ? 'with' : 'without'}_outcome", consumer: @consumer)
==< t(".finished_#{@consumer ? 'with' : 'without'}_consumer", consumer: @consumer, url: params[:url])
h2 = t('shared.statistics')
= row(label: '.score') do
p == t('shared.out_of', maximum_value: @submission.exercise.maximum_score, value: @submission.score)
p = progress_bar(@submission.percentage)
= row(label: '.final_submissions', value: @submission.exercise.submissions.final.distinct.count(:user_id, :user_type) - 1)
= row(label: '.average_score') do
p == t('shared.out_of', maximum_value: @submission.exercise.maximum_score, value: @submission.exercise.average_score)
p = progress_bar(@submission.exercise.average_percentage)

View File

@@ -0,0 +1,15 @@
h1 = t('.headline')
= form_tag(sessions_path) do
.form-group
= label_tag(:email, t('activerecord.attributes.internal_user.email'))
= text_field_tag(:email, params[:email], autofocus: true, class: 'form-control', required: true)
.form-group
= label_tag(:password, t('activerecord.attributes.internal_user.password'))
= password_field_tag(:password, nil, class: 'form-control', required: true)
.checkbox
label
= check_box_tag(:remember_me)
= t('.remember_me')
span.pull-right = link_to(t('.forgot_password'), forgot_password_path)
.actions = submit_tag(t('.link'), class: 'btn btn-default')

View File

@@ -0,0 +1 @@
= link_to(t('shared.edit'), local_assigns.has_key?(:path) ? path : send(:"edit_#{object.class.name.underscore}_path", object), class: 'btn btn-default pull-right')

View File

@@ -0,0 +1,10 @@
= row(label: 'file.name', value: file.name)
= row(label: 'file.path', value: file.path)
= row(label: 'file.file_type', value: link_to(file.file_type, file.file_type))
= row(label: 'file.role', value: file.role? ? t("files.roles.#{file.role}") : '')
= row(label: 'file.hidden', value: file.hidden)
= row(label: 'file.read_only', value: file.read_only)
- if file.teacher_defined_test?
= row(label: 'file.feedback_message', value: file.feedback_message)
= row(label: 'file.weight', value: file.weight)
= row(label: 'file.content', value: file.native_file? ? link_to(file.native_file.file.filename, file.native_file.url) : code_tag(file.content))

View File

@@ -0,0 +1,6 @@
- if object.errors.any?
#error_explanation.alert.alert-warning
h4 = "#{t("shared.errors_#{object.errors.count == 1 ? 'one' : 'other'}", count: object.errors.count, model: object.class.model_name.human)}:"
ul
- object.errors.full_messages.each do |message|
li = message

View File

@@ -0,0 +1,11 @@
.well
= search_form_for(@search, class: 'clearfix filter-form form-inline') do |f|
= yield(f)
.btn-group.pull-right
button.btn.btn-default.btn-sm type='submit' = t('shared.apply_filters')
button.btn.btn-default.btn-sm.dropdown-toggle data-toggle='dropdown' type='button'
span.caret
span.sr-only Toggle Dropdown
ul.dropdown-menu role='menu'
li
a href=request.path = t('shared.reset_filters')

View File

@@ -0,0 +1,14 @@
.fade.modal aria-hidden=true aria-labelledby='modal-title' id=id role='dialog' tabindex=-1
.modal-dialog class=local_assigns[:classes]
.modal-content
.modal-header
button.close data-dismiss='modal' type='button'
span aria-hidden=true &times;
span.sr-only Close
h4#modal-title.modal-title = title
.modal-body
- if local_assigns.has_key?(:body)
= body
- else
= render(layout: false, locals: (local_assigns[:template_variables] || {}).merge(modal: true), template: template)
.modal-footer

View File

@@ -0,0 +1,4 @@
- if policy(model).new?
a.btn.btn-success href=(local_assigns.has_key?(:path) ? path : send(:"new_#{model.model_name.singular}_path"))
i.glyphicon.glyphicon-plus
= t('shared.new_model', model: model.model_name.human)

View File

@@ -0,0 +1 @@
= f.submit(class: 'btn btn-default', value: t(object.new_record? ? 'shared.create' : 'shared.update', model: object.class.model_name.human))

View File

@@ -0,0 +1,33 @@
h1 = Submission.model_name.human(count: 2)
= render(layout: 'shared/form_filters') do |f|
.form-group
= f.label(:exercise_id_eq, t('activerecord.attributes.submission.exercise'), class: 'sr-only')
= f.collection_select(:exercise_id_eq, Exercise.with_submissions, :id, :title, class: 'form-control', prompt: t('activerecord.attributes.submission.exercise'))
.form-group
= f.label(:cause_eq, t('activerecord.attributes.submission.cause'), class: 'sr-only')
= f.select(:cause_eq, Submission.all.map(&:cause).uniq.sort, class: 'form-control', prompt: t('activerecord.attributes.submission.cause'))
.table-responsive
table.table
thead
tr
th = sort_link(@search, :exercise_id, t('activerecord.attributes.submission.exercise'))
th = sort_link(@search, :user_id, t('activerecord.attributes.submission.user'))
th = sort_link(@search, :cause, t('activerecord.attributes.submission.cause'))
th = sort_link(@search, :score, t('activerecord.attributes.submission.score'))
th = sort_link(@search, :created_at, t('shared.created_at'))
th colspan=2 = t('shared.actions')
tbody
- @submissions.each do |submission|
tr
td = link_to(submission.exercise, submission.exercise)
td = link_to(submission.user, submission.user)
td = t("submissions.causes.#{submission.cause}")
td = submission.score
td = l(submission.created_at, format: :short)
td = link_to(t('shared.show'), submission)
td = link_to(t('shared.statistics'), statistics_submission_path(submission))
.text-center
ul.pagination = will_paginate(@submissions, container: false)

View File

@@ -0,0 +1,13 @@
h1 = @submission
= row(label: 'submission.exercise', value: link_to(@submission.exercise, @submission.exercise))
= row(label: 'submission.user', value: link_to(@submission.user, @submission.user))
= row(label: 'submission.cause', value: t("submissions.causes.#{@submission.cause}"))
= row(label: 'submission.score', value: @submission.score)
h2 = t('activerecord.attributes.submission.files')
ul.list-unstyled
- @files.each do |file|
li.panel.panel-default
.panel-body = render('shared/file', file: file)

View File

@@ -0,0 +1 @@
json.extract! @submission, :download_url, :id, :score_url, :render_url, :run_url, :stop_url, :test_url

View File

@@ -0,0 +1,26 @@
h1 = @submission
= row(label: 'submission.exercise', value: link_to(@submission.exercise, @submission.exercise))
= row(label: 'submission.score', value: @submission.score)
= row(label: '.siblings', value: @submission.siblings.count)
h2 = t('.history')
.table-responsive
table.table
thead
tr
th = t('shared.number')
th = t('shared.created_at')
th = t('activerecord.attributes.submission.score')
th = t('.percentage')
th = t('shared.actions')
tbody
- @submission.siblings.order(:created_at).each_with_index do |submission, index|
- if submission.score?
tr
td = index + 1
td = l(submission.created_at, format: :short)
td = submission.score
td = progress_bar(submission.percentage)
td = link_to(t('shared.show'), submission)

View File

@@ -0,0 +1 @@
== t('mailers.user_mailer.activation_needed.body', link: link_to(@activation_url, @activation_url))

View File

@@ -0,0 +1 @@
== t('mailers.user_mailer.reset_password.body', link: link_to(@reset_password_url, @reset_password_url))