option to hide the file tree in exercises.

This commit is contained in:
Ralf Teusner
2015-09-22 18:22:25 +02:00
parent 4e35579a7d
commit 10da12f950
8 changed files with 16 additions and 11 deletions

View File

@ -62,7 +62,7 @@ class ExercisesController < ApplicationController
end
def exercise_params
params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :team_id, :title, files_attributes: file_attributes).merge(user_id: current_user.id, user_type: current_user.class.name)
params[:exercise].permit(:description, :execution_environment_id, :file_id, :instructions, :public, :hide_file_tree, :team_id, :title, files_attributes: file_attributes).merge(user_id: current_user.id, user_type: current_user.class.name)
end
private :exercise_params

View File

@ -1,6 +1,6 @@
#editor.row data-exercise-id=exercise.id data-message-depleted=t('exercises.editor.depleted') 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 data-user-id=@current_user.id
.col-sm-3 = render('editor_file_tree', files: @files)
#frames.col-sm-9
div class=(@exercise.hide_file_tree ? 'hidden col-sm-3' : 'col-sm-3') = render('editor_file_tree', files: @files)
div id='frames' class=(@exercise.hide_file_tree ? 'col-sm-12' : 'col-sm-9')
- @files.each do |file|
= render('editor_frame', exercise: exercise, file: file)
#autosave-label

View File

@ -23,6 +23,10 @@
label
= f.check_box(:public)
= t('activerecord.attributes.exercise.public')
.checkbox
label
= f.check_box(:hide_file_tree)
= t('activerecord.attributes.exercise.hide_file_tree')
h2 = t('activerecord.attributes.exercise.files')
ul#files.list-unstyled
= f.fields_for :files do |files_form|

View File

@ -13,19 +13,15 @@
#development-environment
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')
a data-placement='top' data-toggle='tab' data-tooltip=true href='#workspace' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 1')
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')
a data-placement='top' data-toggle='tab' data-tooltip=true href='#outputInformation' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 2')
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')
a data-placement='top' data-toggle='tab' data-tooltip=true href='#progress' role='tab' title=t('shared.tooltips.shortcut', shortcut: 'ALT + 3')
i.fa.fa-line-chart
= t('.progress')
@ -46,6 +42,7 @@
.panel-heading = t('.hint')
.panel-body
.row
/ #output-col1.col-sm-12
#output-col1
// todo set to full width if turtle isnt used
#prompt.input-group.hidden

View File

@ -14,6 +14,7 @@ h1
= row(label: 'exercise.team', value: @exercise.team ? link_to(@exercise.team, @exercise.team) : nil)
= row(label: 'exercise.maximum_score', value: @exercise.maximum_score)
= row(label: 'exercise.public', value: @exercise.public?)
= row(label: 'exercise.hide_file_tree', value: @exercise.hide_file_tree?)
= row(label: 'exercise.embedding_parameters') do
= content_tag(:input, nil, class: 'form-control', readonly: true, value: embedding_parameters(@exercise))

View File

@ -28,6 +28,7 @@ de:
execution_environment: Ausführungsumgebung
execution_environment_id: Ausführungsumgebung
files: Dateien
hide_file_tree: Dateibaum verstecken
instructions: Anweisungen
maximum_score: Erreichbare Punktzahl
public: Öffentlich

View File

@ -28,6 +28,7 @@ en:
execution_environment: Execution Environment
execution_environment_id: Execution Environment
files: Files
hide_file_tree: Hide File Tree
instructions: Instructions
maximum_score: Maximum Score
public: Public

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150903152727) do
ActiveRecord::Schema.define(version: 20150922125415) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -79,6 +79,7 @@ ActiveRecord::Schema.define(version: 20150903152727) do
t.string "user_type"
t.string "token"
t.integer "team_id"
t.boolean "hide_file_tree"
end
create_table "external_users", force: true do |t|