From a105e61d4832db5e6b84298736bba1a8f74caf8c Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 9 Jan 2018 15:57:06 +0100 Subject: [PATCH 1/2] Remove tutorial [SCI-1860] --- Gemfile | 1 - Gemfile.lock | 4 - Makefile | 3 +- .../6dpi_height.JPG | Bin .../96plate.doc | Bin .../Bioanalyser_result.JPG | Bin .../BootCamp-Experiment-results-20122.sds | Bin .../DSCN0354.JPG | Bin .../DSCN0660.JPG | Bin .../G2938-90034_KitRNA6000Nano_ebook.pdf | Bin .../Mixes_Templats.xls | Bin .../RNeasy-Plant-Mini-Kit-EN.pdf | Bin .../{tutorial_files => demo_files}/curves.JPG | Bin .../cycling_conditions.JPG | Bin ...dCq-quantification_diagnostics-results.xls | Bin ...Cq-quantification_diagnostics-template.xls | Bin .../dilution_curve-efficiency.JPG | Bin .../reaction_setup.JPG | Bin .../result-ddCq.JPG | Bin .../sample-potatoe.txt | 0 .../sample_preparation.JPG | Bin .../samples.txt | 0 .../tables_content.yaml | 2 +- .../totRNA_gel.jpg | Bin app/assets/javascripts/application.js.erb | 1 - .../javascripts/my_modules/protocols.js.erb | 26 --- .../javascripts/my_modules/results.js.erb | 23 --- app/assets/javascripts/projects/canvas.js.erb | 115 ------------- app/assets/javascripts/projects/index.js.erb | 128 -------------- app/assets/javascripts/projects/show.js | 55 ------ app/assets/javascripts/protocols/index.js | 22 --- app/assets/javascripts/reports/index.js | 20 --- app/assets/javascripts/reports/new.js.erb | 27 --- app/assets/javascripts/samples/samples.js | 22 --- app/assets/javascripts/sitewide/utils.js | 159 ------------------ .../settings/account/preferences/index.js | 26 --- app/assets/stylesheets/application.scss | 1 - app/assets/stylesheets/themes/scinote.scss | 34 ---- app/controllers/application_controller.rb | 14 -- app/controllers/projects_controller.rb | 7 + .../account/preferences_controller.rb | 47 ------ app/models/user.rb | 5 - ...r_tutorial.rb => delayed_uploader_demo.rb} | 10 +- app/utilities/first_time_data_generator.rb | 65 +++---- app/views/my_modules/protocols.html.erb | 4 - .../_repeat_tutorial_modal_body.html.erb | 21 --- .../account/preferences/index.html.erb | 27 --- config/environments/development.rb | 4 - config/environments/production.rb | 4 - config/environments/test.rb | 4 - config/locales/en.yml | 41 ----- config/routes.rb | 6 - ...102914_remove_tutorial_status_from_user.rb | 5 + spec/models/user_spec.rb | 1 - 54 files changed, 42 insertions(+), 892 deletions(-) rename app/assets/{tutorial_files => demo_files}/6dpi_height.JPG (100%) rename app/assets/{tutorial_files => demo_files}/96plate.doc (100%) rename app/assets/{tutorial_files => demo_files}/Bioanalyser_result.JPG (100%) rename app/assets/{tutorial_files => demo_files}/BootCamp-Experiment-results-20122.sds (100%) rename app/assets/{tutorial_files => demo_files}/DSCN0354.JPG (100%) rename app/assets/{tutorial_files => demo_files}/DSCN0660.JPG (100%) rename app/assets/{tutorial_files => demo_files}/G2938-90034_KitRNA6000Nano_ebook.pdf (100%) rename app/assets/{tutorial_files => demo_files}/Mixes_Templats.xls (100%) rename app/assets/{tutorial_files => demo_files}/RNeasy-Plant-Mini-Kit-EN.pdf (100%) rename app/assets/{tutorial_files => demo_files}/curves.JPG (100%) rename app/assets/{tutorial_files => demo_files}/cycling_conditions.JPG (100%) rename app/assets/{tutorial_files => demo_files}/ddCq-quantification_diagnostics-results.xls (100%) rename app/assets/{tutorial_files => demo_files}/ddCq-quantification_diagnostics-template.xls (100%) rename app/assets/{tutorial_files => demo_files}/dilution_curve-efficiency.JPG (100%) rename app/assets/{tutorial_files => demo_files}/reaction_setup.JPG (100%) rename app/assets/{tutorial_files => demo_files}/result-ddCq.JPG (100%) rename app/assets/{tutorial_files => demo_files}/sample-potatoe.txt (100%) rename app/assets/{tutorial_files => demo_files}/sample_preparation.JPG (100%) rename app/assets/{tutorial_files => demo_files}/samples.txt (100%) rename app/assets/{tutorial_files => demo_files}/tables_content.yaml (97%) rename app/assets/{tutorial_files => demo_files}/totRNA_gel.jpg (100%) rename app/utilities/{delayed_uploader_tutorial.rb => delayed_uploader_demo.rb} (85%) delete mode 100644 app/views/users/settings/account/preferences/_repeat_tutorial_modal_body.html.erb create mode 100644 db/migrate/20180109102914_remove_tutorial_status_from_user.rb diff --git a/Gemfile b/Gemfile index b5bf73214..25ef15673 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,6 @@ gem 'jquery-ui-rails' gem 'jquery-scrollto-rails', git: 'https://github.com/biosistemika/jquery-scrollto-rails' gem 'hammerjs-rails' -gem 'introjs-rails' # Create quick tutorials gem 'js_cookie_rails' # Simple JS API for cookies gem 'spinjs-rails' gem 'autosize-rails' # jQuery autosize plugin diff --git a/Gemfile.lock b/Gemfile.lock index 8708cab95..8aca461cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,9 +231,6 @@ GEM concurrent-ruby (~> 1.0) i18n-js (3.0.3) i18n (~> 0.6, >= 0.6.6) - introjs-rails (1.0.0) - sass-rails (>= 3.2) - thor (~> 0.14) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -558,7 +555,6 @@ DEPENDENCIES font-awesome-rails (~> 4.7.0.2) hammerjs-rails i18n-js (~> 3.0) - introjs-rails jbuilder jquery-rails jquery-scrollto-rails! diff --git a/Makefile b/Makefile index d6e4ce0ac..1c586c162 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ SECRET_KEY_BASE=$(shell openssl rand -hex 64) PAPERCLIP_HASH_SECRET=$(shell openssl rand -base64 128 | tr -d '\n') DATABASE_URL=postgresql://postgres@db/scinote_production PAPERCLIP_STORAGE=filesystem -ENABLE_TUTORIAL=true ENABLE_RECAPTCHA=false ENABLE_USER_CONFIRMATION=false ENABLE_USER_REGISTRATION=true @@ -83,7 +82,7 @@ integration-tests: @$(MAKE) rails cmd="bundle exec cucumber" tests-ci: - @docker-compose run -e ENABLE_EMAIL_CONFIRMATIONS=false -e MAILER_PORT=$MAILER_PORT -e SMTP_DOMAIN=$SMTP_DOMAIN -e SMTP_USERNAME=$SMTP_USERNAME -e SMTP_PASSWORD=$SMTP_PASSWORD -e SMTP_ADDRESS=$SMTP_ADDRESS -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e MAIL_SERVER_URL=localhost -e PAPERCLIP_STORAGE=filesystem -e ENABLE_TUTORIAL=false -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true --rm web bash -c "bundle install && rake db:create db:migrate && rake db:migrate RAILS_ENV=test && yarn install && bundle exec rspec && bundle exec cucumber" + @docker-compose run -e ENABLE_EMAIL_CONFIRMATIONS=false -e MAILER_PORT=$MAILER_PORT -e SMTP_DOMAIN=$SMTP_DOMAIN -e SMTP_USERNAME=$SMTP_USERNAME -e SMTP_PASSWORD=$SMTP_PASSWORD -e SMTP_ADDRESS=$SMTP_ADDRESS -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e MAIL_SERVER_URL=localhost -e PAPERCLIP_STORAGE=filesystem -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true --rm web bash -c "bundle install && rake db:create db:migrate && rake db:migrate RAILS_ENV=test && yarn install && bundle exec rspec && bundle exec cucumber" console: @$(MAKE) rails cmd="rails console" diff --git a/app/assets/tutorial_files/6dpi_height.JPG b/app/assets/demo_files/6dpi_height.JPG similarity index 100% rename from app/assets/tutorial_files/6dpi_height.JPG rename to app/assets/demo_files/6dpi_height.JPG diff --git a/app/assets/tutorial_files/96plate.doc b/app/assets/demo_files/96plate.doc similarity index 100% rename from app/assets/tutorial_files/96plate.doc rename to app/assets/demo_files/96plate.doc diff --git a/app/assets/tutorial_files/Bioanalyser_result.JPG b/app/assets/demo_files/Bioanalyser_result.JPG similarity index 100% rename from app/assets/tutorial_files/Bioanalyser_result.JPG rename to app/assets/demo_files/Bioanalyser_result.JPG diff --git a/app/assets/tutorial_files/BootCamp-Experiment-results-20122.sds b/app/assets/demo_files/BootCamp-Experiment-results-20122.sds similarity index 100% rename from app/assets/tutorial_files/BootCamp-Experiment-results-20122.sds rename to app/assets/demo_files/BootCamp-Experiment-results-20122.sds diff --git a/app/assets/tutorial_files/DSCN0354.JPG b/app/assets/demo_files/DSCN0354.JPG similarity index 100% rename from app/assets/tutorial_files/DSCN0354.JPG rename to app/assets/demo_files/DSCN0354.JPG diff --git a/app/assets/tutorial_files/DSCN0660.JPG b/app/assets/demo_files/DSCN0660.JPG similarity index 100% rename from app/assets/tutorial_files/DSCN0660.JPG rename to app/assets/demo_files/DSCN0660.JPG diff --git a/app/assets/tutorial_files/G2938-90034_KitRNA6000Nano_ebook.pdf b/app/assets/demo_files/G2938-90034_KitRNA6000Nano_ebook.pdf similarity index 100% rename from app/assets/tutorial_files/G2938-90034_KitRNA6000Nano_ebook.pdf rename to app/assets/demo_files/G2938-90034_KitRNA6000Nano_ebook.pdf diff --git a/app/assets/tutorial_files/Mixes_Templats.xls b/app/assets/demo_files/Mixes_Templats.xls similarity index 100% rename from app/assets/tutorial_files/Mixes_Templats.xls rename to app/assets/demo_files/Mixes_Templats.xls diff --git a/app/assets/tutorial_files/RNeasy-Plant-Mini-Kit-EN.pdf b/app/assets/demo_files/RNeasy-Plant-Mini-Kit-EN.pdf similarity index 100% rename from app/assets/tutorial_files/RNeasy-Plant-Mini-Kit-EN.pdf rename to app/assets/demo_files/RNeasy-Plant-Mini-Kit-EN.pdf diff --git a/app/assets/tutorial_files/curves.JPG b/app/assets/demo_files/curves.JPG similarity index 100% rename from app/assets/tutorial_files/curves.JPG rename to app/assets/demo_files/curves.JPG diff --git a/app/assets/tutorial_files/cycling_conditions.JPG b/app/assets/demo_files/cycling_conditions.JPG similarity index 100% rename from app/assets/tutorial_files/cycling_conditions.JPG rename to app/assets/demo_files/cycling_conditions.JPG diff --git a/app/assets/tutorial_files/ddCq-quantification_diagnostics-results.xls b/app/assets/demo_files/ddCq-quantification_diagnostics-results.xls similarity index 100% rename from app/assets/tutorial_files/ddCq-quantification_diagnostics-results.xls rename to app/assets/demo_files/ddCq-quantification_diagnostics-results.xls diff --git a/app/assets/tutorial_files/ddCq-quantification_diagnostics-template.xls b/app/assets/demo_files/ddCq-quantification_diagnostics-template.xls similarity index 100% rename from app/assets/tutorial_files/ddCq-quantification_diagnostics-template.xls rename to app/assets/demo_files/ddCq-quantification_diagnostics-template.xls diff --git a/app/assets/tutorial_files/dilution_curve-efficiency.JPG b/app/assets/demo_files/dilution_curve-efficiency.JPG similarity index 100% rename from app/assets/tutorial_files/dilution_curve-efficiency.JPG rename to app/assets/demo_files/dilution_curve-efficiency.JPG diff --git a/app/assets/tutorial_files/reaction_setup.JPG b/app/assets/demo_files/reaction_setup.JPG similarity index 100% rename from app/assets/tutorial_files/reaction_setup.JPG rename to app/assets/demo_files/reaction_setup.JPG diff --git a/app/assets/tutorial_files/result-ddCq.JPG b/app/assets/demo_files/result-ddCq.JPG similarity index 100% rename from app/assets/tutorial_files/result-ddCq.JPG rename to app/assets/demo_files/result-ddCq.JPG diff --git a/app/assets/tutorial_files/sample-potatoe.txt b/app/assets/demo_files/sample-potatoe.txt similarity index 100% rename from app/assets/tutorial_files/sample-potatoe.txt rename to app/assets/demo_files/sample-potatoe.txt diff --git a/app/assets/tutorial_files/sample_preparation.JPG b/app/assets/demo_files/sample_preparation.JPG similarity index 100% rename from app/assets/tutorial_files/sample_preparation.JPG rename to app/assets/demo_files/sample_preparation.JPG diff --git a/app/assets/tutorial_files/samples.txt b/app/assets/demo_files/samples.txt similarity index 100% rename from app/assets/tutorial_files/samples.txt rename to app/assets/demo_files/samples.txt diff --git a/app/assets/tutorial_files/tables_content.yaml b/app/assets/demo_files/tables_content.yaml similarity index 97% rename from app/assets/tutorial_files/tables_content.yaml rename to app/assets/demo_files/tables_content.yaml index d10a7f9b1..cd3359ff2 100644 --- a/app/assets/tutorial_files/tables_content.yaml +++ b/app/assets/demo_files/tables_content.yaml @@ -1,4 +1,4 @@ -# Content for tables used in tutorial (demo project). +# Content for tables used in demo project. module1: experimental_design: '{"data":[["","","",null,null],["","","",null,null],["group/time","1 dpi","6 dpi","",""],["PVYNTN","1","1","",""],["mock","1","1","",""],[null,null,null,null,null]]}' diff --git a/app/assets/tutorial_files/totRNA_gel.jpg b/app/assets/demo_files/totRNA_gel.jpg similarity index 100% rename from app/assets/tutorial_files/totRNA_gel.jpg rename to app/assets/demo_files/totRNA_gel.jpg diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index ec2825632..f9413a6bd 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -15,7 +15,6 @@ //= require jquery.caret.min //= require jquery.atwho.min //= require hammer -//= require introjs //= require js.cookie //= require spin //= require jquery.spin diff --git a/app/assets/javascripts/my_modules/protocols.js.erb b/app/assets/javascripts/my_modules/protocols.js.erb index 3676a8b8c..3b2f3384e 100644 --- a/app/assets/javascripts/my_modules/protocols.js.erb +++ b/app/assets/javascripts/my_modules/protocols.js.erb @@ -17,7 +17,6 @@ function init() { initImport(); Comments.bindNewElement(); Comments.initialize(); - initTutorial(); setupAssetsLoading(); } @@ -113,31 +112,6 @@ function bindEditDueDateAjax() { }); } -/** - * Initializes tutorial - */ -function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 12 && stepNum <= 14) { - var resultsTab = $('#results-nav-tab'); - - var nextPage = resultsTab.find('a').attr('href'); - var steps = [{ - intro: I18n.t('tutorial.module_protocols_html'), - }, { - element: $('#protocol-copy-to-repository')[0], - intro: I18n.t('tutorial.module_protocols_save_html'), - position: 'right' - }, { - element: resultsTab[0], - intro: I18n.t('tutorial.module_protocols_click_results_html'), - position: 'right' - }]; - initPageTutorialSteps(12, 14, nextPage, function() {}, function() {}, - steps); - } -} - function initCopyToRepository() { var link = $("[data-action='copy-to-repository']"); var modal = $("#copy-to-repository-modal"); diff --git a/app/assets/javascripts/my_modules/results.js.erb b/app/assets/javascripts/my_modules/results.js.erb index b56218e41..5e9b718ef 100644 --- a/app/assets/javascripts/my_modules/results.js.erb +++ b/app/assets/javascripts/my_modules/results.js.erb @@ -15,7 +15,6 @@ function init() { initHandsOnTables($(document)); _expandAllResults(); - _initTutorial(); applyCollapseLinkCallBack(); Comments.bindNewElement(); @@ -130,28 +129,6 @@ } } - /** - * Initializes tutorial - */ - function _initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 15 && stepNum <= 16) { - var samplesTab = $('#module-samples-nav-tab'); - - var nextPage = samplesTab.find('a').attr('href'); - var steps = [{ - element: $('#results-toolbar')[0], - intro: I18n.t('tutorial.module_results_html') - }, { - element: samplesTab[0], - intro: I18n.t('tutorial.module_results_click_samples_html'), - position: 'left' - }]; - initPageTutorialSteps(15, 16, nextPage, function() {}, function() {}, - steps); - } - } - function processResult(ev, resultTypeEnum, editMode) { var $form = $(ev.target.form); $form.clearFormErrors(); diff --git a/app/assets/javascripts/projects/canvas.js.erb b/app/assets/javascripts/projects/canvas.js.erb index 1e5087844..83340ab51 100644 --- a/app/assets/javascripts/projects/canvas.js.erb +++ b/app/assets/javascripts/projects/canvas.js.erb @@ -116,9 +116,6 @@ var ignoreUnsavedWorkAlert; // Global variable for hammer js var hammertime; -// Cookie data for tutorial -var tutorialData; - /* * As a guideline, all module elements should contain * the following attributes: @@ -146,7 +143,6 @@ function init() { bindWindowResizeEvent(); initializeGraph(".diagram .module-large"); initializeFullZoom(); - initTutorial(); } jsPlumb.ready(function () { @@ -2999,117 +2995,6 @@ function initJsPlumb(containerSel, containerChildSel, modulesSel, params) { } })(); -/** - * Initializes tutorial - */ -function initTutorial() { - var tutorialData = Cookies.get('tutorial_data'); - if (tutorialData) { - tutorialData = JSON.parse(tutorialData); - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - - if (stepNum >= 6 && stepNum <= 7) { - var nextPage = window.location.pathname; - var steps = [{ - element: $('#canvas-container')[0], - intro: I18n.t('tutorial.canvas_overview_html'), - position: 'left' - }, { - element: $('#edit-canvas-button')[0], - intro: I18n.t('tutorial.canvas_click_edit_workflow_html'), - position: 'left' - }]; - initPageTutorialSteps(6, 7, nextPage, tutorialBeforeCb, tutorialAfterCb, - steps); - } else if (stepNum >= 8 && stepNum <= 9) { - // Go into edit canvas mode - $('.introjs-overlay').remove(); - $('.introjs-helperLayer').remove(); - $('.introjs-tooltipReferenceLayer').remove(); - $('#edit-canvas-button').click(); - - setTimeout(function() { - var nextPage = window.location.pathname; - var steps = [{ - intro: I18n.t('tutorial.edit_workflow_html'), - element: $('#canvas-new-module')[0], - position: 'right' - }, { - intro: I18n.t('tutorial.edit_workflow_click_save_html'), - element: $('#canvas-save')[0], - position: 'right' - }]; - initPageTutorialSteps(8, 9, nextPage, tutorialBeforeCb, function() { - // Go out of edit canvas mode - $('.cancel-edit-canvas').click(); - - tutorialAfterCb(); - }, steps); - }, 1000); - } else if (stepNum >= 10 && stepNum <= 11) { - var qpcrModuleLeaf = - $("li.leaf[data-module-id='" + tutorialData[0].qpcr_module + "']"); - - var nextPage = qpcrModuleLeaf.find('a.module-link').attr('href'); - var steps = [{ - element: $('#slide-panel .tree')[0], - intro: I18n.t('tutorial.sidebar_html'), - position: 'right' - }, { - element: qpcrModuleLeaf[0], - intro: I18n.t('tutorial.sidebar_click_module_html'), - position: 'right' - }]; - initPageTutorialSteps(10, 11, nextPage, tutorialBeforeCb, - tutorialAfterCb, steps); - } - } -} - -/** - * Callback to be executed before tutorial starts - */ -function tutorialBeforeCb() { - $('#slide-panel') - .css({'pointer-events': 'none'}); - $('#canvas-new-module') - .css({'pointer-events': 'none'}); - - $.each($('.panel-default'), function(i, el) { - $(el) - .find('.tab-pane') - .css({'pointer-events': 'none'}); - $(el) - .find('.edit-tags-link') - .css({'pointer-events': 'none'}); - $(el) - .find('.panel-heading') - .css({'pointer-events': 'none'}); - }); -} - -/** - * Callback to be executed after tutorial exits - */ -function tutorialAfterCb() { - $('#slide-panel') - .css({'pointer-events': 'auto'}); - $('#canvas-new-module') - .css({'pointer-events': 'auto'}); - - $.each($('.panel-default'), function(i, el) { - $(el) - .find('.tab-pane') - .css({'pointer-events': 'auto'}); - $(el) - .find('.edit-tags-link') - .css({'pointer-events': 'auto'}); - $(el) - .find('.panel-heading') - .css({'pointer-events': 'auto'}); - }); -} - /** prevent reload page */ var preventCanvasReloadOnSave = (function() { 'use strict'; diff --git a/app/assets/javascripts/projects/index.js.erb b/app/assets/javascripts/projects/index.js.erb index eeb9515d9..f48732042 100644 --- a/app/assets/javascripts/projects/index.js.erb +++ b/app/assets/javascripts/projects/index.js.erb @@ -102,8 +102,6 @@ .on('ajax:error', function() { // TODO }); - - initTutorial(); } /** @@ -335,131 +333,5 @@ initUserRoleForms(); } - /** - * Initializes tutorial - */ - function initTutorial() { - var tutorialData = Cookies.get('tutorial_data'); - if (tutorialData) { - tutorialData = JSON.parse(tutorialData); - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (isNaN(stepNum)) { - // Cookies data initialization - stepNum = 1; - Cookies.set('current_tutorial_step', stepNum); - tutorialData[0].backPagesPaths = []; - Cookies.set('tutorial_data', tutorialData); - } - var demoProjectId = tutorialData[0].project; - var demoProject = $('#' + demoProjectId); - - if (stepNum >= 1 && stepNum <= 3) { - var thirdStepPos = (demoProject.offset().top > window.innerHeight / 2) ? - 'top' : 'bottom'; - - var nextPage = $('#' + demoProjectId + '-project-canvas-link') - .attr('href'); - var steps = [{ - element: $('#projects-toolbar')[0], - intro: I18n.t('tutorial.tutorial_welcome_title_html'), - position: 'bottom' - }, { - element: $('#new-project-btn')[0], - intro: I18n.t('tutorial.create_project_html'), - position: 'left' - }, { - element: demoProject[0], - intro: I18n.t('tutorial.project_options_html'), - position: thirdStepPos - }]; - initPageTutorialSteps(1, 3, nextPage, tutorialBeforeCb, - tutorialAfterCb, steps); - } else if (stepNum === 22) { - var protocolLink = $('#protocol-link'); - - var nextPage = protocolLink.attr('href'); - var steps = [{ - element: protocolLink[0], - intro: I18n.t('tutorial.protocols_link_html'), - position: 'left' - }]; - initPageTutorialSteps(22, 22, nextPage, function() {}, function() {}, - steps); - } else if (stepNum >= 25 && stepNum <= 26) { - var firstStepPos = 'right'; - if (demoProject.offset().left > window.innerWidth / 2 || - window.innerWidth < demoProject.width() + 100) { - if (demoProject.offset().top > 500 && demoProject.offset().top > - window.innerHeight / 2) { - firstStepPos = 'top'; - } else { - firstStepPos = 'bottom'; - } - } - - var nextPage = $('#new-report-btn').attr('href'); - var steps = [{ - element: demoProject[0], - intro: I18n.t('tutorial.archive_project_html'), - position: firstStepPos - }, { - element: $('.avatar')[0], - intro: I18n.t('tutorial.goodbye_message'), - position: 'left' - }]; - initPageTutorialSteps(25, 26, nextPage, function() {}, function() {}, - steps); - } - } - } - - /** - * Callback to be executed before tutorial starts - */ - function tutorialBeforeCb() { - $.each($('.panel'), function(i, el){ - $(el) - .find('.panel-title') - .css({ 'pointer-events': 'none' }); - $(el) - .find('.tab-content') - .css({ 'pointer-events': 'none' }); - $(el) - .find('.form-submit-link') - .css({ - 'pointer-events': 'none', - 'color': '<%= Constants::COLOR_ALTO %>'}); - $(el) - .find("[data-action='edit']") - .css({ - 'pointer-events': 'none', - 'color': '<%= Constants::COLOR_ALTO %>'}); - }); - } - - /** - * Callback to be executed after tutorial exits - */ - function tutorialAfterCb() { - $.each($('.panel'), function(i, el){ - $(el) - .find('.tab-content') - .css({ 'pointer-events': 'auto' }); - $(el) - .find('.panel-title') - .css({ 'pointer-events': 'auto' }); - $(el) - .find('.form-submit-link') - .css({ - 'pointer-events': 'auto', - 'color': '<%= Constants::COLOR_NERO %>'}); - $(el) - .find("[data-action='edit']") - .css({ - 'pointer-events': 'auto', - 'color': '<%= Constants::COLOR_NERO %>'}); - }); - } - init(); }()); diff --git a/app/assets/javascripts/projects/show.js b/app/assets/javascripts/projects/show.js index 52268a69b..78b367e45 100644 --- a/app/assets/javascripts/projects/show.js +++ b/app/assets/javascripts/projects/show.js @@ -6,8 +6,6 @@ var that = $(this); initProjectExperiment(that); }); - - initTutorial(); } function initProjectExperiment(element){ @@ -64,58 +62,5 @@ }); } - /** - * Initializes tutorial - */ - function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 4 && stepNum <= 5) { - var nextPage = $('[data-canvas-link]').data('canvasLink'); - var steps = [{ - element: $('#new-experiment')[0], - intro: I18n.t('tutorial.tutorial_welcome_title_html'), - position: 'left' - }, { - element: $('.experiment-panel')[0], - intro: I18n.t('tutorial.edit_experiment_html'), - position: 'right' - }]; - initPageTutorialSteps(4, 5, nextPage, tutorialBeforeCb, tutorialAfterCb, - steps); - } - } - - /** - * Callback to be executed before tutorial starts - */ - function tutorialBeforeCb() { - $.each( $(".panel-title"), function(){ - $(this).css({ "pointer-events": "none" }); - }); - $.each( $(".workflowimg-container"), function(){ - $(this).css({ "pointer-events": "none" }); - }); - $.each( $(".dropdown-experiment-actions").find("li"), - function(){ - $(this).css({ "pointer-events": "none" }); - }); - } - - /** - * Callback to be executed after tutorial exits - */ - function tutorialAfterCb() { - $.each( $(".panel-title"), function(){ - $(this).css({ "pointer-events": "auto" }); - }); - $.each( $(".workflowimg-container"), function(){ - $(this).css({ "pointer-events": "auto" }); - }); - $.each( $(".dropdown-experiment-actions").find("li"), - function(){ - $(this).css({ "pointer-events": "auto" }); - }); - } - init(); })(); diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index 13960bbec..f609a0699 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -19,7 +19,6 @@ function init() { initCreateNewModal(); initModals(); initImport(); - initTutorial(); } // Initialize protocols DataTable @@ -770,25 +769,4 @@ function initImport() { }); } -/** - * Initializes tutorial - */ -function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 23 && stepNum <= 24) { - var nextPage = $('.navbar-brand').attr('href'); - var steps = [{ - element: $('.nav-settings')[0], - intro: I18n.t('tutorial.protocols_index_html'), - position: 'bottom' - }, { - element: $('#import-export-protocols')[0], - intro: I18n.t('tutorial.protocols_import_export_html'), - position: 'bottom' - }]; - initPageTutorialSteps(23, 24, nextPage, function() {}, function() {}, - steps); - } -} - init(); diff --git a/app/assets/javascripts/reports/index.js b/app/assets/javascripts/reports/index.js index e3ea2d393..e6a8ee9ea 100644 --- a/app/assets/javascripts/reports/index.js +++ b/app/assets/javascripts/reports/index.js @@ -38,7 +38,6 @@ updateButtons(); initEditReport(); initDeleteReports(); - initTutorial(); } /** @@ -163,24 +162,5 @@ }); } - /** - * Initializes tutorial - */ - function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum === 19) { - var newReportBtn = $('#new-report-btn'); - - var nextPage = newReportBtn.attr('href'); - var steps = [{ - element: newReportBtn[0], - intro: I18n.t('tutorial.reports_index_click_new_report_html'), - position: 'right' - }]; - initPageTutorialSteps(19, 19, nextPage, function() {}, function() {}, - steps); - } - } - $(document).ready(init); }()); diff --git a/app/assets/javascripts/reports/new.js.erb b/app/assets/javascripts/reports/new.js.erb index c482528c5..50d3ba047 100644 --- a/app/assets/javascripts/reports/new.js.erb +++ b/app/assets/javascripts/reports/new.js.erb @@ -33,7 +33,6 @@ var ignoreUnsavedWorkAlert; initializeAddContentsModal(); initializeSidebarNavigation(); initializeUnsavedWorkDialog(); - initTutorial(); $('.report-nav-link').each(function() { truncateLongString($(this), <%= Constants::NAME_TRUNCATION_LENGTH %>); @@ -1146,32 +1145,6 @@ function initializeReportSidebartruncation() { observer.observe(target, config); } -/** - * Initializes tutorial - */ -function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 20 && stepNum <= 21) { - ignoreUnsavedWorkAlert = true; - - var nextPage = $('.navbar-brand').attr('href'); - var steps = [{ - element: $('.new-element')[0], - intro: I18n.t('tutorial.new_report_html'), - position: 'left' - }, { - element: $('#team-link')[0], - intro: I18n.t('tutorial.new_report_click_team_html', - { private_team: $('#team-link span').last().text() }), - position: 'left' - }]; - initPageTutorialSteps(20, 21, nextPage, function() {}, function() { - ignoreUnsavedWorkAlert = false; - }, - steps); - } -} - $(document).ready(function() { // Check if we are actually at new report page if ($(REPORT_CONTENT).length) { diff --git a/app/assets/javascripts/samples/samples.js b/app/assets/javascripts/samples/samples.js index b5a2f9bf1..4bb2bd4a0 100644 --- a/app/assets/javascripts/samples/samples.js +++ b/app/assets/javascripts/samples/samples.js @@ -58,25 +58,3 @@ function updateSamplesTypesandGroups() { } }); } - -/** - * Initializes tutorial - */ -function initTutorial() { - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (stepNum >= 17 && stepNum <= 18) { - var nextPage = $('#reports-nav-tab a').attr('href'); - var steps = [{ - element: $('#importSamplesButton')[0], - intro: I18n.t('tutorial.samples_html'), - position: 'right' - }, { - element: $('#secondary-menu')[0], - intro: I18n.t('tutorial.breadcrumbs_html') - }]; - initPageTutorialSteps(17, 18, nextPage, function() {}, function() {}, - steps); - } -} - -initTutorial(); diff --git a/app/assets/javascripts/sitewide/utils.js b/app/assets/javascripts/sitewide/utils.js index 540e682ff..c74607e38 100644 --- a/app/assets/javascripts/sitewide/utils.js +++ b/app/assets/javascripts/sitewide/utils.js @@ -26,165 +26,6 @@ $.fn.onAjaxComplete = function (cb) { }); } -// Number of all tutorial steps -var TUTORIAL_STEPS_CNT = 26; - -/** - * Initializes tutorial steps for the current page. - * NOTE: You can specify steps manually in JS with steps parameter (preferred - * way), or hardcode them in HTML - * NOTE: If some steps edit page, then this function needs to be called several - * times for the same page, but for different steps. The same goes if the page - * has discontinuous tutorial steps. In such cases, use steps branching, e.g.: - * @example - * var tutorialData = Cookies.get('tutorial_data'); - * if (tutorialData) { - * tutorialData = JSON.parse(tutorialData); - * var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - * - * if (stepNum >= 6 && stepNum <= 7) { - * ... - * } else if ... - * NOTE: If an element the popup is pointing at is of lesser horizontal length - * than the popup itself, then it will not be positioned correctly if it's - * position is top or bottom, so set/change the step's position to either left - * or right (and don't use any custom styling!), e.g.: - * @example - * var steps = [ - * { - * ... - * position: 'right' - * }, - * { - * ... - * ]; - * NOTE: If only one page step is needed, then make pageFirstStepN == - * pageLastStepN (both represent the one and only step number) - * - * @param {number} pageFirstStepN Page's first step number - * @param {number} pageLastStepN Page's last step number - * @param {string} nextPagePath Next page absolute path - * @param {function} beforeCb Callback called before the tutorial starts. Mainly - * used for setting 'pointer-events: none' on the elements the page's steps - * highlight. - * @param {function} endCb Callback called after the tutorial ends. Mainly used - * for setting 'pointer-events: auto' on the elements the page's steps - * highlight. - * @param {object} steps JSON containing intro.js steps. - */ -function initPageTutorialSteps(pageFirstStepN, pageLastStepN, nextPagePath, - beforeCb, endCb, steps) { - var tutorialData = Cookies.get('tutorial_data'); - if (tutorialData) { - tutorialData = JSON.parse(tutorialData); - var stepNum = parseInt(Cookies.get('current_tutorial_step'), 10); - if (isNaN(stepNum)) { - // Cookies data initialization - stepNum = 1; - Cookies.set('current_tutorial_step', stepNum); - tutorialData[0].backPagesPaths = []; - Cookies.set('tutorial_data', tutorialData); - } - var thisPagePath = window.location.pathname; - beforeCb(); - - // Initialize tutorial for the current pages' steps - - var doneLabel; - if (pageLastStepN == TUTORIAL_STEPS_CNT) { - doneLabel = I18n.t('tutorial.finish_tutorial'); - } else { - doneLabel = I18n.t('tutorial.skip_tutorial'); - // Add extra fake step, so that next button on last step of current page - // gets focused. Also, if current page has only one step, this adds back - // and next buttons to the popup. - steps.push({}); - } - introJs() - .setOptions({ - overlayOpacity: '0.2', - prevLabel: I18n.t('tutorial.back'), - nextLabel: I18n.t('tutorial.next'), - skipLabel: I18n.t('tutorial.skip_tutorial'), - doneLabel: doneLabel, - showBullets: false, - showStepNumbers: false, - exitOnOverlayClick: false, - exitOnEsc: false, - disableInteraction: true, - keyboardNavigation: false, - tooltipClass: 'custom next-page-link', - steps: steps - }) - .goToStep(stepNum - (pageFirstStepN - 1)) - .onexit(function() { - Cookies.remove('tutorial_data'); - Cookies.remove('current_tutorial_step'); - location.reload(); - }) - .oncomplete(function() { - Cookies.remove('tutorial_data'); - Cookies.remove('current_tutorial_step'); - location.reload(); - }) - .start(); - - // Page navigation when coming to this page from previous or from next page - $(function() { - if (stepNum === pageFirstStepN && stepNum > 1) { - $('.introjs-prevbutton').removeClass('introjs-disabled'); - } else if (stepNum === pageLastStepN && stepNum < TUTORIAL_STEPS_CNT) { - $('.introjs-nextbutton').removeClass('introjs-disabled'); - } - }); - - // Page navigation when already on this page - - $('.introjs-skipbutton').click(function() { - Cookies.remove('current_tutorial_step'); - Cookies.remove('tutorial_data'); - - endCb(); - }); - - $('.introjs-prevbutton').click(function() { - if (stepNum > 1) { - Cookies.set('current_tutorial_step', --stepNum); - - if (stepNum === pageFirstStepN && stepNum > 1) { - $('.introjs-prevbutton').removeClass('introjs-disabled'); - } else if (stepNum < pageFirstStepN) { - // Go to previous page; - - var prevPagePath = tutorialData[0].backPagesPaths.pop(); - Cookies.set('tutorial_data', tutorialData); - $('.introjs-prevbutton').attr('href', prevPagePath); - introJs().exit(); - endCb(); - } - } - }); - - $('.introjs-nextbutton').click(function() { - if (stepNum < TUTORIAL_STEPS_CNT) { - Cookies.set('current_tutorial_step', ++stepNum); - - if (stepNum === pageLastStepN && stepNum < TUTORIAL_STEPS_CNT) { - $('.introjs-nextbutton').removeClass('introjs-disabled'); - } else if (stepNum > pageLastStepN) { - // Go to next page - - tutorialData[0].backPagesPaths.push(thisPagePath); - Cookies.set('tutorial_data', tutorialData); - $('.introjs-nextbutton').attr('href', nextPagePath); - introJs().exit(); - endCb(); - } - } - }); - } -} - /** * Checkbox on/off logic. For each checkbox hierarchy add 'checkbox-tree' class * to a parent 'div' surrounding the checkbox hierarchy, represented with 'ul', diff --git a/app/assets/javascripts/users/settings/account/preferences/index.js b/app/assets/javascripts/users/settings/account/preferences/index.js index 274240d6d..4a840dbdf 100644 --- a/app/assets/javascripts/users/settings/account/preferences/index.js +++ b/app/assets/javascripts/users/settings/account/preferences/index.js @@ -64,35 +64,9 @@ $(this).renderFormErrors("user", data.responseJSON); }); - var repeatTutorialModal = $("#repeat-tutorial-modal"); - var repeatTutorialModalBody = repeatTutorialModal.find(".modal-body"); - initRepeatTutorialModal(); notificationsSettings(); initNotificationSettingsForm(); - $("#reset-tutorial-btn") - .on("ajax:before", function () { - repeatTutorialModal.modal('show'); - }) - - .on("ajax:success", function (e, data) { - initRepeatTutorialModalBody(data); - }); - - function initRepeatTutorialModal() { - // Remove modal content when modal window is closed. - repeatTutorialModal.on("hidden.bs.modal", function () { - repeatTutorialModalBody.html(""); - }); - } - - // Initialize ajax listeners and elements style on modal body. This - // function must be called when modal body is changed. - function initRepeatTutorialModalBody(data) { - repeatTutorialModalBody.html(data.html); - repeatTutorialModalBody.find(".selectpicker").selectpicker(); - } - // Setup notification checkbox buttons function notificationsSettings() { var notification_settings = [ "recent_notification", diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 023bd4d94..cb2b2ddb0 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -6,7 +6,6 @@ *= require rails_bootstrap_forms *= require bootstrap-select *= require constants - *= require introjs *= stub reports_pdf */ @import "bootstrap-sprockets"; diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 39ae3b334..bc7a3edc7 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1120,40 +1120,6 @@ table.dataTable { transform: translate3d(0%, 0, 0); } -/* Custom settings for intro-js */ -.introjs-tooltip { - opacity: 1 !important; -} - -.custom .introjs-button { - font-weight: bold; - text-transform: uppercase; -} - -.custom .introjs-disabled { - display: none; -} - -.custom .introjs-skipbutton { - border-radius: 0; - color: $color-theme-primary; - background-color: $color-white; - background-image: none; - border: none; -} - -.disabled-next .introjs-nextbutton { - display: none; -} - -.introjs-tooltipReferenceLayer { - z-index: $infinity !important; - - &.max { - z-index: calc($infinity + 1) !important; - } -} - .modal-tooltip { border-bottom: 1px dotted $color-alto; cursor: help; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ab83e183d..ce83efeb4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,7 +7,6 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception, prepend: true before_action :authenticate_user! helper_method :current_team - before_action :generate_intro_tutorial, if: :is_current_page_root? before_action :update_current_team, if: :user_signed_in? around_action :set_time_zone, if: :current_user layout 'main' @@ -66,19 +65,6 @@ class ApplicationController < ActionController::Base private - def generate_intro_tutorial - if Rails.configuration.x.enable_tutorial && - current_user.no_tutorial_done? && - current_user.teams.where(created_by: current_user).count > 0 then - demo_cookie = seed_demo_data current_user - cookies[:tutorial_data] = { - value: demo_cookie, - expires: 1.week.from_now - } - current_user.update(tutorial_status: 1) - end - end - def update_current_team if current_user.current_team_id.blank? && current_user.teams.count > 0 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 59ab65127..617f24b8f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -4,6 +4,7 @@ class ProjectsController < ApplicationController include TeamsHelper include InputSanitizeHelper + before_action :generate_intro_demo, only: :index before_action :load_vars, only: [:show, :edit, :update, :notifications, :reports, :samples, :experiment_archive, @@ -306,6 +307,12 @@ class ProjectsController < ApplicationController private + def generate_intro_demo + return unless current_user.sign_in_count == 1 + team = current_user.teams.where(created_by: current_user).first + seed_demo_data(current_user) if team && team.projects.blank? + end + def project_params params.require(:project).permit(:name, :team_id, :visibility, :archived) end diff --git a/app/controllers/users/settings/account/preferences_controller.rb b/app/controllers/users/settings/account/preferences_controller.rb index 723641a49..78fc5da59 100644 --- a/app/controllers/users/settings/account/preferences_controller.rb +++ b/app/controllers/users/settings/account/preferences_controller.rb @@ -5,8 +5,6 @@ module Users before_action :load_user, only: [ :index, :update, - :tutorial, - :reset_tutorial, :notifications_settings ] @@ -31,51 +29,6 @@ module Users end end - def tutorial - @teams = - @user - .user_teams - .includes(team: :users) - .where(role: 1..2) - .order(created_at: :asc) - .map(&:team) - @member_of = @teams.count - - respond_to do |format| - format.json do - render json: { - status: :ok, - html: render_to_string( - partial: 'users/settings/account/preferences/' \ - 'repeat_tutorial_modal_body.html.erb' - ) - } - end - end - end - - def reset_tutorial - if @user.update(tutorial_status: 0) && params[:team][:id].present? - @user.update(current_team_id: params[:team][:id]) - cookies.delete :tutorial_data - cookies.delete :current_tutorial_step - cookies[:repeat_tutorial_team_id] = { - value: params[:team][:id], - expires: 1.day.from_now - } - - flash[:notice] = t( - 'users.settings.account.preferences.tutorial.tutorial_reset_flash' - ) - redirect_to root_path - else - flash[:alert] = t( - 'users.settings.account.preferences.tutorial.tutorial_reset_error' - ) - redirect_back(fallback_location: root_path) - end - end - def notifications_settings @user.assignments_notification = params[:assignments_notification] ? true : false diff --git a/app/models/user.rb b/app/models/user.rb index cca3b9409..eaaaf23b3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,11 +16,6 @@ class User < ApplicationRecord }, default_url: Constants::DEFAULT_AVATAR_URL - enum tutorial_status: { - no_tutorial_done: 0, - intro_tutorial_done: 1 - } - auto_strip_attributes :full_name, :initials, nullify: false validates :full_name, presence: true, diff --git a/app/utilities/delayed_uploader_tutorial.rb b/app/utilities/delayed_uploader_demo.rb similarity index 85% rename from app/utilities/delayed_uploader_tutorial.rb rename to app/utilities/delayed_uploader_demo.rb index 87e349f1a..920813c61 100644 --- a/app/utilities/delayed_uploader_tutorial.rb +++ b/app/utilities/delayed_uploader_demo.rb @@ -1,9 +1,9 @@ -module DelayedUploaderTutorial - # Get asset from tutorial_files folder +module DelayedUploaderDemo + # Get asset from demo_files folder def self.get_asset(user, team, file_name) Asset.new( file: File.open( - "#{Rails.root}/app/assets/tutorial_files/#{file_name}", 'r' + "#{Rails.root}/app/assets/demo_files/#{file_name}", 'r' ), created_by: user, team: team, @@ -12,7 +12,7 @@ module DelayedUploaderTutorial end # Generates results asset for given module, file_name assumes file is located - # in tutorial_files. + # in demo_files. def self.generate_result_asset( my_module:, current_user:, @@ -53,7 +53,7 @@ module DelayedUploaderTutorial # Adds asset to existing step def self.add_step_asset(step:, current_user:, current_team:, file_name:) temp_asset = - DelayedUploaderTutorial.get_asset(current_user, current_team, file_name) + DelayedUploaderDemo.get_asset(current_user, current_team, file_name) step.assets << temp_asset temp_asset.post_process_file(step.my_module.experiment.project.team) end diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index d569960a3..2d1ca3261 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -1,24 +1,11 @@ module FirstTimeDataGenerator - # Create data for tutorial for new users + # Create data for demo for new users def seed_demo_data(user) @user = user # First team that this user created # should contain the "intro" project - if cookies[:repeat_tutorial_org_id] || cookies[:repeat_tutorial_team_id] - team = Team.find_by_id(cookies[:repeat_tutorial_org_id]) - team ||= Team.find_by_id(cookies[:repeat_tutorial_team_id]) - %w(repeat_tutorial_team_id repeat_tutorial_org_id) - .each do |repeat_tutorial| - cookies.delete repeat_tutorial.to_sym if cookies[repeat_tutorial.to_sym] - end - else - team = user - .teams - .where(created_by: user) - .order(created_at: :asc) - .first - end + team = user.teams.where(created_by: user).order(created_at: :asc).first # If private private team does not exist, # there was something wrong with user creation. @@ -499,7 +486,7 @@ module FirstTimeDataGenerator # Load table contents yaml file tab_content = YAML.load_file( - "#{Rails.root}/app/assets/tutorial_files/tables_content.yaml" + "#{Rails.root}/app/assets/demo_files/tables_content.yaml" ) # Create module content @@ -516,7 +503,7 @@ module FirstTimeDataGenerator module_step_descriptions) # Results - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[0], current_user: user, current_team: team, @@ -563,7 +550,7 @@ module FirstTimeDataGenerator module_step_descriptions) # Add file to existig step - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[1].protocol.steps.where('position = 0').take, current_user: user, current_team: team, @@ -571,7 +558,7 @@ module FirstTimeDataGenerator ) # Results - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[1], current_user: user, current_team: team, @@ -580,7 +567,7 @@ module FirstTimeDataGenerator file_name: 'DSCN0660.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[1], current_user: user, current_team: team, @@ -589,7 +576,7 @@ module FirstTimeDataGenerator file_name: 'DSCN0354.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[1], current_user: user, current_team: team, @@ -642,7 +629,7 @@ module FirstTimeDataGenerator generate_module_steps(my_modules[2], module_step_names, module_step_descriptions) # Add file to existig step - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[2].protocol.steps.where('position = 1').take, current_user: user, current_team: team, @@ -685,7 +672,7 @@ module FirstTimeDataGenerator ).sneaky_save # Second result - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[2], current_user: user, current_team: team, @@ -704,7 +691,7 @@ module FirstTimeDataGenerator generate_module_steps(my_modules[3], module_step_names, module_step_descriptions) # Add file to existig step - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[3].protocol.steps.where('position = 0').take, current_user: user, current_team: team, @@ -712,7 +699,7 @@ module FirstTimeDataGenerator ) # Results - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[3], current_user: user, current_team: team, @@ -778,28 +765,28 @@ module FirstTimeDataGenerator module_step_descriptions) # Add file to existig steps - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[5].protocol.steps.where('position = 0').take, current_user: user, current_team: team, file_name: 'sample_preparation.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[5].protocol.steps.where('position = 1').take, current_user: user, current_team: team, file_name: 'reaction_setup.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[5].protocol.steps.where('position = 2').take, current_user: user, current_team: team, file_name: 'cycling_conditions.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[5].protocol.steps.where('position = 3').take, current_user: user, current_team: team, @@ -842,7 +829,7 @@ module FirstTimeDataGenerator ).sneaky_save # Results - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[5], current_user: user, current_team: team, @@ -851,7 +838,7 @@ module FirstTimeDataGenerator file_name: 'Mixes_Templats.xls' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[5], current_user: user, current_team: team, @@ -860,7 +847,7 @@ module FirstTimeDataGenerator file_name: 'BootCamp-Experiment-results-20122.sds' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[5], current_user: user, current_team: team, @@ -907,7 +894,7 @@ module FirstTimeDataGenerator module_step_descriptions) # Add file to existig step - DelayedUploaderTutorial.delay(queue: :tutorial).add_step_asset( + DelayedUploaderDemo.delay(queue: :demo).add_step_asset( step: my_modules[7].protocol.steps.where('position = 0').take, current_user: user, current_team: team, @@ -915,7 +902,7 @@ module FirstTimeDataGenerator ) # Add result - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[7], current_user: user, current_team: team, @@ -924,7 +911,7 @@ module FirstTimeDataGenerator file_name: 'ddCq-quantification_diagnostics-results.xls' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[7], current_user: user, current_team: team, @@ -933,7 +920,7 @@ module FirstTimeDataGenerator file_name: 'dilution_curve-efficiency.JPG' ) - DelayedUploaderTutorial.delay(queue: :tutorial).generate_result_asset( + DelayedUploaderDemo.delay(queue: :demo).generate_result_asset( my_module: my_modules[7], current_user: user, current_team: team, @@ -973,12 +960,6 @@ module FirstTimeDataGenerator # create thumbnail experiment.delay.generate_workflow_img - - # Lastly, create cookie with according ids - # so tutorial steps can be properly positioned - JSON.generate([team: team.id, - project: project.id, - qpcr_module: my_modules[5].id]) end # WARNING: This only works on PostgreSQL diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index 1645e5c8a..9c778e46f 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -18,10 +18,6 @@ <%= render partial: "protocols/steps.html.erb" %> - - - diff --git a/app/views/users/settings/account/preferences/_repeat_tutorial_modal_body.html.erb b/app/views/users/settings/account/preferences/_repeat_tutorial_modal_body.html.erb deleted file mode 100644 index 2ee232424..000000000 --- a/app/views/users/settings/account/preferences/_repeat_tutorial_modal_body.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% if @member_of == 0 %> -
- <%=t 'users.settings.account.preferences.tutorial.no_teams' %> -
-<% else %> -
- <%=t 'users.settings.account.preferences.tutorial.select_team_instruction' %> -
-
-
- <%= bootstrap_form_tag url: reset_tutorial_path, method: :post do |f| %> -
- <%= collection_select(:team, :id, @teams, :id, :name, {}, { class: 'selectpicker' }) %> -
-
 
