[FIX] website snippet drop for rte; remove dependence to qweb template (remove popover from tours); fx import file with ajax

bzr revid: chm@openerp.com-20140207154520-2injapzg9lgrdbvc
This commit is contained in:
Christophe Matthieu 2014-02-07 16:45:20 +01:00
parent f767f6ca47
commit 6d7eccf10a
7 changed files with 68 additions and 55 deletions

View File

@ -419,12 +419,18 @@
// reset snippet for rte
$target.removeData("snippet-editor");
$target.removeData("overlay");
if ($target.data("overlay")) {
$target.data("overlay").remove();
$target.removeData("overlay");
}
self.create_overlay($target);
$target.find("[data-snippet-id]").each(function () {
var $snippet = $(this);
$snippet.removeData("snippet-editor");
$snippet.removeData("overlay");
if ($snippet.data("overlay")) {
$snippet.data("overlay").remove();
$snippet.removeData("overlay");
}
self.create_overlay($snippet);
});
// end

View File

@ -19,10 +19,9 @@
var self = this;
self.steps = [
{
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,
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."),
popover: { next: _t("Start Tutorial"), end: _t("Skip It") },
},
{
waitNot: '.popover.tour',
@ -30,21 +29,21 @@
placement: 'bottom',
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 }),
popover: { fixed: true },
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: _t("Insert building blocks"),
content: _t("To add content in a page, you can insert building blocks."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'carousel',
placement: 'bottom',
title: _t("Drag & Drop a Banner"),
content: _t("Drag the Banner block and drop it in your page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitFor: '.oe_overlay_options .oe_options:visible',
@ -52,14 +51,14 @@
placement: 'top',
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") }),
popover: { next: _t("Continue") },
},
{
element: '.oe_overlay_options .oe_options',
placement: 'left',
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") }),
popover: { next: _t("Continue") },
},
{
waitNot: '.popover.tour',
@ -67,14 +66,14 @@
placement: 'bottom',
title: _t("Add Another Block"),
content: _t("Let's add another building block to your page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'three-columns',
placement: 'bottom',
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 }),
popover: { fixed: true },
},
{
waitFor: '.oe_overlay_options .oe_options:visible',
@ -82,13 +81,13 @@
placement: 'right',
title: _t("Save your modifications"),
content: _t("Publish your page by clicking on the <em>'Save'</em> button."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitFor: 'button[data-action=edit]:visible',
title: _t("Congratulation!"),
content: _t("Your homepage has been updated."),
template: self.popover({ next: _t("Continue") }),
popover: { next: _t("Continue") },
},
{
waitNot: '.popover.tour',
@ -96,7 +95,7 @@
placement: 'bottom',
title: _t("Test Your Mobile Version"),
content: _t("Let's check how your homepage looks like on mobile devices."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: 'button[data-dismiss=modal]',
@ -108,7 +107,7 @@
waitNot: '.modal',
title: _t("Congrats"),
content: _t("Congratulation. This tour is finished."),
template: self.popover({ fixed: true, next: _t("Close Tutorial") }),
popover: { fixed: true, next: _t("Close Tutorial") },
},
];
return this._super();

View File

@ -2,6 +2,8 @@
'use strict';
var website = openerp.website;
if (typeof QWeb2 !== "undefined")
website.add_template_file('/website/static/src/xml/website.tour.xml');
if (website.EditorBar)
@ -185,8 +187,9 @@ website.Tour = openerp.Class.extend({
var step = this.steps[index];
step.stepId = step.stepId || ""+index;
if (!step.waitNot && index > 0 && $(this.steps[index-1].template).has("button[data-role='next']").size()) {
step.waitNot = '.popover.tour';
if (!step.waitNot && index > 0 && this.steps[index-1] &&
this.steps[index-1].popover && this.steps[index-1].popover.next) {
step.waitNot = '.popover.tour:visible';
}
if (!step.waitFor && index > 0 && this.steps[index-1].snippet) {
step.waitFor = '.oe_overlay_options .oe_options:visible';
@ -194,6 +197,8 @@ website.Tour = openerp.Class.extend({
step._title = step._title || step.title;
step.title = this.popoverTitle({ title: step._title });
step.template = step.template || this.popover( step.popover );
if (!step.element) step.orphan = true;
if (step.snippet) {
step.element = '#oe_snippets div.oe_snippet[data-snippet-id="'+step.snippet+'"] .oe_snippet_thumbnail';
@ -201,9 +206,10 @@ website.Tour = openerp.Class.extend({
}
if ($(this.steps[index-1].template).has("button[data-role='next']").size()) {
if (this.steps[index-1] &&
this.steps[index-1].popover && this.steps[index-1].popover.next) {
var step = {
stepId: index,
stepId: ""+index,
waitNot: '.popover.tour:visible'
};
this.steps.push(step);
@ -437,7 +443,7 @@ website.Tour.each = function (callback) {
website.Tour.waitReady = function (callback) {
var self = this;
$(document).ready(function () {
if ($.ajaxBusy == null || $.ajaxBusy) {
if ($.ajaxBusy) {
$(document).ajaxStop(function() {
setTimeout(function () {
callback.call(self);

View File

@ -18,15 +18,17 @@ function LoadScript(src) {
if (typeof jQuery === "undefined")
LoadScript("/web/static/lib/jquery/jquery.js");
if (typeof _ === "undefined")
LoadScript("/web/static/lib/underscore/underscore.js");
if (typeof openerp === "undefined") {
LoadScript("/web/static/lib/qweb/qweb2.js");
LoadScript("/web/static/lib/qweb/openerpframework.js");
LoadScript("/web/static/src/js/openerpframework.js");
}
if (typeof openerp === "undefined" || !openerp.website || !openerp.website.add_template_file)
LoadScript("/website/static/src/js/website.js");
if (typeof openerp === "undefined" || !openerp.website.Tour)
LoadScript("/website/static/src/js/website.tour.js");
if (typeof Tour === "undefined")
LoadScript("/website/static/lib/bootstrap-tour/bootstrap-tour.js");
if (typeof openerp === "undefined" || !openerp.website.Tour)
LoadScript("/website/static/src/js/website.tour.js");
})();

View File

@ -21,21 +21,21 @@
{
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") }),
popover: { next: _t("Start Tutorial"), end: _t("Skip") },
},
{
element: '#content-menu-button',
placement: 'left',
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 }),
popover: { fixed: true },
},
{
element: 'a[data-action=new_blog_post]',
placement: 'left',
title: _t("New Blog Post"),
content: _t("Select this menu item to create a new blog post."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: '.modal:has(#editor_new_blog) button.btn-primary',
@ -47,7 +47,7 @@
waitFor: 'body:has(button[data-action=save]:visible):has(.js_blog)',
title: _t("Blog Post Created"),
content: _t("This is your new blog post. Let's edit it."),
template: self.popover({ next: _t("Continue") }),
popover: { next: _t("Continue") },
},
{
element: 'h1[data-oe-expression="blog_post.name"]',
@ -62,28 +62,28 @@
placement: 'bottom',
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 }),
popover: { fixed: true },
},
{
snippet: 'image-text',
placement: 'bottom',
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 }),
popover: { fixed: true },
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: _t("Add Another Block"),
content: _t("Let's add another block to your post."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'text-block',
placement: 'bottom',
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 }),
popover: { fixed: true },
},
{
element: '.oe_active .oe_snippet_remove',
@ -97,7 +97,7 @@
placement: 'right',
title: _t("Save Your Blog"),
content: _t("Click the <em>Save</em> button to record changes on the page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitFor: 'button[data-action=edit]:visible',
@ -110,7 +110,7 @@
waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible',
title: "Thanks!",
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") }),
popover: { next: _t("Close Tutorial") },
},
];
return this._super();

View File

@ -21,21 +21,21 @@
{
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" }),
popover: { next: _("Start Tutorial"), end: _("Skip It") },
},
{
element: '#content-menu-button',
placement: 'left',
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 }),
popover: { fixed: true },
},
{
element: 'a[data-action=new_event]',
placement: 'left',
title: _t("New Event"),
content: _t("Click here to create a new event."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: '.modal #editor_new_event input[type=text]',
@ -55,21 +55,21 @@
waitFor: 'body:has(button[data-action=save]:visible):has(.js_event)',
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") }),
popover: { next: _t("Continue") },
},
{
element: 'button[data-action=snippet]',
placement: 'bottom',
title: _t("Layout your event"),
content: _t("Insert blocks to layout the body of your event."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'image-text',
placement: 'bottom',
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Image-Text' block and drop it in your page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
@ -77,21 +77,21 @@
placement: 'bottom',
title: _t("Layout your event"),
content: _t("Insert another block to your event."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'text-block',
placement: 'bottom',
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Text Block' in your event page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: 'button[data-action=save]',
placement: 'right',
title: _t("Save your modifications"),
content: _t("Once you click on save, your event is updated."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitFor: 'button[data-action=edit]:visible',

View File

@ -21,21 +21,21 @@
{
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") }),
popover: { next: _t("Start Tutorial"), end: _t("Skip It") },
},
{
element: '#content-menu-button',
placement: 'left',
title: _t("Create your first product"),
content: _t("Click here to add a new product."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: 'a[data-action=new_product]',
placement: 'left',
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 }),
popover: { fixed: true },
},
{
element: '.modal #editor_new_product input[type=text]',
@ -55,7 +55,7 @@
waitFor: 'body:has(button[data-action=save]:visible):has(.js_sale)',
title: _t("New product created"),
content: _t("This page contains all the information related to the new product."),
template: self.popover({ next: _t("Continue") }),
popover: { next: _t("Continue") },
},
{
element: '.product_price .oe_currency_value',
@ -83,14 +83,14 @@
placement: 'bottom',
title: _t("Select an Image"),
content: _t("Let's select an existing image."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: 'img[alt=imac]',
placement: 'bottom',
title: _t("Select an Image"),
content: _t("Let's select an imac image."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitNot: 'img[alt=imac]',
@ -98,7 +98,7 @@
placement: 'bottom',
title: _t("Select this Image"),
content: _t("Click to add the image to the product decsription."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
waitNot: '.modal-content:visible',
@ -106,21 +106,21 @@
placement: 'bottom',
title: _t("Describe the Product"),
content: _t("Insert blocks like text-image, or gallery to fully describe the product."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
snippet: 'big-picture',
placement: 'bottom',
title: _t("Drag & Drop a block"),
content: _t("Drag the 'Big Picture' block and drop it in your page."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
element: 'button[data-action=save]',
placement: 'right',
title: _t("Save your modifications"),
content: _t("Once you click on save, your product is updated."),
template: self.popover({ fixed: true }),
popover: { fixed: true },
},
{
@ -134,7 +134,7 @@
waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible',
title: _t("Congratulations"),
content: _t("Congratulations! You just created and published your first product."),
template: self.popover({ next: _t("Close Tutorial") }),
popover: { next: _t("Close Tutorial") },
},
];
return this._super();