mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-06 12:43:06 +08:00
Fixed tutorial step numbers and changed getting next page reference on protocols page.
This commit is contained in:
parent
92d990a715
commit
c8eb82cc85
11 changed files with 39 additions and 61 deletions
|
@ -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() {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% if !defined? initial then initial = false end %>
|
||||
<div class="new-element <%= "hidden" if hide %> <%= "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 %>>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ul class="breadcrumb" style="margin-left: 15px;">
|
||||
<li>
|
||||
<% if can_view_projects(@project.organization) %>
|
||||
<a id="organization-link" href="<%= projects_path :organization => @project.organization.id %>" data-intro="<%=t 'tutorial.new_report_click_org_html', private_org: @project.organization.name %>" data-step="20">
|
||||
<a id="organization-link" href="<%= projects_path :organization => @project.organization.id %>" data-intro="<%=t 'tutorial.new_report_click_org_html', private_org: @project.organization.name %>" data-step="21" data-position="left">
|
||||
<% end %>
|
||||
<span class="hidden-sm hidden-md hidden-lg">Org</span>
|
||||
<span class="hidden-xs"><%= @project.organization.name %></span>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%= protocols_path %>">
|
||||
<a id="protocol-link" href="<%= protocols_path %>">
|
||||
<span class="glyphicon glyphicon-list-alt"></span>
|
||||
<span class="visible-xs-inline visible-sm-inline"><%= t('nav.label.protocols') %></span>
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue