diff --git a/app/assets/javascripts/my_modules/protocols.js b/app/assets/javascripts/my_modules/protocols.js index d648e837e..311c3fbda 100644 --- a/app/assets/javascripts/my_modules/protocols.js +++ b/app/assets/javascripts/my_modules/protocols.js @@ -125,13 +125,18 @@ function initTutorial() { var steps = [{ intro: $("[data-role='tutorial-data']") .attr('data-module-protocols-step-text') + }, { + element: $('#protocol-copy-to-repository')[0], + intro: $("[data-role='tutorial-data']") + .attr('data-module-protocols-save-step-text'), + position: 'right' }, { element: resultsTab[0], intro: $("[data-role='tutorial-data']") .attr('data-module-protocols-click-results-step-text'), position: 'right' }]; - initPageTutorialSteps(12, 13, nextPage, function() {}, function() {}, steps); + initPageTutorialSteps(12, 14, nextPage, function() {}, function() {}, steps); } function initCopyToRepository() { diff --git a/app/assets/javascripts/my_modules/results.js.erb b/app/assets/javascripts/my_modules/results.js.erb index 491e20028..7cb702f7b 100644 --- a/app/assets/javascripts/my_modules/results.js.erb +++ b/app/assets/javascripts/my_modules/results.js.erb @@ -135,7 +135,7 @@ function initTutorial() { .attr('data-module-protocols-click-samples-step-text'), position: 'left' }]; - initPageTutorialSteps(14, 15, nextPage, function() {}, function() {}, steps); + initPageTutorialSteps(15, 16, nextPage, function() {}, function() {}, steps); } var ResultTypeEnum = Object.freeze({ diff --git a/app/assets/javascripts/projects/index.js.erb b/app/assets/javascripts/projects/index.js.erb index 80e187125..e2439ba6a 100644 --- a/app/assets/javascripts/projects/index.js.erb +++ b/app/assets/javascripts/projects/index.js.erb @@ -354,7 +354,7 @@ $('#' + demoProjectId + '-project-canvas-link').attr('href'); initPageTutorialSteps(1, 3, nextPage, tutorialBeforeCb, tutorialAfterCb); - } else if (stepNum >= 21 && stepNum <= 22) { + } else if (stepNum >= 24 && stepNum <= 25) { var demoProject = $('#' + demoProjectId); var firstStepPos = 'right'; if (demoProject.offset().left > window.innerWidth / 2 || @@ -369,7 +369,7 @@ var nextPage = $('#new-report-btn').attr('href'); var steps = [{ - element: $(demoProjectId)[0], + element: $('#' + demoProjectId)[0], intro: $('#projects-toolbar') .attr('data-archive-project-step-text'), position: firstStepPos @@ -378,7 +378,7 @@ intro: $('#projects-toolbar').attr('data-goodbye-tutorial'), position: 'left' }]; - initPageTutorialSteps(21, 22, nextPage, function() {}, function() {}, + initPageTutorialSteps(24, 25, nextPage, function() {}, function() {}, steps); } } diff --git a/app/assets/javascripts/protocols/index.js b/app/assets/javascripts/protocols/index.js index 649e2b723..f1c83be26 100644 --- a/app/assets/javascripts/protocols/index.js +++ b/app/assets/javascripts/protocols/index.js @@ -8,6 +8,21 @@ var protocolsTableEl = null; var protocolsDatatable = null; var repositoryType; +/** + * Initializes page + */ +function init() { + updateButtons(); + initProtocolsTable(); + initRowSelection(); + initKeywordFiltering(); + initLinkedChildrenModal(); + initCreateNewModal(); + initModals(); + initImport(); + initTutorial(); +} + // Initialize protocols DataTable function initProtocolsTable() { protocolsTableEl = $("#protocols-table"); @@ -698,54 +713,12 @@ function initImport() { }); } -/* Initilize first-time tutorial if needed */ +/** + * Initializes tutorial + */ function initTutorial() { - var currentStep = Cookies.get('current_tutorial_step'); - var protocolButtons = $('.nav-tab .nav-settings').get(0); - if (currentStep && (currentStep > 20 && currentStep < 23)) { - introJs() - .setOptions({ - overlayOpacity: '0.1', - nextLabel: 'Next', - doneLabel: 'End tutorial', - skipLabel: 'End tutorial', - showBullets: false, - showStepNumbers: false, - exitOnOverlayClick: false, - exitOnEsc: false, - tooltipClass: 'custom' - }) - .onafterchange(function() { - Cookies.set('current_tutorial_step', this._currentStep + 22); - - if (this._currentStep === 1) { - Cookies.set('current_tutorial_step', this._currentStep + 22); - setTimeout(function() { - $('.introjs-tooltipbuttons a.introjs-nextbutton') - .removeClass('introjs-disabled') - .attr('href', '/'); - }, 500); - } - }).start(); - - // Destroy first-time tutorial cookies when skip tutorial - // or end tutorial is clicked - $('.introjs-skipbutton').each(function() { - $(this).click(function() { - Cookies.remove('tutorial_data'); - Cookies.remove('current_tutorial_step'); - }); - }); - } + var nextPage = $('.navbar-brand').attr('href'); + initPageTutorialSteps(22, 23, nextPage, function() {}, function() {}); } -// Initialize everything -updateButtons(); -initProtocolsTable(); -initRowSelection(); -initKeywordFiltering(); -initLinkedChildrenModal(); -initCreateNewModal(); -initModals(); -initImport(); -initTutorial(); +init(); diff --git a/app/assets/javascripts/reports/index.js b/app/assets/javascripts/reports/index.js index ee2712aaa..b04da367d 100644 --- a/app/assets/javascripts/reports/index.js +++ b/app/assets/javascripts/reports/index.js @@ -173,7 +173,7 @@ intro: $('#content').attr('data-reports-click-new-report-step-text'), position: 'right' }]; - initPageTutorialSteps(18, 18, nextPage, function() {}, function() {}, + initPageTutorialSteps(19, 19, nextPage, function() {}, function() {}, steps); } diff --git a/app/assets/javascripts/reports/new.js.erb b/app/assets/javascripts/reports/new.js.erb index f85539d38..d98ef7bbd 100644 --- a/app/assets/javascripts/reports/new.js.erb +++ b/app/assets/javascripts/reports/new.js.erb @@ -1149,8 +1149,8 @@ function initializeReportSidebartruncation() { function initTutorial() { ignoreUnsavedWorkAlert = true; - var nextPage = $('#organization-link').attr('href'); - initPageTutorialSteps(19, 20, nextPage, function() {}, function() { + var nextPage = $('#protocol-link').attr('href'); + initPageTutorialSteps(20, 21, nextPage, function() {}, function() { ignoreUnsavedWorkAlert = false; }); } diff --git a/app/assets/javascripts/samples/samples.js b/app/assets/javascripts/samples/samples.js index 73ae5cf26..a0627f3ff 100644 --- a/app/assets/javascripts/samples/samples.js +++ b/app/assets/javascripts/samples/samples.js @@ -167,7 +167,7 @@ function initTutorial() { element: $('#secondary-menu')[0], intro: $('#samples-toolbar').attr('data-breadcrumbs-step-text') }]; - initPageTutorialSteps(16, 17, nextPage, function() {}, function() {}, steps); + 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 8a4f4dfec..cb07b1e8e 100644 --- a/app/assets/javascripts/sitewide/utils.js +++ b/app/assets/javascripts/sitewide/utils.js @@ -26,7 +26,7 @@ $.fn.onAjaxComplete = function (cb) { }); } -var TUTORIAL_STEPS_CNT = 22; +var TUTORIAL_STEPS_CNT = 25; /** * Initializes tutorial steps for the current page. diff --git a/app/views/reports/elements/_new_element.html.erb b/app/views/reports/elements/_new_element.html.erb index 9d3e09b95..f5089fdfc 100644 --- a/app/views/reports/elements/_new_element.html.erb +++ b/app/views/reports/elements/_new_element.html.erb @@ -2,7 +2,7 @@ <% if !defined? initial then initial = false end %>
<%= "initial" if initial %>" data-ts="ignore" data-type="new" title="<%=t "projects.reports.elements.new_element.title" %>" <% if initial %> - data-step="19" + data-step="20" data-position="left" data-intro="<%=t 'tutorial.new_report_html' %>" <% end %>> diff --git a/app/views/reports/new/_report_navigation.html.erb b/app/views/reports/new/_report_navigation.html.erb index d4809d897..61161a9df 100644 --- a/app/views/reports/new/_report_navigation.html.erb +++ b/app/views/reports/new/_report_navigation.html.erb @@ -5,7 +5,7 @@