Merge branch 'zd_SCI_338'

This commit is contained in:
zmagod 2016-08-26 16:32:49 +02:00
commit d886d05ccb
11 changed files with 175 additions and 36 deletions

View file

@ -3476,14 +3476,12 @@ function canvas_tutorial_helper(){
.css({'pointer-events': 'none'});
});
}
$( document ).ajaxComplete(function() {
$('#canvas-new-module')
.css({'pointer-events': 'none'});
});
});
$( document ).ajaxComplete(function() {
if( $('div').hasClass('introjs-showElement') ){
$('#canvas-new-module')
.css({'pointer-events': 'none'});
}
});
}
function restore_after_tutorial(){

View file

@ -423,7 +423,9 @@
$introjs
.setOptions({
overlayOpacity: '0.2',
hidePrev: true,
nextLabel: 'Next',
prevLabel: 'Back',
doneLabel: 'End tutorial',
skipLabel: 'End tutorial',
showBullets: false,
@ -470,6 +472,7 @@
}
else if (goToStep > 18) {
var archiveProjectTutorial = $("#projects-toolbar").attr("data-archive-project-step-text");
var goodbye_message = $("#projects-toolbar").attr("data-goodbye-tutorial");
Cookies.set('current_tutorial_step', '20');
var position = "right";
if (demoProject.offset().left > window.innerWidth / 2 || window.innerWidth < demoProject.width() + 100) {
@ -486,15 +489,20 @@
element: document.getElementById(demoProjectId),
intro: archiveProjectTutorial,
position: position
},{
element: document.getElementsByClassName("avatar")[0],
intro: goodbye_message
}],
overlayOpacity: '0.2',
doneLabel: 'Start using sciNote',
nextLabel: 'Next',
skipLabel: 'End tutorial',
showBullets: false,
showStepNumbers: false,
disableInteraction: true,
exitOnOverlayClick: false,
exitOnEsc: false,
tooltipClass: 'custom disabled-next'
tooltipClass: 'custom next-page-link'
})
.oncomplete(function () {
Cookies.remove('tutorial_data');
@ -531,6 +539,11 @@
.css({
'pointer-events': 'none',
'color': '#d2d2d2'});
$(el)
.find('[data-action="edit"]')
.css({
'pointer-events': 'none',
'color': '#d2d2d2'});
});
}
});
@ -549,12 +562,15 @@
.css({
'pointer-events': 'auto',
'color': '#262626'});
$(el)
.find('[data-action="edit"]')
.css({
'pointer-events': 'auto',
'color': '#262626'});
});
}
init();
project_tutorial_helper();
}());

View file

@ -63,3 +63,97 @@
// init
init();
})();
/* Initialize the first-time demo tutorial if needed. */
(function(){
function initializeTutorial() {
if (showTutorial()) {
introJs()
.setOptions({
overlayOpacity: '0.2',
hidePrev: true,
nextLabel: 'Next',
doneLabel: 'End tutorial',
skipLabel: 'End tutorial',
showBullets: false,
showStepNumbers: false,
exitOnOverlayClick: false,
exitOnEsc: false,
tooltipClass: 'custom next-page-link',
disableInteraction: true
})
.onafterchange(function (tarEl) {
Cookies.set('current_tutorial_step', this._currentStep + 2);
if (this._currentStep == 1) {
setTimeout(function() {
$('.next-page-link a.introjs-nextbutton')
.removeClass('introjs-disabled')
.attr('href', $('[data-canvas-link]').data('canvasLink'));
$('.introjs-disableInteraction').remove();
}, 500);
} else {
}
})
.start();
window.onresize = function() {
if (Cookies.get('current_tutorial_step') == 4 ) {
$(".introjs-tooltip").css("right", ($(".new-element.initial").width() + 60) + "px");
}
};
// 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');
restore_after_tutorial();
});
});
}
}
function showTutorial() {
var tutorialData;
if (Cookies.get('tutorial_data'))
tutorialData = JSON.parse(Cookies.get('tutorial_data'));
else
return false;
var currentStep = Cookies.get('current_tutorial_step');
if (currentStep < 3 || currentStep > 5)
return false;
var tutorialProjectId = tutorialData[0].project;
var currentProjectId = $("#data-holder").attr("data-project-id");
return tutorialProjectId == currentProjectId;
}
function project_tutorial_helper(){
$(document).ready(function(){
if( $('div').hasClass('introjs-overlay')){
$.each( $(".dropdown-experiment-actions").find("li"),
function(){
$(this).css({ 'pointer-events': 'none' });
});
}
});
}
function restore_after_tutorial(){
$.each( $(".dropdown-experiment-actions").find("li"),
function(){
$(this).css({ 'pointer-events': 'auto' });
});
}
$(document).ready(function(){
initializeTutorial();
project_tutorial_helper();
});
})();

View file

@ -171,7 +171,7 @@ function initTutorial() {
.setOptions({
steps: [
{
element: document.getElementById("samples-toolbar"),
element: document.getElementById("importSamplesButton"),
intro: samplesTutorial
},
{

View file

@ -1116,7 +1116,11 @@ html.turbolinks-progress-bar::before {
}
.custom .introjs-prevbutton {
display: none ;
display: none;
}
.custom .introjs-disabled {
display: none;
}
.custom .introjs-skipbutton {
@ -1170,6 +1174,7 @@ html.turbolinks-progress-bar::before {
margin-right: 5px;
}
// Comments
.dropdown.dropdown-comment {

View file

@ -813,6 +813,9 @@ module FirstTimeDataGenerator
)
)
# create thumbnail
experiment.generate_workflow_img
# Lastly, create cookie with according ids
# so tutorial steps can be properly positioned
JSON.generate([

View file

@ -2,15 +2,19 @@
<%= render partial: "shared/sidebar" %>
<%= render partial: "shared/secondary_navigation" %>
<div id="diagram-buttons" data-intro="<%=t ('tutorial.canvas_click_edit_workflow_html') %>" data-step="5" data-position="left">
<div id="diagram-buttons">
<% if can_edit_canvas(@experiment) %>
<%=link_to canvas_edit_experiment_url(@experiment),
remote: true,
type: "button",
id: "edit-canvas-button",
class: "ajax btn btn-default",
"data-action" => "edit" do %>
type: 'button',
id: 'edit-canvas-button',
class: 'ajax btn btn-default',
data: {
action: 'edit',
intro: t('tutorial.canvas_click_edit_workflow_html'),
step: '5',
position: 'left'
} do %>
<span class="glyphicon glyphicon-pencil"></span>
<%= t('experiments.canvas.canvas_edit') %>
<% end %>

View file

@ -57,7 +57,9 @@
data-intro="<%=t 'tutorial.tutorial_welcome_title_html' %>"
data-position='bottom'
data-project-options-step-text="<%=t 'tutorial.project_options_html' %>"
data-archive-project-step-text="<%=t 'tutorial.archive_project_html' %>">
data-archive-project-step-text="<%=t 'tutorial.archive_project_html' %>"
data-goodbye-tutorial="<%=t 'tutorial.goodbye_message' %>"
>
<form class="form-inline" action="<%= projects_path %>">

View file

@ -3,7 +3,9 @@
<%= render partial: "shared/secondary_navigation" %>
<div class="row">
<div class="col-sm-12">
<div class="col-sm-12"
id="data-holder"
data-project-id="<%= @project.id %>">
<% if can_create_experiment(@project) %>
<div class="row">
<div class="col-sm-12">
@ -11,7 +13,12 @@
remote: true,
type: "button",
id: 'new-experiment',
class: "btn btn-primary pull-right" do %>
class: 'btn btn-primary pull-right',
data: {
intro: t('tutorial.create_experiment_html'),
step: '4',
position: 'left'
} do %>
<span class="glyphicon glyphicon-plus"></span>
<%= t('experiments.new.create') %>
<% end %>

View file

@ -1,6 +1,12 @@
<div class="col-md-6">
<div class="panel panel-default experiment-panel"
data-id="<%= experiment.id %>">
data-id="<%= experiment.id %>"
data-intro="<%= t('tutorial.edit_experiment_html') %>"
data-step="5"
data-position="right"
data-canvas-link="<%= canvas_experiment_url(experiment) %>"
disableInteraction="true"
>
<div class="panel-heading">
<% if can_view_experiment_actions experiment %>
<div class="dropdown pull-right">

View file

@ -1457,26 +1457,29 @@ en:
skip_tutorial: "Skip tutorial"
end_tutorial: "End tutorial"
finish_tutorial: "Start using sciNote"
tutorial_welcome_title_html: "Welcome to <em>sciNote</em>"
create_project_html: "<em>sciNote</em> organizes your work in projects. Click here to create a project and it will appear under the Team you've chosen. Choose public <span class='glyphicon glyphicon-eye-open'></span> if you want everyone from the team to view the project or choose private <span class='glyphicon glyphicon-eye-close'></span> so only the people who you invite to the project can see it."
project_options_html: "In the bottom row of the project box you can view and add comments <span class='glyphicon glyphicon-comment'></span>, invite collaborators <span class='glyphicon glyphicon-user'></span>, and see the latest activity <span class='glyphicon glyphicon-equalizer'></span> and notifications <span class='glyphicon glyphicon-bell'></span>. You can also edit the project's name and visibility or archive it. You can recall the project from the archive <span class='glyphicon glyphicon-briefcase'></span> at any time. Click on the project name <strong>Demo project - qPCR</strong> to continue."
canvas_overview_html: "A task is a basic unit of your experiment. Within a task, you can add protocols, results and add samples. You can connect tasks into workflows to assure traceability of your work. You can grab the task or entire workflow and move it in all directions on the canvas."
canvas_click_edit_workflow_html: " Click <strong>Edit workflow</strong> to add tasks or modify your existing workflow."
tutorial_welcome_title_html: 'Welcome to <em>sciNote</em>, your electronic lab notebook. sciNote organizes your work in projects. Click <strong>Show projects from</strong> to choose how you want to view your projects. You can also reorder them by clicking the <strong>Sort by</strong> button.'
create_project_html: "Click here to create a project and it will appear under the Team you've chosen. Choose public <span class='glyphicon glyphicon-eye-open'></span> if you want everyone from the team to view the project or choose private <span class='glyphicon glyphicon-eye-close'></span> so only the people who you invite to the project can see it."
project_options_html: "In the bottom row of the project card you can check the latest activity <span class='glyphicon glyphicon-equalizer'></span>, invite collaborators <span class='glyphicon glyphicon-user'></span>, see the notifications <span class='glyphicon glyphicon-bell'></span> and write comments <span class='glyphicon glyphicon-comment'></span>. You can also edit the project's name and visibility or archive it. You can recall the project from the archive <span class='glyphicon glyphicon-briefcase'></span> in the top right side of the dashboard at any time."
create_experiment_html: "Inside of a project you can create experiments. To create one click on this button and edit experiments name and description."
edit_experiment_html: "By clicking on the down arrow <span class='caret'></span> of an experiment card you can choose between different actions. You can Edit details to the experiment, such as experiment name and description, Clone it inside of a project, where cloned experiment is identical to the original one, Move it from one project to another or Archive it in the archive <span class='glyphicon glyphicon-briefcase'></span>."
canvas_overview_html: "A task is a basic unit of your experiment. Within a task, you can add protocols, results and add samples. You can connect tasks into workflows to assure traceability of your work."
canvas_click_edit_workflow_html: " Click <strong>Edit workflow</strong> to add new tasks or to modify an existing workflow."
edit_workflow_html: "To add a new task to the workflow, click on <strong>New task</strong> and drag it onto canvas."
edit_workflow_click_save_html: "Click <strong>Save workflow</strong> to save the changes you've made."
sidebar_html: "Browse the contents in the folder structure or navigate to a specific task on the canvas by clicking the navigate icon <span class='glyphicon glyphicon-map-marker'></span>."
edit_workflow_click_save_html: "Click <strong>Save workflow</strong> to save changes youve made to the workflow."
sidebar_html: "Navigation bar helps you orient on which experiment you are currently working. It also helps you to find a specific task on the canvas by clicking the navigate icon <span class='glyphicon glyphicon-map-marker'></span>. The line that follows down the tasks on their left side signifies they are connected into a workflow."
sidebar_click_module_html: "Click on the task name <strong>qPCR</strong> to see its contents."
module_protocols_html: "Add steps to a protocol, create checklists or upload existing protocol files. After finishing one step, click <strong>Complete step</strong> to proceed to the next step. Exact time and the person who completed the step are recorded and can be seen at any time in <strong>Activity</strong> tab."
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 <strong>Complete step</strong> button. Exact time and the person who completed the step are recorded and can be seen in the <strong>Activity</strong> tab in the top right side of the dashboard."
module_protocols_click_results_html: "Click on the <strong>Results</strong> tab to upload experiment results."
module_results_html: "You can upload any type of a file, insert table or write comments."
module_results_click_samples_html: "Click on the <strong>Samples</strong> tab to import, export or assign samples to the task."
samples_html: "You can easily import sample tables from Excel or tab-delimited files. If you assign samples to one task in a workflow, these samples will be automatically assigned to downstream tasks."
breadcrumbs_html: "You can always use these breadcrumbs to navigate back. Click on the <strong>Reports</strong> tab to go to <strong>Demo project - qPCR</strong> reports page."
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."
breadcrumbs_html: "You can always use these breadcrumbs to navigate all the way back to the dashboard. Click on the <strong>Reports</strong> tab to generate reports for meetings, projects, patents or thesis."
reports_index_html: "You can automatically generate reports for meetings, projects, patents or theses."
reports_index_click_new_report_html: "Click <strong>New report</strong> to create a new report."
new_report_html: "To add report elements to the report, click on the <strong>—+—</strong> sign on the sheet. Select the report contents in the tabs and click <strong>Add to report</strong>. You can save the report as a PDF on your computer or save it within sciNote to view and modify later."
reports_index_click_new_report_html: "When inside of <strong>Reports</strong>, click the <strong>New report</strong> button to create a new report."
new_report_html: "To add report elements to the report, click on the <strong>—+—</strong> sign on the sheet. Select the report contents in the tabs and click <strong>Add to report</strong>. You can save the report as a PDF on your computer or save it within sciNote for later viewing and modification."
new_report_click_org_html: "Click on <strong>%{private_org}</strong> in breadcrumbs to return to the Dashboard."
archive_project_html: "Archive demo project by clicking on the down arrow <span class='glyphicon glyphicon-triangle-bottom'></span>. You can always access the archive by clicking the <span class='glyphicon glyphicon-briefcase'></span> button on the top right side of the dashboard and restore any item you have archived."
archive_project_html: "Archive Demo project - qPCR by clicking on the down arrow <span class='glyphicon glyphicon-triangle-bottom'></span>. You can always access the archive by clicking the <span class='glyphicon glyphicon-briefcase'></span> icon on the top right side of the dashboard and restore any item you have archived."
goodbye_message: "To repeat the tutorial, go to your Settings and open <strong>My preferences</strong> tab. Click on the <strong>Repeat tutorial</strong> button and watch the tutorial as many times needed."
introductory:
popup-title: "Dear sciNote user,"
@ -1487,6 +1490,7 @@ en:
sentence_five_html: "2. In the Options dropdown of any task select Move workflow to another experiment."
sentence_six_html: "3. Select experiment from the dropdown and click Move workflow. The workflow is now part of the selected experiment. So you can still have multiple workflows in one experiment."
confim: "OK, got it"
# This section contains general words that can be used in any parts of
# application.