[FIX] Make tour declarative to enable autotests
bzr revid: ddm@openerp.com-20131206133239-mrhduf2fi0sm8sh7
This commit is contained in:
@@ -207,17 +207,17 @@
|
||||
self.make_active($target);
|
||||
});
|
||||
},
|
||||
snippet_blur: function ($snipped_id) {
|
||||
if ($snipped_id) {
|
||||
if ($snipped_id.data("snippet-editor")) {
|
||||
$snipped_id.data("snippet-editor").onBlur();
|
||||
snippet_blur: function ($snippet) {
|
||||
if ($snippet) {
|
||||
if ($snippet.data("snippet-editor")) {
|
||||
$snippet.data("snippet-editor").onBlur();
|
||||
}
|
||||
}
|
||||
},
|
||||
snippet_focus: function ($snipped_id) {
|
||||
if ($snipped_id) {
|
||||
if ($snipped_id.data("snippet-editor")) {
|
||||
$snipped_id.data("snippet-editor").onFocus();
|
||||
snippet_focus: function ($snippet) {
|
||||
if ($snippet) {
|
||||
if ($snippet.data("snippet-editor")) {
|
||||
$snippet.data("snippet-editor").onFocus();
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -230,31 +230,34 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
make_active: function ($snipped_id) {
|
||||
if ($snipped_id && this.$active_snipped_id && this.$active_snipped_id.get(0) === $snipped_id.get(0)) {
|
||||
make_active: function ($snippet) {
|
||||
if ($snippet && this.$active_snipped_id && this.$active_snipped_id.get(0) === $snippet.get(0)) {
|
||||
return;
|
||||
}
|
||||
if (this.$active_snipped_id) {
|
||||
this.snippet_blur(this.$active_snipped_id);
|
||||
this.$active_snipped_id = false;
|
||||
}
|
||||
if ($snipped_id && $snipped_id.length) {
|
||||
if(_.indexOf(this.snippets, $snipped_id.get(0)) === -1) {
|
||||
this.snippets.push($snipped_id.get(0));
|
||||
if ($snippet && $snippet.length) {
|
||||
if(_.indexOf(this.snippets, $snippet.get(0)) === -1) {
|
||||
this.snippets.push($snippet.get(0));
|
||||
}
|
||||
this.$active_snipped_id = $snipped_id;
|
||||
this.$active_snipped_id = $snippet;
|
||||
this.create_overlay(this.$active_snipped_id);
|
||||
this.snippet_focus($snipped_id);
|
||||
this.snippet_focus($snippet);
|
||||
}
|
||||
if (_.isFunction($snippet.trigger)) {
|
||||
$snippet.trigger('tour:snippet_activated');
|
||||
}
|
||||
},
|
||||
create_overlay: function ($snipped_id) {
|
||||
if (typeof $snipped_id.data("snippet-editor") === 'undefined') {
|
||||
var $targets = this.activate_overlay_zones($snipped_id);
|
||||
create_overlay: function ($snippet) {
|
||||
if (typeof $snippet.data("snippet-editor") === 'undefined') {
|
||||
var $targets = this.activate_overlay_zones($snippet);
|
||||
if (!$targets.length) return;
|
||||
var editor = website.snippet.editorRegistry[$snipped_id.data("snippet-id")] || website.snippet.editorRegistry.resize;
|
||||
$snipped_id.data("snippet-editor", new editor(this, $snipped_id));
|
||||
var editor = website.snippet.editorRegistry[$snippet.data("snippet-id")] || website.snippet.editorRegistry.resize;
|
||||
$snippet.data("snippet-editor", new editor(this, $snippet));
|
||||
}
|
||||
this.cover_target($snipped_id.data('overlay'), $snipped_id);
|
||||
this.cover_target($snippet.data('overlay'), $snippet);
|
||||
},
|
||||
|
||||
path_eval: function(path){
|
||||
@@ -869,7 +872,7 @@
|
||||
var editor = new Editor(self, self.$target, val['snippet-style-id']);
|
||||
$ul.prepend(editor.$el);
|
||||
});
|
||||
|
||||
|
||||
if ($ul.find("li").length) {
|
||||
$styles.removeClass("hidden");
|
||||
}
|
||||
@@ -1149,7 +1152,7 @@
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
website.snippet.editorRegistry.slider = website.snippet.editorRegistry.resize.extend({
|
||||
drop_and_build_snippet: function() {
|
||||
var id = $(".carousel").length;
|
||||
@@ -1224,7 +1227,7 @@
|
||||
var new_index = 0;
|
||||
var cycle = this.$inner.find('.item').length - 1;
|
||||
var index = this.$inner.find('.item.active').index();
|
||||
|
||||
|
||||
if (cycle > 0) {
|
||||
this.remove_process = true;
|
||||
var $el = this.$inner.find('.item.active');
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
});
|
||||
|
||||
website.BannerTour = website.Tour.extend({
|
||||
id: 'banner-tutorial',
|
||||
id: 'banner',
|
||||
name: "Insert a banner",
|
||||
startPath: '/page/website.homepage',
|
||||
init: function (editor) {
|
||||
@@ -19,11 +19,10 @@
|
||||
self.steps = [
|
||||
{
|
||||
stepId: 'welcome',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "Welcome to your website!",
|
||||
content: "This tutorial will guide you to build your home page. We will start by adding a banner.",
|
||||
template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
stepId: 'edit-page',
|
||||
@@ -31,8 +30,10 @@
|
||||
placement: 'bottom',
|
||||
title: "Edit this page",
|
||||
content: "Every page of your website can be modified through the <i>Edit</i> button.",
|
||||
triggers: function () {
|
||||
editor.on('tour:editor_bar_loaded', self, self.moveToNextStep);
|
||||
trigger: {
|
||||
emitter: editor,
|
||||
type: 'openerp',
|
||||
id: 'tour:editor_bar_loaded',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -41,11 +42,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Insert building blocks",
|
||||
content: "To add content in a page, you can insert building blocks.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
}
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-banner',
|
||||
@@ -53,9 +50,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a Banner",
|
||||
content: "Drag the Banner block and drop it in your page.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'edit-title',
|
||||
@@ -64,7 +59,7 @@
|
||||
title: "Customize banner's text",
|
||||
content: "Click in the text and start editing it. Click continue once it's done.",
|
||||
template: self.popover({ next: "Continue" }),
|
||||
triggers: function () {
|
||||
onStart: function () {
|
||||
var $banner = $("#wrap [data-snippet-id=carousel]:first");
|
||||
if ($banner.length) {
|
||||
$banner.click();
|
||||
@@ -85,11 +80,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Add Another Block",
|
||||
content: "Let's add another building block to your page.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
}
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-three-columns',
|
||||
@@ -97,9 +88,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a Block",
|
||||
content: "Drag the <em>'3 Columns'</em> block and drop it below the banner.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'activate-text-block-title',
|
||||
@@ -107,31 +96,28 @@
|
||||
placement: 'top',
|
||||
title: "Edit an Area",
|
||||
content: "Select any area of the page to modify it. Click on this subtitle.",
|
||||
triggers: function () {
|
||||
$('#wrap [data-snippet-id=three-columns] .text-center[data-snippet-id=colmd]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
trigger: {
|
||||
id: 'tour:snippet_activated'
|
||||
},
|
||||
},
|
||||
{
|
||||
stepId: 'remove-text-block-title',
|
||||
element: '.ui-draggable.oe_active .oe_snippet_remove',
|
||||
placement: 'top',
|
||||
reflex: true,
|
||||
title: "Delete the Title",
|
||||
content: "From this toolbar you can move, duplicate or delete the selected zone. Click on the trash can to delete the title.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'save-changes',
|
||||
element: 'button[data-action=save]',
|
||||
placement: 'right',
|
||||
reflex: true,
|
||||
title: "Save your modifications",
|
||||
content: "Publish your page by clicking on the <em>'Save'</em> button.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'part-2',
|
||||
orphan: true,
|
||||
title: "Congratulation!",
|
||||
content: "Your homepage has been updated.",
|
||||
template: self.popover({ next: "Continue" }),
|
||||
@@ -142,35 +128,31 @@
|
||||
placement: 'bottom',
|
||||
title: "Test Your Mobile Version",
|
||||
content: "Let's check how your homepage looks like on mobile devices.",
|
||||
triggers: function () {
|
||||
$(document).one('shown.bs.modal', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
}
|
||||
trigger: {
|
||||
emitter: $(document),
|
||||
id: 'shown.bs.modal',
|
||||
},
|
||||
},
|
||||
{
|
||||
stepId: 'show-mobile-close',
|
||||
element: 'button[data-dismiss=modal]',
|
||||
placement: 'right',
|
||||
reflex: true,
|
||||
title: "Close Mobile Preview",
|
||||
content: "Scroll in the mobile preview to test the rendering. Once it's ok, close this dialog.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'show-tutorials',
|
||||
element: '#help-menu-button',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "More Tutorials",
|
||||
content: "Get more tutorials through this <em>'Help'</em> menu or click on the left <em>'Edit'</em> button to continue modifying this page.",
|
||||
template: self.popover({ end: "Close Tutorial" }),
|
||||
trigger: 'click',
|
||||
}
|
||||
];
|
||||
return this._super();
|
||||
},
|
||||
resume: function () {
|
||||
return this.isCurrentStep('part-2') && this._super();
|
||||
},
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
@@ -14,49 +14,76 @@
|
||||
storage: this.tourStorage,
|
||||
keyboard: false,
|
||||
template: this.popover(),
|
||||
onHide: function () {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
});
|
||||
this.registerSteps();
|
||||
},
|
||||
registerSteps: function () {
|
||||
var self = this;
|
||||
this.tour.addSteps(_.map(this.steps, function (step) {
|
||||
step.title = openerp.qweb.render('website.tour_popover_title', { title: step.title });
|
||||
if (step.modal) {
|
||||
step.onShow = function () {
|
||||
var $doc = $(document);
|
||||
function onStop () {
|
||||
if (step.modal.stopOnClose) {
|
||||
self.stop();
|
||||
}
|
||||
}
|
||||
$doc.on('hide.bs.modal', onStop);
|
||||
$doc.one('shown.bs.modal', function () {
|
||||
$('.modal button.btn-primary').one('click', function () {
|
||||
$doc.off('hide.bs.modal', onStop);
|
||||
self.moveToStep(step.modal.afterSubmit);
|
||||
step.title = openerp.qweb.render('website.tour_popover_title', { title: step.title });
|
||||
if (!step.element) {
|
||||
step.orphan = true;
|
||||
}
|
||||
if (step.trigger) {
|
||||
if (step.trigger === 'click') {
|
||||
step.triggers = function (callback) {
|
||||
$(step.element).one('click', function () {
|
||||
(callback || self.moveToNextStep).call(self);
|
||||
});
|
||||
self.moveToNextStep();
|
||||
});
|
||||
};
|
||||
} else if (step.trigger === 'drag') {
|
||||
step.triggers = function (callback) {
|
||||
self.onSnippetDragged(callback || self.moveToNextStep);
|
||||
};
|
||||
} else if (step.trigger && step.trigger.id) {
|
||||
if (step.trigger.emitter && step.trigger.type === 'openerp') {
|
||||
step.triggers = function (callback) {
|
||||
step.trigger.emitter.on(step.trigger.id, self, function customHandler () {
|
||||
step.trigger.emitter.off(step.trigger.id, customHandler);
|
||||
(callback || self.moveToNextStep).apply(self, arguments);
|
||||
});
|
||||
};
|
||||
} else {
|
||||
step.triggers = function (callback) {
|
||||
var emitter = step.trigger.emitter || $(step.element);
|
||||
emitter.one(step.trigger.id, function customHandler () {
|
||||
(callback || self.moveToNextStep).apply(self, arguments);
|
||||
});
|
||||
};
|
||||
}
|
||||
} else if (step.trigger.modal) {
|
||||
step.triggers = function (callback) {
|
||||
var $doc = $(document);
|
||||
function onStop () {
|
||||
if (step.trigger.modal.stopOnClose) {
|
||||
self.stop();
|
||||
}
|
||||
}
|
||||
$doc.on('hide.bs.modal', onStop);
|
||||
$doc.one('shown.bs.modal', function () {
|
||||
$('.modal button.btn-primary').one('click', function () {
|
||||
$doc.off('hide.bs.modal', onStop);
|
||||
self.moveToStep(step.trigger.modal.afterSubmit);
|
||||
});
|
||||
(callback || self.moveToNextStep).call(self);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
step.onShow = (function () {
|
||||
var executed = false;
|
||||
return function () {
|
||||
if (!executed) {
|
||||
_.isFunction(step.onStart) && step.onStart();
|
||||
_.isFunction(step.triggers) && step.triggers();
|
||||
executed = true;
|
||||
}
|
||||
};
|
||||
} else if (step.triggers) {
|
||||
step.onShow = (function () {
|
||||
var executed = false;
|
||||
return function () {
|
||||
if (!executed) {
|
||||
step.triggers();
|
||||
executed = true;
|
||||
}
|
||||
};
|
||||
}());
|
||||
} else if (step.reflex) {
|
||||
step.onShow = function () {
|
||||
$(step.element).one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
};
|
||||
delete step.reflex;
|
||||
}
|
||||
return step;
|
||||
}());
|
||||
return step;
|
||||
}));
|
||||
},
|
||||
reset: function () {
|
||||
@@ -108,7 +135,7 @@
|
||||
redirect: function (url) {
|
||||
url = url || new website.UrlParser(window.location.href);
|
||||
var path = (this.startPath && url.pathname !== this.startPath) ? this.startPath : url.pathname;
|
||||
var search = url.addToSearch(this.id + "=true");
|
||||
var search = url.activateTutorial(this.id);
|
||||
var newUrl = path + search;
|
||||
window.location.replace(newUrl);
|
||||
},
|
||||
@@ -122,8 +149,7 @@
|
||||
trigger: function (url) {
|
||||
// Override if necessary
|
||||
url = url || new website.UrlParser(window.location.href);
|
||||
var urlTrigger = this.id + "=true";
|
||||
return url.search.indexOf(urlTrigger) >= 0;
|
||||
return url.isActive(this.id);
|
||||
},
|
||||
testUrl: function (pattern) {
|
||||
var url = new website.UrlParser(window.location.href);
|
||||
@@ -132,21 +158,22 @@
|
||||
popover: function (options) {
|
||||
return openerp.qweb.render('website.tour_popover', options);
|
||||
},
|
||||
onSnippetDraggedAdvance: function (snippetId, stepId) {
|
||||
onSnippetDragged: function (callback) {
|
||||
var self = this;
|
||||
function beginDrag () {
|
||||
$('.popover.tour').remove();
|
||||
function advance () {
|
||||
if (stepId) {
|
||||
self.moveToStep(stepId);
|
||||
} else {
|
||||
self.moveToNextStep();
|
||||
if (_.isFunction(callback)) {
|
||||
callback.call(self);
|
||||
}
|
||||
}
|
||||
$(document.body).one('mouseup', advance);
|
||||
}
|
||||
$('#website-top-navbar [data-snippet-id].ui-draggable').one('mousedown', beginDrag);
|
||||
},
|
||||
onSnippetDraggedAdvance: function () {
|
||||
onSnippetDragged(self.moveToNextStep);
|
||||
},
|
||||
});
|
||||
|
||||
website.UrlParser = openerp.Class.extend({
|
||||
@@ -162,21 +189,35 @@
|
||||
this.origin = a.origin;
|
||||
this.search = a.search;
|
||||
this.hash = a.hash;
|
||||
this.addToSearch= function (query) {
|
||||
function generateTrigger (id) {
|
||||
return "tutorial."+id+"=true";
|
||||
}
|
||||
this.activateTutorial = function (id) {
|
||||
var urlTrigger = generateTrigger(id);
|
||||
var querystring = _.filter(this.search.split('?'), function (str) {
|
||||
return str;
|
||||
});
|
||||
if (querystring.length > 0) {
|
||||
var queries = querystring[0].split("&");
|
||||
queries.push(query);
|
||||
return "?" + _.uniq(queries).join("&");
|
||||
var queries = _.filter(querystring[0].split("&"), function (query) {
|
||||
return query.indexOf("tutorial.") < 0
|
||||
});
|
||||
queries.push(urlTrigger);
|
||||
return "?"+_.uniq(queries).join("&");
|
||||
} else {
|
||||
return "?"+query;
|
||||
return "?"+urlTrigger;
|
||||
}
|
||||
};
|
||||
this.isActive = function (id) {
|
||||
var urlTrigger = generateTrigger(id);
|
||||
return this.search.indexOf(urlTrigger) >= 0;
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
var TestConsole = website.TestConsole = {
|
||||
tests: []
|
||||
};
|
||||
|
||||
website.EditorBar.include({
|
||||
tours: [],
|
||||
start: function () {
|
||||
@@ -202,6 +243,24 @@
|
||||
},
|
||||
registerTour: function (tour) {
|
||||
this.tours.push(tour);
|
||||
TestConsole.tests.push({
|
||||
id: tour.id,
|
||||
run: function runTest () {
|
||||
var actionSteps = _.filter(tour.steps, function (step) {
|
||||
return step.triggers;
|
||||
});
|
||||
var currentIndex = 0;
|
||||
function executeStep (step) {
|
||||
var $element = $(step.element);
|
||||
step.triggers(function () {
|
||||
currentIndex = currentIndex + 1;
|
||||
executeStep(actionSteps[currentIndex]);
|
||||
});
|
||||
$element.click();
|
||||
}
|
||||
executeStep(actionSteps[currentIndex]);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class WebsiteBlog(http.Controller):
|
||||
@website.route([
|
||||
'/blogpost/<model("blog.post"):blog_post>/',
|
||||
], type='http', auth="public", multilang=True)
|
||||
def blog_post(self, blog_post=None, tag=None, date=None, page=1, enable_editor=None):
|
||||
def blog_post(self, blog_post, tag=None, date=None, page=1, enable_editor=None, **post):
|
||||
""" Prepare all values to display the blog.
|
||||
|
||||
:param blog_post: blog post currently browsed. If not set, the user is
|
||||
|
||||
@@ -11,26 +11,25 @@
|
||||
});
|
||||
|
||||
website.BlogTour = website.Tour.extend({
|
||||
id: 'blog-tutorial',
|
||||
id: 'blog',
|
||||
name: "Create a blog post",
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
self.steps = [
|
||||
{
|
||||
stepId: 'welcome-blog',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "New Blog Post",
|
||||
content: "Let's go through the first steps to write beautiful blog posts.",
|
||||
template: self.popover({ next: "Start Tutorial", end: "Skip" }),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
stepId: 'content-menu',
|
||||
element: '#content-menu-button',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "Add Content",
|
||||
content: "Create new pages, blogs, menu items and products through the <em>'Content'</em> menu.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'new-post-entry',
|
||||
@@ -38,9 +37,11 @@
|
||||
placement: 'left',
|
||||
title: "New Blog Post",
|
||||
content: "Select this entry to create a new blog post.",
|
||||
modal: {
|
||||
stopOnClose: true,
|
||||
afterSubmit: 'post-page',
|
||||
trigger: {
|
||||
modal: {
|
||||
stopOnClose: true,
|
||||
afterSubmit: 'post-page',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -49,15 +50,12 @@
|
||||
placement: 'right',
|
||||
title: "Which Blog?",
|
||||
content: "Blog posts are organized in multiple categories (news, job offers, events, etc). Select <em>News</em> and click <em>Continue</em>.",
|
||||
triggers: function () {
|
||||
function newsSelected () {
|
||||
var $this = $(this);
|
||||
if ($this.find('[value='+$this.val()+']').text().toLowerCase() === 'news') {
|
||||
self.moveToNextStep();
|
||||
$('.modal select').off('change', newsSelected);
|
||||
}
|
||||
}
|
||||
$('.modal select').on('change', newsSelected);
|
||||
trigger: {
|
||||
emitter: $('.modal select'),
|
||||
id: 'change',
|
||||
predicate: function ($el, value) {
|
||||
return $el.find('[value='+value+']').text().toLowerCase() === 'news';
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -69,7 +67,6 @@
|
||||
},
|
||||
{
|
||||
stepId: 'post-page',
|
||||
orphan: true,
|
||||
title: "Blog Post Created",
|
||||
content: "This is your new blog post. We will edit your pages inline. What You See Is What You Get. No need for a complex backend.",
|
||||
template: self.popover({ next: "Continue" }),
|
||||
@@ -88,11 +85,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Layout Your Blog Post",
|
||||
content: "Use well designed building blocks to structure the content of your blog. Click 'Insert Blocks' to add new content.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-image-text',
|
||||
@@ -100,9 +93,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a Block",
|
||||
content: "Drag the <em>'Image-Text'</em> block and drop it in your page.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'add-text-block',
|
||||
@@ -110,11 +101,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Add Another Block",
|
||||
content: "Let's add another block to your post.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').on('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
}
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-text-block',
|
||||
@@ -122,9 +109,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the <em>'Text Block'</em> block and drop it below the image block.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'activate-text-block-title',
|
||||
@@ -132,19 +117,15 @@
|
||||
placement: 'top',
|
||||
title: "Edit an Area",
|
||||
content: "Select any area of the page to modify it. Click on this subtitle.",
|
||||
triggers: function () {
|
||||
$('#wrap [data-snippet-id=text-block] .text-center[data-snippet-id=colmd]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'remove-text-block-title',
|
||||
element: '.oe_snippet_remove:last',
|
||||
placement: 'top',
|
||||
reflex: true,
|
||||
title: "Delete the Title",
|
||||
content: "From this toolbar you can move, duplicate or delete the selected zone. Click on the cross to delete the title.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'save-changes',
|
||||
@@ -152,35 +133,26 @@
|
||||
placement: 'right',
|
||||
title: "Save Your Blog",
|
||||
content: "Click the <em>Save</em> button to record changes on the page.",
|
||||
triggers: function () {
|
||||
var $publish = $('button.js_publish_btn');
|
||||
if ($publish.length > 0 && $publish.is(":visible")) {
|
||||
self.moveToNextStep();
|
||||
}
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'publish-post',
|
||||
element: 'button.js_publish_btn',
|
||||
placement: 'top',
|
||||
reflex: true,
|
||||
title: "Publish Your Post",
|
||||
content: "Your blog post is not yet published. You can update this draft version and publish it once you are ready.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'end-tutorial',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "Thanks!",
|
||||
content: "This tutorial is finished. To discover more features, improve the content of this page and try the <em>Promote</em> button in the top right menu.",
|
||||
template: self.popover({ end: "Close Tutorial" }),
|
||||
backdrop: true,
|
||||
},
|
||||
];
|
||||
return this._super();
|
||||
},
|
||||
resume: function () {
|
||||
return (this.isCurrentStep('post-page') || this.isCurrentStep('save-changes')) && this._super();
|
||||
},
|
||||
trigger: function () {
|
||||
return (this.resume() && this.testUrl(/^\/blogpost\/[0-9]+\//)) || this._super();
|
||||
},
|
||||
|
||||
@@ -11,26 +11,25 @@
|
||||
});
|
||||
|
||||
website.EventTour = website.Tour.extend({
|
||||
id: 'event-tutorial',
|
||||
id: 'event',
|
||||
name: "Create an event",
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
self.steps = [
|
||||
{
|
||||
stepId: 'welcome-event',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "Create an Event",
|
||||
content: "Let's go through the firsts step to publish a new event.",
|
||||
template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
stepId: 'content-menu',
|
||||
element: '#content-menu-button',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "Add Content",
|
||||
content: "The <em>Content</em> menu allows to create new pages, events, menus, etc.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'new-post-entry',
|
||||
@@ -38,9 +37,11 @@
|
||||
placement: 'left',
|
||||
title: "New Event",
|
||||
content: "Click here to create a new event.",
|
||||
modal: {
|
||||
stopOnClose: true,
|
||||
afterSubmit: 'event-page',
|
||||
trigger: {
|
||||
modal: {
|
||||
stopOnClose: true,
|
||||
afterSubmit: 'event-page',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -52,7 +53,6 @@
|
||||
},
|
||||
{
|
||||
stepId: 'event-page',
|
||||
orphan: true,
|
||||
title: "New Event Created",
|
||||
content: "This is your new event page. We will edit the event presentation page.",
|
||||
template: self.popover({ next: "OK" }),
|
||||
@@ -71,11 +71,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Layout your event",
|
||||
content: "Insert blocks like 'Banner' to layout the body of your event.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-banner',
|
||||
@@ -83,9 +79,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the 'Banner' block and drop it in your page.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'add-text-block',
|
||||
@@ -93,11 +87,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Layout your event",
|
||||
content: "Insert another block to your event.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-text-block',
|
||||
@@ -105,12 +95,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the 'Text Block' block below the banner.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
onHide: function () {
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'add-three-columns',
|
||||
@@ -118,11 +103,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Layout your event",
|
||||
content: "Insert a last block to your event.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-three-columns',
|
||||
@@ -130,12 +111,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the 'Three Columns' block at the bottom.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
onHide: function () {
|
||||
window.scrollTo(0, 0);
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'save-changes',
|
||||
@@ -143,43 +119,35 @@
|
||||
placement: 'right',
|
||||
title: "Save your modifications",
|
||||
content: "Once you click on save, your event is updated.",
|
||||
triggers: function () {
|
||||
var $publish = $('button.js_publish_btn');
|
||||
if ($publish.length > 0 && $publish.is(":visible")) {
|
||||
self.moveToNextStep();
|
||||
}
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'publish-event',
|
||||
element: 'button.js_publish_btn',
|
||||
placement: 'top',
|
||||
reflex: true,
|
||||
title: "Publish your event",
|
||||
content: "Click to publish your event.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'customize-event',
|
||||
element: '.js_publish_management button:last',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "Customize your event",
|
||||
content: "Click here to customize your event further.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'edit-event-backend',
|
||||
element: '.js_publish_management ul>li>a',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "Customize your event",
|
||||
content: "Click here to edit your event in the backend.",
|
||||
trigger: 'click',
|
||||
},
|
||||
];
|
||||
return this._super();
|
||||
},
|
||||
resume: function () {
|
||||
return (this.isCurrentStep('event-page') || this.isCurrentStep('save-changes')) && this._super();
|
||||
},
|
||||
trigger: function () {
|
||||
return (this.resume() && this.testUrl(/^\/event\/[0-9]+\/register/)) || this._super();
|
||||
},
|
||||
|
||||
@@ -11,26 +11,25 @@
|
||||
});
|
||||
|
||||
website.EditorShopTour = website.Tour.extend({
|
||||
id: 'shop-tutorial',
|
||||
id: 'shop',
|
||||
name: "Create a product",
|
||||
init: function (editor) {
|
||||
var self = this;
|
||||
self.steps = [
|
||||
{
|
||||
stepId: 'welcome-shop',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "Welcome to your shop",
|
||||
content: "You successfully installed the e-commerce. This guide will help you to create your product and promote your sales.",
|
||||
template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
stepId: 'content-menu',
|
||||
element: '#content-menu-button',
|
||||
placement: 'left',
|
||||
reflex: true,
|
||||
title: "Create your first product",
|
||||
content: "Click here to add a new product.",
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'edit-entry',
|
||||
@@ -53,11 +52,10 @@
|
||||
},
|
||||
{
|
||||
stepId: 'product-page',
|
||||
orphan: true,
|
||||
backdrop: true,
|
||||
title: "New product created",
|
||||
content: "This page contains all the information related to the new product.",
|
||||
template: self.popover({ next: "OK" }),
|
||||
backdrop: true,
|
||||
},
|
||||
{
|
||||
stepId: 'edit-price',
|
||||
@@ -110,11 +108,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Describe the product for your audience",
|
||||
content: "Insert blocks like text-image, or gallery to fully describe the product and make your visitors want to buy this product.",
|
||||
triggers: function () {
|
||||
$('button[data-action=snippet]').one('click', function () {
|
||||
self.moveToNextStep();
|
||||
});
|
||||
},
|
||||
trigger: 'click',
|
||||
},
|
||||
{
|
||||
stepId: 'drag-big-picture',
|
||||
@@ -122,9 +116,7 @@
|
||||
placement: 'bottom',
|
||||
title: "Drag & Drop a block",
|
||||
content: "Drag the 'Big Picture' block and drop it in your page.",
|
||||
triggers: function () {
|
||||
self.onSnippetDraggedAdvance();
|
||||
},
|
||||
trigger: 'drag',
|
||||
},
|
||||
{
|
||||
stepId: 'save-changes',
|
||||
@@ -132,28 +124,20 @@
|
||||
placement: 'right',
|
||||
title: "Save your modifications",
|
||||
content: "Once you click on save, your product is updated.",
|
||||
triggers: function () {
|
||||
var $publish = $('button.js_publish_btn');
|
||||
if ($publish.length > 0 && $publish.is(":visible")) {
|
||||
self.moveToNextStep();
|
||||
}
|
||||
},
|
||||
trigger: 'click',
|
||||
|
||||
},
|
||||
{
|
||||
stepId: 'publish-product',
|
||||
element: 'button.js_publish_btn',
|
||||
placement: 'top',
|
||||
reflex: true,
|
||||
title: "Publish your product",
|
||||
content: "Click to publish your product so your customers can see it.",
|
||||
trigger: 'click',
|
||||
},
|
||||
];
|
||||
return this._super();
|
||||
},
|
||||
resume: function () {
|
||||
return (this.isCurrentStep('product-page') || this.isCurrentStep('save-changes')) && this._super();
|
||||
},
|
||||
trigger: function () {
|
||||
return (this.resume() && this.testUrl(/^\/shop\/product\/[0-9]+\//)) || this._super();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user