-
- <%= f.button t('users.settings.account.preferences.tutorial.repeat_tutorial'), class: "btn btn-primary" %> -
- <% end %> -
-<% end %> diff --git a/app/views/users/settings/account/preferences/index.html.erb b/app/views/users/settings/account/preferences/index.html.erb index 4aff9877b..e59db10c2 100644 --- a/app/views/users/settings/account/preferences/index.html.erb +++ b/app/views/users/settings/account/preferences/index.html.erb @@ -51,15 +51,6 @@ <% end %> - <% if Rails.configuration.x.enable_tutorial %> -
- <%= t('tutorial.title') %>
- <%= link_to t('users.settings.account.preferences.tutorial.repeat_tutorial'), - tutorial_path(format: :json), - remote: true, - class: 'btn btn-primary', - id: 'reset-tutorial-btn' %> - <% end %>

<%= t('notifications.title') %>

@@ -150,22 +141,4 @@
- - - - - <%= javascript_include_tag "users/settings/account/preferences/index" %> diff --git a/config/environments/development.rb b/config/environments/development.rb index 8ad2dc82a..8ec4be8e6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -87,10 +87,6 @@ Rails.application.configure do # Enable/disable Deface config.deface.enabled = ENV['DEFACE_ENABLED'] != 'false' - # Enable first-time tutorial for users signing in the sciNote for - # the first time. - config.x.enable_tutorial = ENV['ENABLE_TUTORIAL'] == 'true' - # Enable reCAPTCHA config.x.enable_recaptcha = ENV['ENABLE_RECAPTCHA'] == 'true' diff --git a/config/environments/production.rb b/config/environments/production.rb index 21584572d..a9683c26e 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -101,10 +101,6 @@ Rails.application.configure do # Enable/disable Deface config.deface.enabled = ENV['DEFACE_ENABLED'] != 'false' - # Enable first-time tutorial for users signing in the sciNote for - # the first time. - config.x.enable_tutorial = ENV['ENABLE_TUTORIAL'] != 'false' - # Enable reCAPTCHA config.x.enable_recaptcha = ENV['ENABLE_RECAPTCHA'] == 'true' diff --git a/config/environments/test.rb b/config/environments/test.rb index 16ec7dc75..9f45f3a33 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -84,10 +84,6 @@ Rails.application.configure do # Enable/disable Deface config.deface.enabled = ENV['DEFACE_ENABLED'] != 'false' - # Enable first-time tutorial for users signing in the sciNote for - # the first time. - config.x.enable_tutorial = false - # Enable reCAPTCHA config.x.enable_recaptcha = false diff --git a/config/locales/en.yml b/config/locales/en.yml index 2c9316b69..2908d8aaa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1322,14 +1322,6 @@ en: time_zone_sublabel: "Time zone setting affects all time & date fields throughout application." time_zone_title: "Time zone" update_flash: "Preferences successfully updated." - tutorial: - modal_title: "Repeat tutorial" - no_teams: "Seems like you are not a member of any team. Tutorials can be run only by team members." - repeat_tutorial: "Repeat tutorial" - select_team_instruction: "Select the team where you wish to create the demo project." - select_team: "Select team" - tutorial_reset_flash: "Tutorial can now be repeated." - tutorial_reset_error: "Tutorial could not be repeated." addons: head_title: "Settings | Add-ons" title: "Add-ons" @@ -1722,39 +1714,6 @@ en: time: "%H:%M" short: "%H" - tutorial: - title: "Tutorial" - back: "Back" - next: "Next" - skip_tutorial: "Skip tutorial" - finish_tutorial: "Start using sciNote" - tutorial_welcome_title_html: "Welcome to sciNote, your electronic lab notebook. sciNote organizes your work in Projects. Click Team icon to choose Projects from which Team you want to view on your Dashboard. You can also reorder them by clicking the Sort by button. (Step 1/26)" - create_project_html: "Click here to create a Project and it will appear under the Team you've chosen. Choose public if you want everyone from the Team to view the Project or choose private so only the people who you invite to the Project can see it. (Step 2/26)" - project_options_html: "In the bottom row of the Project card you can check the latest activity , invite collaborators , see the notifications and write comments . You can also edit the Project's name and visibility or archive it. You can recall the Project from the Archive in the top right side of the Dashboard at any time. (Step 3/26)" - create_experiment_html: "Inside of a Project you can create Experiments. To create one click on this button and edit Experiment’s name and description. (Step 4/26)" - edit_experiment_html: "By clicking on the down arrow of an Experiment card you can choose between different actions. You can Edit details to the Experiment, such as experiment name and description, Copy it as template inside of a Project, where copied Experiment is identical to the original one, Move it from one Project to another or Archive it in the Archive . (Step 5/26)" - canvas_overview_html: "A Task is a basic unit of your Experiment. Within a Task, you can add Protocols, Results or Samples. You can connect Tasks into Workflows to assure traceability of your work. You can grab a Task or entire Workflow and move it in all directions on the canvas. (Step 6/26)" - canvas_click_edit_workflow_html: " Click Edit experiment to add new Tasks or to modify an existing Experiment. (Step 7/26)" - edit_workflow_html: "To add a new Task to the Experiment, click on New task and drag it onto canvas. (Step 8/26)" - edit_workflow_click_save_html: "Click Save experiment to save changes you’ve made to the Experiment. (Step 9/26)" - sidebar_html: "Navigation bar helps you to navigate through Experiments. It also helps you to find a specific Task on the canvas by clicking the navigate icon . (Step 10/26)" - sidebar_click_module_html: "Click on the Task name qPCR to see its contents. (Step 11/26)" - module_protocols_html: "Inside of a Task you can create Protocol steps and upload existing protocol files. After you have finished a certain step, click the Complete step button. Exact time and the person who completed the step are recorded and can be seen in the Activity tab in the top right side of the Dashboard. (Step 12/26)" - module_protocols_save_html: "You can save the protocol to Protocol repository. Everyone within the same Team will be able to use it. (Step 13/26)" - module_protocols_click_results_html: "Click on the Results tab to upload experiment results. (Step 14/26)" - module_results_html: "You can upload any type of a file, insert table or write comments. (Step 15/26)" - module_results_click_samples_html: "Click on the Samples tab to import, export or assign samples to the Task. (Step 16/26)" - samples_html: "You can easily import sample tables from Excel or tab-delimited files. If you assign samples to a certain Task, these samples will be automatically assigned downstream the Workflow. (Step 17/26)" - breadcrumbs_html: "You can always use these Breadcrumbs to navigate all the way back to the Dashboard. Click on the Reports tab to generate a report of your work. (Step 18/26)" - reports_index_click_new_report_html: "Click the New report button to create a new report. (Step 19/26)" - new_report_html: "To add report elements to the report, click on the —+— sign on the sheet. Select the report contents in the tabs and click Add to report. You can save the report as a PDF on your computer or save it within sciNote for later viewing and modification. (Step 20/26)" - new_report_click_team_html: "Click on %{private_team} in breadcrumbs to return to the Dashboard. (Step 21/26)" - protocols_link_html: "Click on to go to the Protocols repository page. (Step 22/26)" - protocols_index_html: "View your Public and Private Protocols, which you can Edit, Create new ones or Copy them. Protocols can be archived and restored from the Archive. (Step 23/26)" - protocols_import_export_html: "You can also Import or Export protocols to your hard drive. Return to the Dashboard. (Step 24/26)" - archive_project_html: "Archive Demo project - qPCR by clicking on the down arrow . You can always access the Archive by clicking the icon on the top right side of the Dashboard and restore any item you have archived. (Step 25/26)" - goodbye_message: "To repeat the tutorial, go to your Settings and open Preferences tab. Click on the Repeat tutorial button and go through the tutorial as many times as needed. (Step 26/26)" - notifications: title: "Notifications" email_settings: "E-mail notifications" diff --git a/config/routes.rb b/config/routes.rb index 331b644cc..04411c974 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,12 +56,6 @@ Rails.application.routes.draw do put 'users/settings/account/preferences', to: 'users/settings/account/preferences#update', as: 'update_preferences' - get 'users/settings/account/preferences/tutorial', - to: 'users/settings/account/preferences#tutorial', - as: 'tutorial' - post 'users/settings/account/preferences/reset_tutorial/', - to: 'users/settings/account/preferences#reset_tutorial', - as: 'reset_tutorial' post 'users/settings/account/preferences/notifications_settings', to: 'users/settings/account/preferences#notifications_settings', as: 'notifications_settings', diff --git a/db/migrate/20180109102914_remove_tutorial_status_from_user.rb b/db/migrate/20180109102914_remove_tutorial_status_from_user.rb new file mode 100644 index 000000000..b979ce457 --- /dev/null +++ b/db/migrate/20180109102914_remove_tutorial_status_from_user.rb @@ -0,0 +1,5 @@ +class RemoveTutorialStatusFromUser < ActiveRecord::Migration[5.1] + def change + remove_column :users, :tutorial_status, :integer, default: 0, null: false + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index dd25cb334..63524da50 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -36,7 +36,6 @@ describe User, type: :model do it { should have_db_column :invited_by_id } it { should have_db_column :invited_by_type } it { should have_db_column :invitations_count } - it { should have_db_column :tutorial_status } it { should have_db_column :settings } it { should have_db_column :current_team_id } it { should have_db_column :authentication_token } From 09c60d2468f69651755d8a8f1a5046407aa30d82 Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Thu, 12 Apr 2018 14:38:22 +0200 Subject: [PATCH 2/2] Fixes per @Ducz0r's request --- app/assets/stylesheets/settings.scss | 3 --- app/controllers/projects_controller.rb | 2 +- app/utilities/first_time_data_generator.rb | 8 ++------ config/environments/development.rb | 1 - config/environments/production.rb | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 app/assets/stylesheets/settings.scss diff --git a/app/assets/stylesheets/settings.scss b/app/assets/stylesheets/settings.scss deleted file mode 100644 index 002b244eb..000000000 --- a/app/assets/stylesheets/settings.scss +++ /dev/null @@ -1,3 +0,0 @@ -#reset-tutorial-btn { - margin-top: 5px; -} diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f11502c44..9e76748d7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -299,7 +299,7 @@ class ProjectsController < ApplicationController def generate_intro_demo return unless current_user.sign_in_count == 1 team = current_user.teams.where(created_by: current_user).first - seed_demo_data(current_user) if team && team.projects.blank? + seed_demo_data(current_user, team) if team && team.projects.blank? end def project_params diff --git a/app/utilities/first_time_data_generator.rb b/app/utilities/first_time_data_generator.rb index 2d1ca3261..4c29d7227 100644 --- a/app/utilities/first_time_data_generator.rb +++ b/app/utilities/first_time_data_generator.rb @@ -1,12 +1,8 @@ module FirstTimeDataGenerator # Create data for demo for new users - def seed_demo_data(user) + def seed_demo_data(user, team) @user = user - # First team that this user created - # should contain the "intro" project - team = user.teams.where(created_by: user).order(created_at: :asc).first - # If private private team does not exist, # there was something wrong with user creation. # Do nothing @@ -64,7 +60,7 @@ module FirstTimeDataGenerator repository_rows_to_assign = [] # Generate random custom respository sample names and assign sample types # and groups - + repository_sample_name = (0...3).map { 65.+(rand(26)).chr }.join << '/' (1..5).each do |index| repository_row = RepositoryRow.create( diff --git a/config/environments/development.rb b/config/environments/development.rb index 8ec4be8e6..9ce54f6c7 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -128,6 +128,5 @@ Rails.application.configure do config.x.new_team_on_signup = true else config.x.new_team_on_signup = false - config.x.enable_tutorial = false end end diff --git a/config/environments/production.rb b/config/environments/production.rb index a9683c26e..1d305a383 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -162,6 +162,5 @@ Rails.application.configure do config.x.new_team_on_signup = true else config.x.new_team_on_signup = false - config.x.enable_tutorial = false end end