diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 3aa5a2f9..336def3b 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -14,6 +14,8 @@ var CodeOceanEditor = { REMEMBER_TAB: false, AUTOSAVE_INTERVAL: 15 * 1000, REQUEST_FOR_COMMENTS_DELAY: 3 * 60 * 1000, + REQUEST_TOOLTIP_TIME: 5000, + NONE: 0, WEBSOCKET: 1, SERVER_SEND_EVENT: 2, @@ -328,7 +330,7 @@ var CodeOceanEditor = { initializeRequestForComments: function () { var button = $('#requestComments'); - button.hide(); + button.prop('disabled', true); button.on('click', function () { $('#comment-modal').modal('show'); }); @@ -336,8 +338,12 @@ var CodeOceanEditor = { $('#askForCommentsButton').on('click', this.requestComments); setTimeout(function () { - button.fadeIn(); - }, this.REQUEST_FOR_COMMENTS_DELAY); + button.prop('disabled', false); + button.tooltip('show'); + setTimeout(function() { + button.tooltip('hide'); + }, this.REQUEST_TOOLTIP_TIME); + }.bind(this), this.REQUEST_FOR_COMMENTS_DELAY); }, isActiveFileRenderable: function () { diff --git a/app/assets/javascripts/editor/flowr.js.erb b/app/assets/javascripts/editor/flowr.js.erb index 30b4b298..d8d19e91 100644 --- a/app/assets/javascripts/editor/flowr.js.erb +++ b/app/assets/javascripts/editor/flowr.js.erb @@ -59,8 +59,8 @@ CodeOceanEditorFlowr = { this.createSubmission($('.requestCommentsButton'), null, createRequestForComments.bind(this)); $('#comment-modal').modal('hide'); - var button = $('.requestCommentsButton'); - button.fadeOut(); + var button = $('#requestComments'); + button.prop('disabled', true); }, //tODO move codepilot out of here. diff --git a/app/assets/stylesheets/editor.css.scss b/app/assets/stylesheets/editor.css.scss index be607e29..79a1797b 100644 --- a/app/assets/stylesheets/editor.css.scss +++ b/app/assets/stylesheets/editor.css.scss @@ -91,12 +91,12 @@ button i.fa-spin { font-size: 0.8em; } -.requestCommentsButton { +/* .requestCommentsButton { position: relative; margin-top: -50px; margin-right: 25px; float: right; -} +} */ .sidebar-col-collapsed { -webkit-transition: width 2s; diff --git a/app/views/exercises/_editor.html.slim b/app/views/exercises/_editor.html.slim index ed338d14..488ebe17 100644 --- a/app/views/exercises/_editor.html.slim +++ b/app/views/exercises/_editor.html.slim @@ -10,35 +10,13 @@ #editor-buttons.btn-group // = 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')) button style="display:none" id="autosave" - .btn-group - = render('editor_button', disabled: true, icon: 'fa fa-ban', id: 'dummy', label: t('exercises.editor.dummy')) - = 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-network' => t('exercises.editor.network'), :'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')) - button.btn.btn-primary.requestCommentsButton type='button' id="requestComments" - i.fa.fa-comment - = t('exercises.editor.requestComments') + // .btn-group + = render('editor_button', disabled: true, icon: 'fa fa-ban', id: 'dummy', label: t('exercises.editor.dummy')) + = 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-network' => t('exercises.editor.network'), :'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')) + = 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')) + = render('editor_button', icon: 'fa fa-comment', id: 'requestComments', label: t('exercises.editor.requestComments'), title: t('exercises.editor.requestCommentsTooltip')) = render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.request'), template: 'exercises/_request_comment_dialogcontent') diff --git a/app/views/exercises/_editor_file_tree.html.slim b/app/views/exercises/_editor_file_tree.html.slim index 64250ad7..c783ecec 100644 --- a/app/views/exercises/_editor_file_tree.html.slim +++ b/app/views/exercises/_editor_file_tree.html.slim @@ -1,5 +1,5 @@ div id='sidebar-collapsed' - = render('editor_button', classes: 'btn-block btn-primary btn-sm', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-plus-square', id: 'sidebar-collapse-collapsed', label:'', title:'Expand sidebar') + = render('editor_button', classes: 'btn-block btn-primary btn-sm', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-plus-square', id: 'sidebar-collapse-collapsed', label:'', title:t('exercises.editor.expand_sidebar')) - if @exercise.allow_file_creation? = render('editor_button', classes: 'btn-block btn-primary btn-sm enforce-top-margin', data: {:'data-cause' => 'file', :'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-plus', id: 'create-file-collapsed', label:'', title: t('exercises.editor.create_file')) @@ -8,7 +8,7 @@ div id='sidebar-collapsed' = render('editor_button', classes: 'btn-block btn-primary btn-sm enforce-top-margin', data: {:'data-message-confirm' => t('exercises.editor.confirm_start_over'), :'data-url' => reload_exercise_path(@exercise), :'data-toggle' => 'tooltip', :'data-placement' => 'right'}, icon: 'fa fa-history', id: 'start-over-collapsed', label:'', title: t('exercises.editor.start_over')) div id='sidebar-uncollapsed' - = render('editor_button', classes: 'btn-block btn-primary btn-sm enforce-top-margin', icon: 'fa fa-minus-square', id: 'sidebar-collapse', label: 'Collapse') + = render('editor_button', classes: 'btn-block btn-primary btn-sm enforce-top-margin', icon: 'fa fa-minus-square', id: 'sidebar-collapse', label: t('exercises.editor.collapse_sidebar')) hr diff --git a/app/views/exercises/_editor_output.html.slim b/app/views/exercises/_editor_output.html.slim index 2f32432f..d7deabd8 100644 --- a/app/views/exercises/_editor_output.html.slim +++ b/app/views/exercises/_editor_output.html.slim @@ -1,8 +1,8 @@ div id='output_sidebar_collapsed' - = render('editor_button', classes: 'btn-block btn-primary btn-sm', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'left'}, title: 'Expand sidebar', icon: 'fa fa-plus-square', id: 'toggle-sidebar-output-collapsed', label: '') + = render('editor_button', classes: 'btn-block btn-primary btn-sm', data: {:'data-toggle' => 'tooltip', :'data-placement' => 'left'}, title: t('exercises.editor.expand_sidebar'), icon: 'fa fa-plus-square', id: 'toggle-sidebar-output-collapsed', label: '') div id='output_sidebar_uncollapsed' class='hidden col-sm-12' data-message-no-output=t('exercises.implement.no_output') .row - = render('editor_button', classes: 'btn-block btn-primary btn-sm', icon: 'fa fa-minus-square', id: 'toggle-sidebar-output', label: 'Collapse') + = render('editor_button', classes: 'btn-block btn-primary btn-sm', icon: 'fa fa-minus-square', id: 'toggle-sidebar-output', label: t('exercises.editor.collapse_sidebar')) hr div #hint diff --git a/config/locales/en.yml b/config/locales/en.yml index eaf88018..85266025 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -203,6 +203,9 @@ en: run_failure: Your code could not be run. run_success: Your code was run on our servers. requestComments: Request comments + requestCommentsTooltip: If you need help with your code, you can now request comments here! + collapse_sidebar: Collapse sidebar + expand_sidebar: Expand sidebar save: Save score: Score send: Send