diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index f350d45923e..e7dc70d055a 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -1,27 +1,33 @@ @charset "utf-8"; /* ---- CKEditor Minimal Reset ---- */ .navbar.navbar-inverse .cke_chrome { - border: none; } + border: none; +} .navbar.navbar-inverse .cke_inner { - background: transparent; } + background: transparent; +} .navbar.navbar-inverse .cke_toolbar { position: relative; - top: 1px; } + top: 1px; +} .navbar.navbar-inverse .cke_combo_button { padding-top: 3px; - padding-bottom: 3px; } + padding-bottom: 3px; +} .navbar.navbar-inverse .cke_button { padding-top: 7px; - padding-bottom: 7px; } + padding-bottom: 7px; +} .navbar.navbar-inverse .cke_top { background: transparent; border: none; box-shadow: none; -webkit-box-shadow: none; - -moz-box-shadow: none; } + -moz-box-shadow: none; +} /* ---- OpenERP Style ---- */ .oe_website_editorbar { @@ -38,93 +44,119 @@ background: #414141, -moz-linear-gradient(#646060, #262626); background: #414141, -o-linear-gradient(#646060, #262626); background: #414141, linear-gradient(#646060, #262626); - box-sizing: border-box; } - .oe_website_editorbar li { - display: inline; - color: #eeeeee; } - .oe_website_editorbar li:hover { - background: rgba(0, 0, 0, 0.2); - text-shadow: black 0px 0px 3px; - color: white; } + box-sizing: border-box; +} +.oe_website_editorbar li { + display: inline; + color: #eeeeee; +} +.oe_website_editorbar li:hover { + background: rgba(0, 0, 0, 0.2); + text-shadow: black 0px 0px 3px; + color: white; +} .oe_website_editorbar .oe_rte_toolbar div.dropdown { - display: inline-block; } - .oe_website_editorbar .oe_rte_toolbar div.dropdown li { - display: list-item; } + display: inline-block; +} +.oe_website_editorbar .oe_rte_toolbar div.dropdown li { + display: list-item; +} .oe_website_editorbar .oe_rte_toolbar button { font-family: FontAwesome; font-weight: normal; font-style: normal; - text-decoration: inherit; } - .oe_website_editorbar .oe_rte_toolbar button.oe_button_list { - padding-right: 3px; } - .oe_website_editorbar .oe_rte_toolbar button.oe_button_list:after { - content: "\F0D7"; - padding-left: 6px; } + text-decoration: inherit; +} +.oe_website_editorbar .oe_rte_toolbar button.oe_button_list { + padding-right: 3px; +} +.oe_website_editorbar .oe_rte_toolbar button.oe_button_list:after { + content: "\F0D7"; + padding-left: 6px; +} .oe_editable:focus { - outline: none !important; } + outline: none !important; +} .css_non_editable_mode_hidden { - display: none; } + display: none; +} .oe_carousel_options { cursor: pointer; position: absolute; white-space: nowrap; z-index: 1; - display: none; } - .oe_carousel_options > * { - display: inline-block !important; - vertical-align: middle !important; - position: relative !important; - top: 2px; } + display: none; +} +.oe_carousel_options > * { + display: inline-block !important; + vertical-align: middle !important; + position: relative !important; + top: 2px; +} /* ---- EDITOR BAR ---- */ table.editorbar-panel { cursor: pointer; - width: 100%; } - table.editorbar-panel td { - border: 1px solid #aaaaaa; } - table.editorbar-panel td.selected { - background-color: #b1c9d9; } + width: 100%; +} +table.editorbar-panel td { + border: 1px solid #aaaaaa; +} +table.editorbar-panel td.selected { + background-color: #b1c9d9; +} .oe_translate_examples li { margin: 10px; - padding: 4px; } + padding: 4px; +} .oe_translatable_text { - outline: 1px solid black; } + outline: 1px solid black; +} .oe_translatable_field { - outline: 1px dashed black; } + outline: 1px dashed black; +} .oe_translatable_text.oe_dirty, .oe_translatable_field.oe_dirty { - outline-color: red; } + outline-color: red; +} .oe_translatable_text.oe_dirty:empty { - padding: 0 10px; } + padding: 0 10px; +} .oe_translatable_todo { - background: #ffffb6; } + background: #ffffb6; +} /* ---- RTE ---- */ .oe_editable .btn { -webkit-user-select: auto; -moz-user-select: auto; - user-select: auto; } + user-select: auto; +} .modal-dialog.select-image { - width: 80%; } + width: 80%; +} .modal .existing-attachments .pager { - margin: 0; } + margin: 0; +} .modal .image-preview { - margin-bottom: 0.5em; } + margin-bottom: 0.5em; +} .cke_widget_drag_handler_container { - display: none !important; } + display: none !important; +} /* ---- SNIPPET EDITOR ---- */ #oe_snippets { @@ -135,49 +167,59 @@ table.editorbar-panel { background: #282828; box-shadow: 0px 10px 10px -10px black inset; z-index: 1010; - overflow: hidden; } - #oe_snippets:hover { - height: auto; } - #oe_snippets .scroll { - white-space: nowrap; - overflow-y: auto; } - #oe_snippets .nav { - position: fixed; - z-index: 1; } - #oe_snippets .nav > li { - display: inline-block; - float: none; - font-size: 13px; } - #oe_snippets .nav > li > a { - padding: 2px 10px !important; - width: 100%; - display: block; } - #oe_snippets .pill-content { - margin-top: 24px; - display: inline-block; - white-space: nowrap; } - #oe_snippets .pill-content > div { - display: inline-block; - background: black; - padding: 5px; } - #oe_snippets .pill-content > div label { - width: 44px; - height: 100%; - color: white; - padding-left: 10px; } - #oe_snippets .pill-content > div label div { - width: 100px; - text-align: center; - -webkit-transform: translate(-39px, 44px); - -moz-transform: translate(-39px, 44px); - -ms-transform: translate(-39px, 44px); - -o-transform: translate(-39px, 44px); - transform: translate(-39px, 44px); - -webkit-transform-origin: 50% 50% 50%; - -moz-transform-origin: 50% 50% 50%; - -ms-transform-origin: 50% 50% 50%; - -o-transform-origin: 50% 50% 50%; - transform-origin: 50% 50% 50%; } + overflow: hidden; +} +#oe_snippets:hover { + height: auto; +} +#oe_snippets .scroll { + white-space: nowrap; + overflow-y: auto; +} +#oe_snippets .nav { + position: fixed; + z-index: 1; +} +#oe_snippets .nav > li { + display: inline-block; + float: none; + font-size: 13px; +} +#oe_snippets .nav > li > a { + padding: 2px 10px !important; + width: 100%; + display: block; +} +#oe_snippets .pill-content { + margin-top: 24px; + display: inline-block; + white-space: nowrap; +} +#oe_snippets .pill-content > div { + display: inline-block; + background: black; + padding: 5px; +} +#oe_snippets .pill-content > div label { + width: 44px; + height: 100%; + color: white; + padding-left: 10px; +} +#oe_snippets .pill-content > div label div { + width: 100px; + text-align: center; + -webkit-transform: translate(-39px, 44px); + -moz-transform: translate(-39px, 44px); + -ms-transform: translate(-39px, 44px); + -o-transform: translate(-39px, 44px); + transform: translate(-39px, 44px); + -webkit-transform-origin: 50% 50% 50%; + -moz-transform-origin: 50% 50% 50%; + -ms-transform-origin: 50% 50% 50%; + -o-transform-origin: 50% 50% 50%; + transform-origin: 50% 50% 50%; +} .oe_snippet { display: inline-block; @@ -191,30 +233,37 @@ table.editorbar-panel { -webkit-user-select: none; user-select: none; cursor: move; - pointer-events: none; } - .oe_snippet .oe_snippet_thumbnail { - pointer-events: auto; - text-align: center; - height: 100%; - background: transparent; - color: white; - position: relative; } - .oe_snippet .oe_snippet_thumbnail .oe_snippet_thumbnail_title { - font-size: 12px; - display: block; } - .oe_snippet .oe_snippet_thumbnail .oe_snippet_thumbnail_img { - box-shadow: inset 0px 0px 0px 3px #333333; } - .oe_snippet .oe_snippet_thumbnail span, .oe_snippet .oe_snippet_thumbnail div { - line-height: 18px; } - .oe_snippet > :not(.oe_snippet_thumbnail) { - display: none !important; } + pointer-events: none; +} +.oe_snippet .oe_snippet_thumbnail { + pointer-events: auto; + text-align: center; + height: 100%; + background: transparent; + color: white; + position: relative; +} +.oe_snippet .oe_snippet_thumbnail .oe_snippet_thumbnail_title { + font-size: 12px; + display: block; +} +.oe_snippet .oe_snippet_thumbnail .oe_snippet_thumbnail_img { + box-shadow: inset 0px 0px 0px 3px #333333; +} +.oe_snippet .oe_snippet_thumbnail span, .oe_snippet .oe_snippet_thumbnail div { + line-height: 18px; +} +.oe_snippet > :not(.oe_snippet_thumbnail) { + display: none !important; +} #oe_snippets .oe_snippet_thumbnail { background: #747474, -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, rgba(0, 0, 0, 0.25)), color-stop(100%, rgba(0, 0, 0, 0.4))); background: #747474, -webkit-radial-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)); background: #747474, -moz-radial-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)); background: #747474, -o-radial-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)); - background: #747474, radial-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)); } + background: #747474, radial-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.4)); +} /* ---- SNIPPETS DROP ZONES ---- */ .oe_drop_zone.oe_insert { @@ -229,35 +278,43 @@ table.editorbar-panel { transition: margin 250ms linear; width: 100%; position: absolute; - z-index: 1000; } - .oe_drop_zone.oe_insert:not(.oe_vertical):before { - content: ""; - display: block; - border-top: dashed 2px rgba(209, 178, 255, 0.72); - position: relative; - top: 0px; } - .oe_drop_zone.oe_insert.oe_hover:before { - border-top: dashed 2px rgba(116, 255, 161, 0.72); } - .oe_drop_zone.oe_insert.oe_vertical { - width: 48px; - float: left; - position: relative; - margin: 0px -24px !important; } - .oe_drop_zone.oe_insert.oe_overlay { - background: rgba(153, 0, 255, 0.17); - border-radius: 3px; } + z-index: 1000; +} +.oe_drop_zone.oe_insert:not(.oe_vertical):before { + content: ""; + display: block; + border-top: dashed 2px rgba(209, 178, 255, 0.72); + position: relative; + top: 0px; +} +.oe_drop_zone.oe_insert.oe_hover:before { + border-top: dashed 2px rgba(116, 255, 161, 0.72); +} +.oe_drop_zone.oe_insert.oe_vertical { + width: 48px; + float: left; + position: relative; + margin: 0px -24px !important; +} +.oe_drop_zone.oe_insert.oe_overlay { + background: rgba(153, 0, 255, 0.17); + border-radius: 3px; +} .oe_drop_zone, .oe_drop_zone_style { background: rgba(153, 0, 255, 0.17); - border-radius: 3px; } - .oe_drop_zone.oe_hover, .oe_drop_zone_style.oe_hover { - background: rgba(0, 255, 133, 0.22); - z-index: 1001; } + border-radius: 3px; +} +.oe_drop_zone.oe_hover, .oe_drop_zone_style.oe_hover { + background: rgba(0, 255, 133, 0.22); + z-index: 1001; +} .oe_drop_zone_style { color: white; height: 48px; - margin-bottom: 32px; } + margin-bottom: 32px; +} /* ---- SNIPPET MANIPULATOR ---- */ .oe_overlay { @@ -270,64 +327,79 @@ table.editorbar-panel { -o-transition: opacity 100ms linear; transition: opacity 100ms linear; box-sizing: border-box; - pointer-events: none; } - .oe_overlay.oe_active { - display: block; - border-style: dashed; - border-width: 1px; - box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.3), 0px 0px 0px 1px rgba(255, 255, 255, 0.3) inset; - border-color: rgba(153, 0, 255, 0.5); } - .oe_overlay.oe_active .oe_handle { - display: block !important; - pointer-events: auto; } - .oe_overlay.oe_active .oe_handle:before { - position: relative; - top: 50%; - left: 50%; - display: block; - background: white; - border: solid 1px #9900ff; - border-radius: 8px; - width: 16px; - height: 16px; - margin: -8px; - padding-left: 1px; - font-size: 14px; - line-height: 14px; - color: #9900ff; - -webkit-transition: background 100ms linear; - -moz-transition: background 100ms linear; - -o-transition: background 100ms linear; - transition: background 100ms linear; } - .oe_overlay.oe_active .oe_handle:hover:before { - background: #9900ff; - color: white; } - .oe_overlay.oe_active .oe_handle.e:before { - content: "⇨"; } - .oe_overlay.oe_active .oe_handle.s:before { - content: "⇩"; } - .oe_overlay.oe_active .oe_handle.w:before { - content: "⇦"; } - .oe_overlay.oe_active .oe_handle.n:before { - content: "⇧"; } - .oe_overlay .icon.btn { - display: inline-block; } - .oe_overlay .oe_overlay_options { - position: absolute; - width: 100%; - text-align: center; - top: -11px; - z-index: 1002; } - .oe_overlay .oe_overlay_options .btn, .oe_overlay .oe_overlay_options a { - pointer-events: auto; - cursor: pointer; } - .oe_overlay .oe_overlay_options .dropdown { - display: inline-block; } - .oe_overlay .oe_overlay_options .dropdown-menu { - text-align: left; - min-width: 180px; } - .oe_overlay .oe_overlay_options .dropdown-menu select, .oe_overlay .oe_overlay_options .dropdown-menu input { - display: block; } + pointer-events: none; +} +.oe_overlay.oe_active { + display: block; + border-style: dashed; + border-width: 1px; + box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.3), 0px 0px 0px 1px rgba(255, 255, 255, 0.3) inset; + border-color: rgba(153, 0, 255, 0.5); +} +.oe_overlay.oe_active .oe_handle { + display: block !important; + pointer-events: auto; +} +.oe_overlay.oe_active .oe_handle:before { + position: relative; + top: 50%; + left: 50%; + display: block; + background: white; + border: solid 1px #9900ff; + border-radius: 8px; + width: 16px; + height: 16px; + margin: -8px; + padding-left: 1px; + font-size: 14px; + line-height: 14px; + color: #9900ff; + -webkit-transition: background 100ms linear; + -moz-transition: background 100ms linear; + -o-transition: background 100ms linear; + transition: background 100ms linear; +} +.oe_overlay.oe_active .oe_handle:hover:before { + background: #9900ff; + color: white; +} +.oe_overlay.oe_active .oe_handle.e:before { + content: "⇨"; +} +.oe_overlay.oe_active .oe_handle.s:before { + content: "⇩"; +} +.oe_overlay.oe_active .oe_handle.w:before { + content: "⇦"; +} +.oe_overlay.oe_active .oe_handle.n:before { + content: "⇧"; +} +.oe_overlay .icon.btn { + display: inline-block; +} +.oe_overlay .oe_overlay_options { + position: absolute; + width: 100%; + text-align: center; + top: -11px; + z-index: 1002; +} +.oe_overlay .oe_overlay_options .btn, .oe_overlay .oe_overlay_options a { + pointer-events: auto; + cursor: pointer; +} +.oe_overlay .oe_overlay_options .dropdown { + display: inline-block; +} +.oe_overlay .oe_overlay_options .dropdown-menu { + text-align: left; + min-width: 180px; +} +.oe_overlay .oe_overlay_options .dropdown-menu select, .oe_overlay .oe_overlay_options .dropdown-menu input { + display: block; +} .oe_handle { pointer-events: auto; @@ -338,48 +410,58 @@ table.editorbar-panel { box-sizing: border-box; width: 8px; height: 8px; - margin: -4px; } + margin: -4px; +} .oe_handle.n { left: 2px; width: 100%; top: 0px; - cursor: s-resize; } + cursor: s-resize; +} .oe_handle.e { left: auto; top: 2px; height: 100%; right: 0px; - cursor: w-resize; } + cursor: w-resize; +} .oe_handle.s { top: auto; left: 2px; width: 100%; bottom: 0px; - cursor: n-resize; } + cursor: n-resize; +} .oe_handle.w { top: 2px; height: 100%; left: 0px; - cursor: e-resize; } + cursor: e-resize; +} .s-resize-important, .s-resize-important * { - cursor: s-resize !important; } + cursor: s-resize !important; +} .n-resize-important, .n-resize-important * { - cursor: n-resize !important; } + cursor: n-resize !important; +} .e-resize-important, .e-resize-important * { - cursor: e-resize !important; } + cursor: e-resize !important; +} .w-resize-important, .w-resize-important * { - cursor: w-resize !important; } + cursor: w-resize !important; +} .move-important, .move-important * { - cursor: move !important; } + cursor: move !important; +} /* ---- MOBILE PREVIEW ---- */ .oe_mobile_preview.modal .modal-content { @@ -392,52 +474,67 @@ table.editorbar-panel { left: 0; bottom: 0; right: 0; - max-width: 330px; } - .oe_mobile_preview.modal .modal-content .modal-header { - background-color: black; - border-bottom: 0; - border-top-left-radius: 10px; - border-top-right-radius: 10px; } - .oe_mobile_preview.modal .modal-content .modal-header .modal-title { - color: #1c1f1f; } - .oe_mobile_preview.modal .modal-content .modal-header .close { - color: lightgrey; - opacity: 1; } - .oe_mobile_preview.modal .modal-content .modal-header .close:hover { - color: #e00101; - opacity: 1; } - .oe_mobile_preview.modal .modal-content .modal-body { - background-color: black; - max-height: 600px; - padding: 0; - margin: 0; } - .oe_mobile_preview.modal .modal-content .modal-body .oe_mobile_viewport { - width: 320px; - height: 568px; - padding: 5px; - border: none; } - .oe_mobile_preview.modal .modal-content .modal-footer { - background-color: black; } + max-width: 330px; +} +.oe_mobile_preview.modal .modal-content .modal-header { + background-color: black; + border-bottom: 0; + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} +.oe_mobile_preview.modal .modal-content .modal-header .modal-title { + color: #1c1f1f; +} +.oe_mobile_preview.modal .modal-content .modal-header .close { + color: lightgrey; + opacity: 1; +} +.oe_mobile_preview.modal .modal-content .modal-header .close:hover { + color: #e00101; + opacity: 1; +} +.oe_mobile_preview.modal .modal-content .modal-body { + background-color: black; + max-height: 600px; + padding: 0; + margin: 0; +} +.oe_mobile_preview.modal .modal-content .modal-body .oe_mobile_viewport { + width: 320px; + height: 568px; + padding: 5px; + border: none; +} +.oe_mobile_preview.modal .modal-content .modal-footer { + background-color: black; +} /* ---- SEO TOOLS ---- */ .oe_seo_configuration .modal-dialog { - width: 80%; } + width: 80%; +} .oe_seo_configuration .oe_remove { - color: #e00101; } + color: #e00101; +} .oe_seo_configuration .oe_seo_suggestion { - cursor: pointer; } + cursor: pointer; +} .oe_seo_configuration .oe_seo_keyword { padding: 0.2em 0.4em 0.2em 0.5em; - border-radius: 0.4em; } + border-radius: 0.4em; +} .oe_seo_configuration .keyword-in-title { background-color: #5cb85c; - color: white; } + color: white; +} .oe_seo_configuration .keyword-in-description { background-color: #428bca; - color: white; } + color: white; +} .oe_seo_configuration .keyword-in-body { background-color: #5bc0de; - color: white; } + color: white; +} /* ---- ACE EDITOR ---- */ .oe_ace_view_editor { @@ -450,40 +547,49 @@ table.editorbar-panel { top: 51px; right: 0; z-index: 1000; - height: 100%; } - .oe_ace_view_editor .oe_ace_view_editor_title { - width: 100%; - padding-top: 4px; - padding-left: 4px; - height: 40px; - background: #2f3129; } - .oe_ace_view_editor .oe_ace_view_editor_title .oe_view_list { - width: 50%; - height: 32px; - font-size: 14px; - font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; - line-height: normal; } - .oe_ace_view_editor .oe_ace_view_editor_title .btn { - height: 32px; - padding: 0 4px 0 4px; - font-size: 14px; - font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; - line-height: normal; } - .oe_ace_view_editor .ace_editor { - position: absolute; - top: 40px; - right: 0; - bottom: 51px; - left: 0; - width: 720px; } - .oe_ace_view_editor:hover { - opacity: 1; } - .oe_ace_view_editor.oe_ace_open { - width: 720px; } - .oe_ace_view_editor.oe_ace_closed { - width: 0; - opacity: 0; } + height: 100%; +} +.oe_ace_view_editor .oe_ace_view_editor_title { + width: 100%; + padding-top: 4px; + padding-left: 4px; + height: 40px; + background: #2f3129; +} +.oe_ace_view_editor .oe_ace_view_editor_title .oe_view_list { + width: 50%; + height: 32px; + font-size: 14px; + font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; + line-height: normal; +} +.oe_ace_view_editor .oe_ace_view_editor_title .btn { + height: 32px; + padding: 0 4px 0 4px; + font-size: 14px; + font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace; + line-height: normal; +} +.oe_ace_view_editor .ace_editor { + position: absolute; + top: 40px; + right: 0; + bottom: 51px; + left: 0; + width: 720px; +} +.oe_ace_view_editor:hover { + opacity: 1; +} +.oe_ace_view_editor.oe_ace_open { + width: 720px; +} +.oe_ace_view_editor.oe_ace_closed { + width: 0; + opacity: 0; +} /* ---- EDITOR TOUR ---- */ -.popover.tour-tour { - z-index: 2010; } +.popover.tour { + z-index: 2010; +} diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index f676b757ca8..c5e3f39b7c8 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -176,7 +176,7 @@ table.editorbar-panel div width: 100px text-align: center - @include transform( translate(-39px, 44px) , rotate(-90deg) ) + @include transform( translate(-39px, 44px) , rotate(-90deg) ) @include transform-origin(50% 50%) .oe_snippet @@ -486,7 +486,7 @@ $navbar_height: 51px /* ---- EDITOR TOUR ---- */ -.popover.tour-tour +.popover.tour z-index: 2010 // vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 641ceff786f..2f13116d47c 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -6,26 +6,28 @@ function render (template, dict) { return openerp.qweb.render(template, dict); - }; + } website.EditorTour = openerp.Class.extend({ editor: undefined, + tour: undefined, steps: [], tourStorage: window.localStorage, init: function (editor) { this.editor = editor; - this.tour = new Tour({ - storage: this.tourStorage, - keyboard: false, - }); }, reset: function () { - this.tourStorage.removeItem('tour_current_step'); - this.tourStorage.removeItem('tour_end'); + this.tourStorage.removeItem(this.id+'_current_step'); + this.tourStorage.removeItem(this.id+'_end'); $('.popover.tour').remove(); }, start: function () { var self = this; + self.tour = new Tour({ + name: self.id, + storage: this.tourStorage, + keyboard: false, + }); self.tour.addSteps(_.map(self.steps, function (step) { step.title = render('website.tour_title', { title: step.title }); return step; @@ -38,27 +40,27 @@ return this.currentStepIndex() > 0 || this.tour.ended(); }, currentStepIndex: function () { - return parseInt(this.tourStorage.getItem('tour_current_step'), 10); + return parseInt(this.tourStorage.getItem(this.id+'_current_step'), 10); }, - indexOfStep: function (step_id) { + indexOfStep: function (stepId) { var index = -1; _.each(this.steps, function (step, i) { - if (step.step_id === step_id) { + if (step.stepId === stepId) { index = i; } }); return index; }, - movetoStep: function (step_id) { + movetoStep: function (stepId) { $('.popover.tour').remove(); - var index = this.indexOfStep(step_id); + var index = this.indexOfStep(stepId); if (index > -1) { this.tour.goto(index); } }, - saveStep: function (step_id) { - var index = this.indexOfStep(step_id); - this.tourStorage.setItem('tour_current_step', index); + saveStep: function (stepId) { + var index = this.indexOfStep(stepId); + this.tourStorage.setItem(this.id+'_current_step', index); }, stop: function () { this.tour.end(); @@ -66,12 +68,13 @@ }); website.EditorBasicTour = website.EditorTour.extend({ - name: "Add a banner to your page", + id: 'add_banner_tour', + name: "How to add a banner", start: function () { var self = this; self.steps = [ { - step_id: 'welcome', + stepId: 'welcome', orphan: true, backdrop: true, title: "Welcome to your website!", @@ -79,7 +82,7 @@ template: render('website.tour_confirm', { confirm: "Tell me more!" }), }, { - step_id: 'edit-page', + stepId: 'edit-page', element: 'button[data-action=edit]', placement: 'right', reflex: true, @@ -88,7 +91,7 @@ template: render('website.tour_simple'), }, { - step_id: 'show-bar', + stepId: 'show-bar', element: '#website-top-navbar', placement: 'bottom', title: "Editor bar", @@ -96,7 +99,7 @@ template: render('website.tour_confirm', { confirm: "Got it, now what?" }), }, { - step_id: 'add-block', + stepId: 'add-block', element: 'button[data-action=snippet]', placement: 'right', reflex: true, @@ -105,7 +108,7 @@ template: render('website.tour_simple'), }, { - step_id: 'drag-banner', + stepId: 'drag-banner', element: '#website-top-navbar [data-snippet-id=carousel]', placement: 'bottom', title: "Add a banner to your page", @@ -126,7 +129,7 @@ }, }, { - step_id: 'edit-title', + stepId: 'edit-title', element: '#wrap [data-snippet-id=carousel]:first .carousel-caption', placement: 'top', title: "Change the title", @@ -140,7 +143,7 @@ }, }, { - step_id: 'customize-banner', + stepId: 'customize-banner', element: '.oe_overlay_options .oe_options', placement: 'left', title: "Customize the banner", @@ -153,7 +156,7 @@ }, }, { - step_id: 'save-changes', + stepId: 'save-changes', element: 'button[data-action=save]', placement: 'right', reflex: true, @@ -165,11 +168,19 @@ } }, { - step_id: 'part-2', + stepId: 'part-2', orphan: true, title: "Welcome to part 2", content: "Congratulations on your first modifications.", - template: render('website.tour_end', { confirm: "Thanks :)" }), + template: render('website.tour_confirm', { confirm: "Thanks :)" }), + }, + { + stepId: 'show-tutorials', + element: '#help-menu-button', + placement: 'left', + title: "Help is always available", + content: "You can find more tutorials in the Help menu.", + template: render('website.tour_end', { confirm: "See you next time..." }), }, ]; return this._super(); @@ -186,6 +197,15 @@ website.tutorials = { basic: new website.EditorBasicTour(this), }; + var menu = $('#help-menu'); + _.each(website.tutorials, function (tutorial) { + var $menuItem = $($.parseHTML('
  • '+tutorial.name+'
  • ')); + $menuItem.click(function () { + tutorial.reset(); + tutorial.start(); + }) + menu.append($menuItem); + }); website.tutorials.basic.start(); return this._super(); }, diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml index c2f7abe6ed2..a47449606bc 100644 --- a/addons/website/static/src/xml/website.xml +++ b/addons/website/static/src/xml/website.xml @@ -23,11 +23,17 @@
  • Promote
  • +
  • Apps