[FIX] website tours: fix and translate

bzr revid: chm@openerp.com-20140206140643-z3b2fu2v9uaozc1z
This commit is contained in:
Christophe Matthieu 2014-02-06 15:06:43 +01:00
parent 052bcacd5f
commit 0677fda79e
4 changed files with 139 additions and 232 deletions

View File

@ -2,113 +2,113 @@
'use strict';
var website = openerp.website;
var _t = openerp._t;
website.EditorBar.include({
start: function () {
this.registerTour(new website.BannerTour(this));
this.registerTour(new website.Tour.Banner(this));
return this._super();
},
});
website.BannerTour = website.Tour.extend({
website.Tour.Banner = website.Tour.extend({
id: 'banner',
name: "Insert a banner",
path: '/',
init: function (editor) {
init: function () {
var self = this;
self.steps = [
{
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" }),
title: _t("Welcome to your website!"),
content: _t("This tutorial will guide you to build your home page. We will start by adding a banner."),
template: self.popover({ next: _t("Start Tutorial"), end: _t("Skip It") }),
backdrop: true,
},
{
waitNot: '.popover.tour',
element: 'button[data-action=edit]',
placement: 'bottom',
title: "Edit this page",
content: "Every page of your website can be modified through the <i>Edit</i> button.",
title: _t("Edit this page"),
content: _t("Every page of your website can be modified through the <i>Edit</i> button."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Insert building blocks",
content: "To add content in a page, you can insert building blocks.",
title: _t("Insert building blocks"),
content: _t("To add content in a page, you can insert building blocks."),
template: self.popover({ fixed: true }),
},
{
snippet: 'carousel',
placement: 'bottom',
title: "Drag & Drop a Banner",
content: "Drag the Banner block and drop it in your page.",
title: _t("Drag & Drop a Banner"),
content: _t("Drag the Banner block and drop it in your page."),
template: self.popover({ fixed: true }),
},
{
waitFor: '.oe_overlay_options .oe_options:visible',
element: '#wrap [data-snippet-id=carousel]:first .carousel-caption',
sampleText: 'My Title',
placement: 'top',
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" }),
title: _t("Customize banner's text"),
content: _t("Click in the text and start editing it. Click continue once it's done."),
template: self.popover({ next: _t("Continue") }),
},
{
element: '.oe_overlay_options .oe_options',
placement: 'left',
title: "Customize the banner",
content: "Customize any block through this menu. Try to change the background of the banner.",
template: self.popover({ next: "Continue" }),
title: _t("Customize the banner"),
content: _t("Customize any block through this menu. Try to change the background of the banner."),
template: self.popover({ next: _t("Continue") }),
},
{
waitNot: '.popover.tour',
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Add Another Block",
content: "Let's add another building block to your page.",
title: _t("Add Another Block"),
content: _t("Let's add another building block to your page."),
template: self.popover({ fixed: true }),
},
{
snippet: 'three-columns',
placement: 'bottom',
title: "Drag & Drop a Block",
content: "Drag the <em>'3 Columns'</em> block and drop it below the banner.",
title: _t("Drag & Drop a Block"),
content: _t("Drag the <em>'3 Columns'</em> block and drop it below the banner."),
template: self.popover({ fixed: true }),
},
{
waitFor: '.oe_overlay_options .oe_options:visible',
element: 'button[data-action=save]',
placement: 'right',
title: "Save your modifications",
content: "Publish your page by clicking on the <em>'Save'</em> button.",
title: _t("Save your modifications"),
content: _t("Publish your page by clicking on the <em>'Save'</em> button."),
template: self.popover({ fixed: true }),
},
{
waitFor: 'button[data-action=edit]:visible',
title: "Congratulation!",
content: "Your homepage has been updated.",
template: self.popover({ next: "Continue" }),
title: _t("Congratulation!"),
content: _t("Your homepage has been updated."),
template: self.popover({ next: _t("Continue") }),
},
{
waitNot: '.popover.tour',
element: 'a[data-action=show-mobile-preview]',
placement: 'bottom',
title: "Test Your Mobile Version",
content: "Let's check how your homepage looks like on mobile devices.",
title: _t("Test Your Mobile Version"),
content: _t("Let's check how your homepage looks like on mobile devices."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-dismiss=modal]',
placement: 'right',
title: "Close Mobile Preview",
content: "Scroll in the mobile preview to test the rendering. Once it's ok, close this dialog.",
title: _t("Close Mobile Preview"),
content: _t("Scroll in the mobile preview to test the rendering. Once it's ok, close this dialog."),
},
{
waitNot: '.modal',
title: "Congrats",
content: "Congratulation. This tour is finished.",
template: self.popover({ fixed: true, next: "Close Tutorial" }),
title: _t("Congrats"),
content: _t("Congratulation. This tour is finished."),
template: self.popover({ fixed: true, next: _t("Close Tutorial") }),
},
];
return this._super();

View File

@ -2,114 +2,115 @@
'use strict';
var website = openerp.website;
var _t = openerp._t;
website.EditorBar.include({
start: function () {
this.registerTour(new website.BlogTour(this));
this.registerTour(new website.Tour.Blog(this));
return this._super();
},
});
website.BlogTour = website.Tour.extend({
website.Tour.Blog = website.Tour.extend({
id: 'blog',
name: "Create a blog post",
testPath: '/(blog|blogpost)',
init: function (editor) {
init: function () {
var self = this;
self.steps = [
{
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" }),
title: _t("New Blog Post"),
content: _t("Let's go through the first steps to write beautiful blog posts."),
template: self.popover({ next: _t("Start Tutorial"), end: _t("Skip") }),
},
{
element: '#content-menu-button',
placement: 'left',
title: "Add Content",
content: "Create new pages, blogs, menu items and products through the <em>'Content'</em> menu.",
title: _t("Add Content"),
content: _t("Create new pages, blogs, menu items and products through the <em>'Content'</em> menu."),
template: self.popover({ fixed: true }),
},
{
element: 'a[data-action=new_blog_post]',
placement: 'left',
title: "New Blog Post",
content: "Select this menu item to create a new blog post.",
title: _t("New Blog Post"),
content: _t("Select this menu item to create a new blog post."),
template: self.popover({ fixed: true }),
},
{
element: '.modal button.btn-primary',
placement: 'bottom',
title: "Create Blog Post",
content: "Click <em>Continue</em> to create the blog post.",
title: _t("Create Blog Post"),
content: _t("Click <em>Continue</em> to create the blog post."),
},
{
waitNot: '.modal',
title: "Blog Post Created",
content: "This is your new blog post. Let's edit it.",
template: self.popover({ next: "Continue" }),
title: _t("Blog Post Created"),
content: _t("This is your new blog post. Let's edit it."),
template: self.popover({ next: _t("Continue") }),
},
{
element: 'h1[data-oe-expression="blog_post.name"]',
placement: 'bottom',
sampleText: 'New Blog',
title: "Set a Title",
content: "Click on this area and set a catchy title for your blog post.",
title: _t("Set a Title"),
content: _t("Click on this area and set a catchy title for your blog post."),
},
{
waitNot: '#wrap h1[data-oe-model="blog.post"]:contains("Blog Post Title")',
element: 'button[data-action=snippet]',
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.",
title: _t("Layout Your Blog Post"),
content: _t("Use well designed building blocks to structure the content of your blog. Click 'Insert Blocks' to add new content."),
template: self.popover({ fixed: true }),
},
{
snippet: 'image-text',
placement: 'bottom',
title: "Drag & Drop a Block",
content: "Drag the <em>'Image-Text'</em> block and drop it in your page.",
title: _t("Drag & Drop a Block"),
content: _t("Drag the <em>'Image-Text'</em> block and drop it in your page."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Add Another Block",
content: "Let's add another block to your post.",
title: _t("Add Another Block"),
content: _t("Let's add another block to your post."),
template: self.popover({ fixed: true }),
},
{
snippet: 'text-block',
placement: 'bottom',
title: "Drag & Drop a block",
content: "Drag the <em>'Text Block'</em> block and drop it below the image block.",
title: _t("Drag & Drop a block"),
content: _t("Drag the <em>'Text Block'</em> block and drop it below the image block."),
template: self.popover({ fixed: true }),
},
{
element: '.oe_active .oe_snippet_remove',
placement: 'top',
title: "Delete the Title",
content: "From this toolbar you can move, duplicate or delete the selected zone. Click on the garbage can image to delete the title.",
title: _t("Delete the Title"),
content: _t("From this toolbar you can move, duplicate or delete the selected zone. Click on the garbage can image to delete the title."),
},
{
waitNot: '.oe_active .oe_snippet_remove:visible',
element: 'button[data-action=save]',
placement: 'right',
title: "Save Your Blog",
content: "Click the <em>Save</em> button to record changes on the page.",
title: _t("Save Your Blog"),
content: _t("Click the <em>Save</em> button to record changes on the page."),
template: self.popover({ fixed: true }),
},
{
waitFor: 'button[data-action=edit]:visible',
element: 'button.btn-danger.js_publish_btn',
placement: 'top',
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.",
title: _t("Publish Your Post"),
content: _t("Your blog post is not yet published. You can update this draft version and publish it once you are ready."),
},
{
waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible',
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" }),
content: _t("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: _t("Close Tutorial") }),
},
];
return this._super();

View File

@ -2,6 +2,7 @@
'use strict';
var website = openerp.website;
var _t = openerp._t;
website.EditorBar.include({
start: function () {
@ -18,93 +19,93 @@
var self = this;
self.steps = [
{
title: "Create an Event",
content: "Let's go through the first steps to publish a new event.",
title: _t("Create an Event"),
content: _t("Let's go through the first steps to publish a new event."),
template: self.popover({ next: "Start Tutorial", end: "Skip It" }),
},
{
element: '#content-menu-button',
placement: 'left',
title: "Add Content",
content: "The <em>Content</em> menu allows you to create new pages, events, menus, etc.",
title: _t("Add Content"),
content: _t("The <em>Content</em> menu allows you to create new pages, events, menus, etc."),
template: self.popover({ fixed: true }),
},
{
element: 'a[data-action=new_event]',
placement: 'left',
title: "New Event",
content: "Click here to create a new event.",
title: _t("New Event"),
content: _t("Click here to create a new event."),
template: self.popover({ fixed: true }),
},
{
element: '.modal:contains("New Event") input[type=text]',
sampleText: 'Advanced Technical Training',
placement: 'right',
title: "Create an Event Name",
content: "Create a name for your new event and click <em>'Continue'</em>. e.g: Technical Training",
title: _t("Create an Event Name"),
content: _t("Create a name for your new event and click <em>'Continue'</em>. e.g: Technical Training"),
},
{
waitNot: '.modal input[type=text]:not([value!=""])',
element: '.modal button.btn-primary',
placement: 'right',
title: "Create Event",
content: "Click <em>Continue</em> to create the event.",
title: _t("Create Event"),
content: _t("Click <em>Continue</em> to create the event."),
},
{
waitFor: '#website-top-navbar button[data-action="save"]:visible',
title: "New Event Created",
content: "This is your new event page. We will edit the event presentation page.",
template: self.popover({ next: "Continue" }),
title: _t("New Event Created"),
content: _t("This is your new event page. We will edit the event presentation page."),
template: self.popover({ next: _t("Continue") }),
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Layout your event",
content: "Insert blocks to layout the body of your event.",
title: _t("Layout your event"),
content: _t("Insert blocks to layout the body of your event."),
template: self.popover({ fixed: true }),
},
{
snippet: 'image-text',
placement: 'bottom',
title: "Drag & Drop a block",
content: "Drag the 'Image-Text' block and drop it in your page.",
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Image-Text' block and drop it in your page."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Layout your event",
content: "Insert another block to your event.",
title: _t("Layout your event"),
content: _t("Insert another block to your event."),
template: self.popover({ fixed: true }),
},
{
snippet: 'text-block',
placement: 'bottom',
title: "Drag & Drop a block",
content: "Drag the 'Text Block' in your event page.",
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Text Block' in your event page."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-action=save]',
placement: 'right',
title: "Save your modifications",
content: "Once you click on save, your event is updated.",
title: _t("Save your modifications"),
content: _t("Once you click on save, your event is updated."),
template: self.popover({ fixed: true }),
},
{
waitFor: 'button[data-action=edit]:visible',
element: 'button.btn-danger.js_publish_btn',
placement: 'top',
title: "Publish your event",
content: "Click to publish your event.",
title: _t("Publish your event"),
content: _t("Click to publish your event."),
},
{
waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible',
element: '.js_publish_management button[data-toggle="dropdown"]',
placement: 'left',
title: "Customize your event",
content: "Click here to customize your event further.",
title: _t("Customize your event"),
content: _t("Click here to customize your event further."),
},
{
element: '.js_publish_management ul>li>a:last:visible',

View File

@ -2,124 +2,124 @@
'use strict';
var website = openerp.website;
var _t = openerp._t;
website.EditorBar.include({
start: function () {
this.registerTour(new website.EditorShopTour(this));
var res = this._super();
return res;
this.registerTour(new website.Tour.Shop(this));
return this._super();
},
});
website.EditorShopTour = website.Tour.extend({
website.Tour.Shop = website.Tour.extend({
id: 'shop',
name: "Create a product",
testPath: '/shop',
init: function (editor) {
init: function () {
var self = this;
self.steps = [
{
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" }),
title: _t("Welcome to your shop"),
content: _t("You successfully installed the e-commerce. This guide will help you to create your product and promote your sales."),
template: self.popover({ next: _t("Start Tutorial"), end: _t("Skip It") }),
},
{
element: '#content-menu-button',
placement: 'left',
title: "Create your first product",
content: "Click here to add a new product.",
title: _t("Create your first product"),
content: _t("Click here to add a new product."),
template: self.popover({ fixed: true }),
},
{
element: 'a[data-action=new_product]',
placement: 'left',
title: "Create a new product",
content: "Select 'New Product' to create it and manage its properties to boost your sales.",
title: _t("Create a new product"),
content: _t("Select 'New Product' to create it and manage its properties to boost your sales."),
template: self.popover({ fixed: true }),
},
{
element: '.modal:contains("New Product") input[type=text]',
sampleText: 'New Product',
placement: 'right',
title: "Choose name",
content: "Enter a name for your new product then click 'Continue'.",
title: _t("Choose name"),
content: _t("Enter a name for your new product then click 'Continue'."),
},
{
waitNot: '.modal input[type=text]:not([value!=""])',
element: '.modal button.btn-primary',
placement: 'right',
title: "Create Product",
content: "Click <em>Continue</em> to create the product.",
title: _t("Create Product"),
content: _t("Click <em>Continue</em> to create the product."),
},
{
waitFor: '#website-top-navbar button[data-action="save"]:visible',
title: "New product created",
content: "This page contains all the information related to the new product.",
template: self.popover({ next: "Continue" }),
title: _t("New product created"),
content: _t("This page contains all the information related to the new product."),
template: self.popover({ next: _t("Continue") }),
},
{
element: '.product_price .oe_currency_value',
sampleText: '20.50',
placement: 'left',
title: "Change the price",
content: "Edit the price of this product by clicking on the amount.",
title: _t("Change the price"),
content: _t("Edit the price of this product by clicking on the amount."),
},
{
waitNot: '.product_price .oe_currency_value:containsExact(1.00)',
element: '#wrap img.img:first',
placement: 'top',
title: "Update image",
content: "Click here to set an image describing your product.",
title: _t("Update image"),
content: _t("Click here to set an image describing your product."),
},
{
element: 'button.hover-edition-button:visible',
placement: 'top',
title: "Update image",
content: "Click here to set an image describing your product.",
title: _t("Update image"),
content: _t("Click here to set an image describing your product."),
},
{
wait: 500,
element: '.well a.pull-right',
placement: 'bottom',
title: "Select an Image",
content: "Let's select an existing image.",
title: _t("Select an Image"),
content: _t("Let's select an existing image."),
template: self.popover({ fixed: true }),
},
{
element: 'img[alt=imac]',
placement: 'bottom',
title: "Select an Image",
content: "Let's select an imac image.",
title: _t("Select an Image"),
content: _t("Let's select an imac image."),
template: self.popover({ fixed: true }),
},
{
waitNot: 'img[alt=imac]',
element: '.modal-content button.save',
placement: 'bottom',
title: "Select this Image",
content: "Click to add the image to the product decsription.",
title: _t("Select this Image"),
content: _t("Click to add the image to the product decsription."),
template: self.popover({ fixed: true }),
},
{
waitNot: '.modal-content:visible',
element: 'button[data-action=snippet]',
placement: 'bottom',
title: "Describe the Product",
content: "Insert blocks like text-image, or gallery to fully describe the product.",
title: _t("Describe the Product"),
content: _t("Insert blocks like text-image, or gallery to fully describe the product."),
template: self.popover({ fixed: true }),
},
{
snippet: 'big-picture',
placement: 'bottom',
title: "Drag & Drop a block",
content: "Drag the 'Big Picture' block and drop it in your page.",
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Big Picture' block and drop it in your page."),
template: self.popover({ fixed: true }),
},
{
element: 'button[data-action=save]',
placement: 'right',
title: "Save your modifications",
content: "Once you click on save, your product is updated.",
title: _t("Save your modifications"),
content: _t("Once you click on save, your product is updated."),
template: self.popover({ fixed: true }),
},
@ -127,113 +127,18 @@
waitFor: '#website-top-navbar button[data-action="edit"]:visible',
element: '.js_publish_management button.js_publish_btn.btn-danger',
placement: 'top',
title: "Publish your product",
content: "Click to publish your product so your customers can see it.",
title: _t("Publish your product"),
content: _t("Click to publish your product so your customers can see it."),
},
{
waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible',
title: "Congratulations",
content: "Congratulations! You just created and published your first product.",
template: self.popover({ next: "Close Tutorial" }),
title: _t("Congratulations"),
content: _t("Congratulations! You just created and published your first product."),
template: self.popover({ next: _t("Close Tutorial") }),
},
];
return this._super();
}
});
website.EditorShopTest = website.Tour.extend({
id: 'shop_buy_product',
name: "Try to buy products",
path: '/shop',
testPath: '/shop',
init: function (editor) {
var self = this;
self.steps = [
{
title: 'begin-test',
template: self.popover({ next: "Start Test"}),
backdrop: true,
},
{
title: "select ipod",
element: '.oe_product_cart a:contains("iPod")',
},
{
title: "select ipod 32Go",
element: 'input[name="product_id"]:not([checked])',
},
{
title: "click on add to cart",
waitFor: 'input[name="product_id"]:eq(1)[checked]',
element: 'form[action="/shop/add_cart/"] button',
},
{
title: "add suggested",
element: 'form[action="/shop/add_cart/"] button.btn-link:contains("Add to Cart")',
},
{
title: "add one more iPod",
waitFor: '.my_cart_quantity:contains(2)',
element: '#mycart_products tr:contains("iPod: 32 Gb") a.js_add_cart_json:eq(1)',
},
{
title: "remove Headphones",
waitFor: '#mycart_products tr:contains("iPod: 32 Gb") input.js_quantity[value=2]',
element: '#mycart_products tr:contains("Apple In-Ear Headphones") a.js_add_cart_json:first',
},
{
title: "set one iPod",
waitNot: '#mycart_products tr:contains("Apple In-Ear Headphones")',
element: '#mycart_products input.js_quantity',
sampleText: '1',
},
{
title: "go to checkout",
waitFor: '#mycart_products input.js_quantity[value=1]',
element: 'a[href="/shop/checkout/"]',
},
{
title: "test with input error",
element: 'form[action="/shop/confirm_order/"] button',
callback: function (tour) {
$("input[name='phone']").val("");
},
},
{
title: "test without input error",
waitFor: 'form[action="/shop/confirm_order/"] .has-error',
element: 'form[action="/shop/confirm_order/"] button',
callback: function (tour) {
if ($("input[name='name']").val() === "")
$("input[name='name']").val("website_sale-test-shoptest");
if ($("input[name='email']").val() === "")
$("input[name='email']").val("website_sale-test-shoptest@website_sale-test-shoptest.optenerp.com");
$("input[name='phone']").val("123");
$("input[name='street']").val("123");
$("input[name='city']").val("123");
$("input[name='zip']").val("123");
$("select[name='country_id']").val("21");
},
},
{
title: "select acquirer",
element: 'input[name="acquirer"]:first',
},
{
title: "Pay Now",
element: 'button:contains("Pay Now")',
},
{
title: "finish",
waitFor: '.oe_website_sale:contains("Thank you for your order")',
}
];
return this._super();
},
});
// for test without editor bar
$(document).ready(function () {
website.Tour.add(website.EditorShopTest);
});
}());