From 5b50deb70dc341592764f22fe047313e61a35ea5 Mon Sep 17 00:00:00 2001 From: Thomas Hille Date: Wed, 1 Mar 2017 11:58:16 +0100 Subject: [PATCH] split intervention modal into 2 separate modals --- app/assets/javascripts/editor/editor.js.erb | 6 ++---- app/views/exercises/_editor.html.slim | 3 ++- .../interventions/_break_intervention_modal.html.slim | 11 +++++++++++ ...html.slim => _search_intervention_modal.html.slim} | 0 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 app/views/interventions/_break_intervention_modal.html.slim rename app/views/interventions/{_intervention_modal.html.slim => _search_intervention_modal.html.slim} (100%) diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 57e94263..f61fa406 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -606,8 +606,7 @@ configureEditors: function () { } setTimeout(function() { - $('#intervention-text').text(`Willst du eine Pause machen? 75th percentile: ${percentile75} and accumulated time: ${accumulatedWorkTimeUser}`); - $('#intervention-modal').modal('show'); + $('#break-intervention-modal').modal('show'); $.ajax({ data: { intervention_type: 'BreakIntervention' @@ -618,8 +617,7 @@ configureEditors: function () { }, timeUntilBreak); setTimeout(function() { - $('#intervention-text').html("Möchtest du eine Frage stellen?"); - $('#intervention-modal').modal('show'); + $('#search-intervention-modal').modal('show'); $.ajax({ data: { intervention_type: 'QuestionIntervention' diff --git a/app/views/exercises/_editor.html.slim b/app/views/exercises/_editor.html.slim index bae90a13..8b4b2c86 100644 --- a/app/views/exercises/_editor.html.slim +++ b/app/views/exercises/_editor.html.slim @@ -23,4 +23,5 @@ = render('shared/modal', id: 'comment-modal', title: t('exercises.implement.comment.request'), template: 'exercises/_request_comment_dialogcontent') -= render('shared/modal', id: 'intervention-modal', title: 'Hinweis', template: 'interventions/_intervention_modal') \ No newline at end of file += render('shared/modal', id: 'break-intervention-modal', title: 'Hinweis', template: 'interventions/_break_intervention_modal') += render('shared/modal', id: 'search-intervention-modal', title: 'Search', template: 'interventions/_search_intervention_modal') \ No newline at end of file diff --git a/app/views/interventions/_break_intervention_modal.html.slim b/app/views/interventions/_break_intervention_modal.html.slim new file mode 100644 index 00000000..16871e86 --- /dev/null +++ b/app/views/interventions/_break_intervention_modal.html.slim @@ -0,0 +1,11 @@ +/h5 = t('exercises.implement.comment.question') + +/textarea.form-control#question(style='resize:none;') +#intervention-text + +/p = "AVG: #{@working_time_avg}" +/p = "ACCUMULATED: #{@working_time_accumulated}" + +/ data-cause='requestComments' is not used here right now, we pass the button #requestComments (not askForCommentsButton) as initiator of the action. +/ But if we use this button, it will work since the correct cause is supplied +/button#askForCommentsButton.btn.btn-block.btn-primary(type='button' data-cause='requestComments' data-message-success=t('exercises.editor.request_for_comments_sent')) =t('exercises.implement.comment.request') \ No newline at end of file diff --git a/app/views/interventions/_intervention_modal.html.slim b/app/views/interventions/_search_intervention_modal.html.slim similarity index 100% rename from app/views/interventions/_intervention_modal.html.slim rename to app/views/interventions/_search_intervention_modal.html.slim