@@ -457,7 +457,7 @@
- Public Categories
+ Pos/Public Product Categories
ir.actions.act_window
product.public.category
form
@@ -476,7 +476,7 @@
-
+
diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py
index aa7200c79b3..a5f4013a7df 100644
--- a/addons/website/models/ir_qweb.py
+++ b/addons/website/models/ir_qweb.py
@@ -183,7 +183,7 @@ class Text(orm.AbstractModel):
_inherit = ['website.qweb.field', 'ir.qweb.field.text']
def from_html(self, cr, uid, model, column, element, context=None):
- return element.text_content()
+ return html_to_text(element)
class Selection(orm.AbstractModel):
_name = 'website.qweb.field.selection'
@@ -211,7 +211,8 @@ class ManyToOne(orm.AbstractModel):
M2O = self.pool[column._obj]
field = element.get('data-oe-field')
id = int(element.get('data-oe-id'))
- value = element.text_content().strip()
+ # FIXME: weird things are going to happen for char-type _rec_name
+ value = html_to_text(element)
# if anything blows up, just ignore it and bail
try:
@@ -419,3 +420,102 @@ class Contact(orm.AbstractModel):
}, engine='website.qweb', context=context)
return ir_qweb.HTMLSafe(html)
+
+def html_to_text(element):
+ """ Converts HTML content with HTML-specified line breaks (br, p, div, ...)
+ in roughly equivalent textual content.
+
+ Used to replace and fixup the roundtripping of text and m2o: when using
+ libxml 2.8.0 (but not 2.9.1) and parsing HTML with lxml.html.fromstring
+ whitespace text nodes (text nodes composed *solely* of whitespace) are
+ stripped out with no recourse, and fundamentally relying on newlines
+ being in the text (e.g. inserted during user edition) is probably poor form
+ anyway.
+
+ -> this utility function collapses whitespace sequences and replaces
+ nodes by roughly corresponding linebreaks
+ * p are pre-and post-fixed by 2 newlines
+ * br are replaced by a single newline
+ * block-level elements not already mentioned are pre- and post-fixed by
+ a single newline
+
+ ought be somewhat similar (but much less high-tech) to aaronsw's html2text.
+ the latter produces full-blown markdown, our text -> html converter only
+ replaces newlines by
elements at this point so we're reverting that,
+ and a few more newline-ish elements in case the user tried to add
+ newlines/paragraphs into the text field
+
+ :param element: lxml.html content
+ :returns: corresponding pure-text output
+ """
+
+ # output is a list of str | int. Integers are padding requests (in minimum
+ # number of newlines). When multiple padding requests, fold them into the
+ # biggest one
+ output = []
+ _wrap(element, output)
+
+ # remove any leading or tailing whitespace, replace sequences of
+ # (whitespace)\n(whitespace) by a single newline, where (whitespace) is a
+ # non-newline whitespace in this case
+ return re.sub(
+ r'[ \t\r\f]*\n[ \t\r\f]*',
+ '\n',
+ ''.join(_realize_padding(output)).strip())
+
+_PADDED_BLOCK = set('p h1 h2 h3 h4 h5 h6'.split())
+# https://developer.mozilla.org/en-US/docs/HTML/Block-level_elements minus p
+_MISC_BLOCK = set((
+ 'address article aside audio blockquote canvas dd dl div figcaption figure'
+ ' footer form header hgroup hr ol output pre section tfoot ul video'
+).split())
+
+def _collapse_whitespace(text):
+ """ Collapses sequences of whitespace characters in ``text`` to a single
+ space
+ """
+ return re.sub('\s+', ' ', text)
+def _realize_padding(it):
+ """ Fold and convert padding requests: integers in the output sequence are
+ requests for at least n newlines of padding. Runs thereof can be collapsed
+ into the largest requests and converted to newlines.
+ """
+ padding = None
+ for item in it:
+ if isinstance(item, int):
+ padding = max(padding, item)
+ continue
+
+ if padding:
+ yield '\n' * padding
+ padding = None
+
+ yield item
+ # leftover padding irrelevant as the output will be stripped
+
+def _wrap(element, output, wrapper=u''):
+ """ Recursively extracts text from ``element`` (via _element_to_text), and
+ wraps it all in ``wrapper``. Extracted text is added to ``output``
+
+ :type wrapper: basestring | int
+ """
+ output.append(wrapper)
+ if element.text:
+ output.append(_collapse_whitespace(element.text))
+ for child in element:
+ _element_to_text(child, output)
+ output.append(wrapper)
+
+def _element_to_text(e, output):
+ if e.tag == 'br':
+ output.append(u'\n')
+ elif e.tag in _PADDED_BLOCK:
+ _wrap(e, output, 2)
+ elif e.tag in _MISC_BLOCK:
+ _wrap(e, output, 1)
+ else:
+ # inline
+ _wrap(e, output)
+
+ if e.tail:
+ output.append(_collapse_whitespace(e.tail))
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index 611b582d9ce..ccdfe449617 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -624,7 +624,7 @@ class res_company(osv.osv):
partner = self.browse(cr, openerp.SUPERUSER_ID, ids[0], context=context).partner_id
return partner and partner.google_map_link(zoom, context=context) or None
-class base_language_install(osv.osv):
+class base_language_install(osv.osv_memory):
_inherit = "base.language.install"
_columns = {
'website_ids': fields.many2many('website', string='Websites to translate'),
diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css
index f552465c8bc..d786830c8f5 100644
--- a/addons/website/static/src/css/editor.css
+++ b/addons/website/static/src/css/editor.css
@@ -81,6 +81,10 @@
outline: none !important;
}
+.css_editable_display {
+ display: block !important;
+}
+
.css_non_editable_mode_hidden {
display: none;
}
@@ -103,6 +107,14 @@
top: 2px;
}
+.oe_structure.oe_empty:empty, [data-oe-type=html]:empty, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child {
+ background-image: url("/website/static/src/img/edit_here.png") !important;
+}
+
+.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before {
+ content: "Press The Top-Left Edit Button" !important;
+}
+
/* ---- EDITOR BAR ---- {{{ */
table.editorbar-panel {
cursor: pointer;
@@ -432,6 +444,10 @@ ul.oe_menu_editor .disclose {
}
/* ---- SNIPPET MANIPULATOR ---- {{{ */
+.resize_editor_busy {
+ background-color: rgba(0, 0, 0, 0.3);
+}
+
.oe_overlay {
display: none;
position: absolute;
@@ -514,16 +530,28 @@ ul.oe_menu_editor .disclose {
.oe_overlay .oe_handle.e:before {
content: "\F061";
}
-.oe_overlay .oe_handle.s {
+.oe_overlay .oe_handle.s, .oe_overlay .oe_handle.size {
top: auto;
left: 2px;
width: 100%;
bottom: -4px;
cursor: n-resize;
}
-.oe_overlay .oe_handle.s:before {
+.oe_overlay .oe_handle.s:before, .oe_overlay .oe_handle.size:before {
content: "\F063";
}
+.oe_overlay .oe_handle.size {
+ border-style: dashed;
+ border-width: 0 0 1px 0;
+ border-color: rgba(0, 0, 0, 0.5);
+}
+.oe_overlay .oe_handle.size:before {
+ content: "Resize";
+ width: 64px;
+ text-align: center;
+ margin-left: -32px;
+ margin-top: -4px;
+}
.oe_overlay .oe_handle.w {
top: 2px;
height: 100%;
diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass
index 9def6bc7127..66665252379 100644
--- a/addons/website/static/src/css/editor.sass
+++ b/addons/website/static/src/css/editor.sass
@@ -67,6 +67,9 @@
.oe_editable:focus
outline: none !important
+.css_editable_display
+ display: block !important
+
.css_non_editable_mode_hidden
display: none
@@ -85,6 +88,12 @@
position: relative !important
top: +2px
+.oe_structure.oe_empty:empty, [data-oe-type=html]:empty, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child
+ background-image: url('/website/static/src/img/edit_here.png') !important
+
+.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before
+ content: 'Press The Top-Left Edit Button' !important
+
// }}}
/* ---- EDITOR BAR ---- {{{ */
@@ -349,6 +358,8 @@ ul.oe_menu_editor
/* ---- SNIPPET MANIPULATOR ---- {{{ */
+.resize_editor_busy
+ background-color: rgba(0,0,0,0.3)
.oe_overlay
display: none
position: absolute
@@ -403,7 +414,7 @@ ul.oe_menu_editor
cursor: w-resize
&:before
content: "\F061"
- .oe_handle.s
+ .oe_handle.s, .oe_handle.size
top: auto
left: 2px
width: 100%
@@ -411,6 +422,16 @@ ul.oe_menu_editor
cursor: n-resize
&:before
content: "\F063"
+ .oe_handle.size
+ border-style: dashed
+ border-width: 0 0 1px 0
+ border-color: rgba(0, 0, 0, 0.5)
+ &:before
+ content: "Resize"
+ width: 64px
+ text-align: center
+ margin-left: -32px
+ margin-top: -4px
.oe_handle.w
top: 2px
height: 100%
diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css
index bf261cf905a..65b322bd9e9 100644
--- a/addons/website/static/src/css/website.css
+++ b/addons/website/static/src/css/website.css
@@ -78,95 +78,6 @@
margin-bottom: 0px !important;
}
-.pt128 {
- padding-top: 128px !important;
-}
-
-.pt92 {
- padding-top: 92px !important;
-}
-
-.pt64 {
- padding-top: 64px !important;
-}
-
-.pt48 {
- padding-top: 48px !important;
-}
-
-.pt32 {
- padding-top: 32px !important;
-}
-
-.pt16 {
- padding-top: 16px !important;
-}
-
-.pt8 {
- padding-top: 8px !important;
-}
-
-.pt4 {
- padding-top: 4px !important;
-}
-
-.pt0 {
- padding-top: 0px !important;
-}
-
-.pb128 {
- padding-bottom: 128px !important;
-}
-
-.pb92 {
- padding-bottom: 92px !important;
-}
-
-.pb64 {
- padding-bottom: 64px !important;
-}
-
-.pb48 {
- padding-bottom: 48px !important;
-}
-
-.pb32 {
- padding-bottom: 32px !important;
-}
-
-.pb16 {
- padding-bottom: 16px !important;
-}
-
-.pb8 {
- padding-bottom: 8px !important;
-}
-
-.pb4 {
- padding-bottom: 4px !important;
-}
-
-.pb0 {
- padding-bottom: 0px !important;
-}
-
-/* Grid of unequally tall elements */
-.grid > [class*="col-md"] {
- display: inline-block;
- float: none;
- vertical-align: top;
- box-sizing: border-box;
-}
-.grid > [class*="col-md"].grid-align-top > [class*="col-md"] {
- vertical-align: top;
-}
-.grid > [class*="col-md"].grid-align-middle > [class*="col-md"] {
- vertical-align: middle;
-}
-.grid > [class*="col-md"].grid-align-bottom > [class*="col-md"] {
- vertical-align: bottom;
-}
-
/* Extra Styles */
img.shadow {
-webkit-border-radius: 3px;
@@ -185,9 +96,14 @@ h1.text-muted, h2.text-muted, h3.text-muted {
}
/* ----- BOOTSTRAP HACK FOR HEADER NAV BAR ----- */
-.navbar.navbar-default.navbar-static-top {
+.navbar.navbar-static-top {
margin-bottom: 0;
}
+.navbar.navbar-static-top ul.nav > li.divider {
+ margin-top: 15px;
+ padding-top: 20px;
+ border-right: 1px solid grey;
+}
/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */
html, body, #wrapwrap {
@@ -209,7 +125,7 @@ header, main, footer {
footer {
height: 100%;
background: #eff8f8;
- background: rgba(100, 200, 200, 0.1);
+ background: rgba(200, 200, 200, 0.1);
}
#footer_container {
@@ -233,7 +149,7 @@ footer {
}
.oe_structure.oe_empty:empty, [data-oe-type=html]:empty, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child {
- background-image: url("/website/static/src/img/edit_here.png");
+ background-image: url("/website/static/src/img/under_construction.png");
background-repeat: no-repeat;
background-position: center;
height: 220px !important;
@@ -244,7 +160,7 @@ footer {
}
.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before {
- content: "Press The Top-Left Edit Button";
+ content: "This page is under construction";
text-align: center;
display: block;
padding-top: 160px;
@@ -257,6 +173,10 @@ footer {
content: "Drag Building Blocks Here";
}
+.css_editable_display {
+ display: none;
+}
+
/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */
.navbar .nav > li > p {
margin-bottom: 0px;
@@ -334,20 +254,23 @@ ul.nav-stacked > li > a {
}
/* ---- SNIPPETS --- */
+[data-snippet-id], .colmd, .hr, .blockquote {
+ overflow: hidden;
+}
+
+@media (max-width: 400px) {
+ [data-snippet-id] {
+ height: auto !important;
+ }
+}
+.carousel-inner {
+ height: 100%;
+}
.carousel-inner .item {
height: 100%;
background-size: 100%;
}
-.carousel.oe_small .carousel-inner {
- height: 200px;
-}
-.carousel.oe_medium .carousel-inner {
- height: 300px;
-}
-.carousel.oe_big .carousel-inner {
- height: 450px;
-}
.carousel .carousel-caption {
left: auto;
right: auto;
@@ -434,7 +357,7 @@ div.carousel[data-snippet-id="slider"] .carousel-indicators .active {
/* Background */
.oe_dark {
background: #eff8f8;
- background: rgba(100, 200, 200, 0.14);
+ background: rgba(200, 200, 200, 0.14);
-webkit-box-shadow: 0px 5px 9px -7px rgba(0, 0, 255, 0.5) inset, 0px -3px 9px -7px rgba(0, 0, 255, 0.5) inset;
-moz-box-shadow: 0px 5px 9px -7px rgba(0, 0, 255, 0.5) inset, 0px -3px 9px -7px rgba(0, 0, 255, 0.5) inset;
box-shadow: 0px 5px 9px -7px rgba(0, 0, 255, 0.5) inset, 0px -3px 9px -7px rgba(0, 0, 255, 0.5) inset;
@@ -442,16 +365,55 @@ div.carousel[data-snippet-id="slider"] .carousel-indicators .active {
.oe_black {
background-color: rgba(0, 0, 0, 0.9);
+ color: white;
}
.oe_green {
- background-color: rgba(0, 128, 0, 0.8);
+ background-color: #51d466;
+ color: white;
+}
+.oe_green .text-muted {
+ color: #dddddd;
+}
+
+.oe_blue_light {
+ background-color: #4791d2;
+ color: white;
+}
+.oe_blue_light .text-muted {
+ color: #dddddd;
+}
+
+.oe_blue {
+ background-color: #34495e;
+ color: white;
+}
+
+.oe_orange {
+ background-color: #e67e22;
+ color: white;
+}
+.oe_orange .text-muted {
+ color: #dddddd;
+}
+
+.oe_purple {
+ background-color: #b163a3;
+ color: white;
+}
+.oe_purple .text-muted {
+ color: #dddddd;
}
.oe_red {
- background-color: rgba(255, 0, 0, 0.8);
+ background-color: #f75353;
+ color: white;
+}
+.oe_red .text-muted {
+ color: #dddddd;
}
+/* Misc */
.oe_img_bg {
background-size: 100%;
}
@@ -511,45 +473,3 @@ span[data-oe-type="monetary"] {
-o-column-count: 3;
column-count: 3;
}
-
-.bs-callout {
- margin: 20px 0;
- padding: 20px;
- border-left: 3px solid #eeeeee;
-}
-
-.bs-callout h4 {
- margin-top: 0;
- margin-bottom: 5px;
-}
-
-.bs-callout p:last-child {
- margin-bottom: 0;
-}
-
-.bs-callout-danger {
- background-color: #fdf7f7;
- border-color: #eed3d7;
-}
-
-.bs-callout-danger h4 {
- color: #b94a48;
-}
-
-.bs-callout-warning {
- background-color: #faf8f0;
- border-color: #faebcc;
-}
-
-.bs-callout-warning h4 {
- color: #8a6d3b;
-}
-
-.bs-callout-info {
- background-color: #f4f8fa;
- border-color: #bce8f1;
-}
-
-.bs-callout-info h4 {
- color: #34789a;
-}
diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass
index ccd11d3396f..7422a9008ba 100644
--- a/addons/website/static/src/css/website.sass
+++ b/addons/website/static/src/css/website.sass
@@ -51,57 +51,6 @@
.mb0
margin-bottom: 0px !important
-.pt128
- padding-top: 128px !important
-.pt92
- padding-top: 92px !important
-.pt64
- padding-top: 64px !important
-.pt48
- padding-top: 48px !important
-.pt32
- padding-top: 32px !important
-.pt16
- padding-top: 16px !important
-.pt8
- padding-top: 8px !important
-.pt4
- padding-top: 4px !important
-.pt0
- padding-top: 0px !important
-
-.pb128
- padding-bottom: 128px !important
-.pb92
- padding-bottom: 92px !important
-.pb64
- padding-bottom: 64px !important
-.pb48
- padding-bottom: 48px !important
-.pb32
- padding-bottom: 32px !important
-.pb16
- padding-bottom: 16px !important
-.pb8
- padding-bottom: 8px !important
-.pb4
- padding-bottom: 4px !important
-.pb0
- padding-bottom: 0px !important
-
-/* Grid of unequally tall elements */
-.grid > [class*="col-md"]
- display: inline-block
- float: none
- vertical-align: top
- box-sizing: border-box
- &.grid-align-top > [class*="col-md"]
- vertical-align: top
- &.grid-align-middle > [class*="col-md"]
- vertical-align: middle
- &.grid-align-bottom > [class*="col-md"]
- vertical-align: bottom
-
/* Extra Styles */
img.shadow
@@ -114,8 +63,13 @@ h1.text-muted, h2.text-muted, h3.text-muted
/* ----- BOOTSTRAP HACK FOR HEADER NAV BAR ----- */
-.navbar.navbar-default.navbar-static-top
+.navbar.navbar-static-top
margin-bottom: 0
+ ul.nav
+ > li.divider
+ margin-top: 15px
+ padding-top: 20px
+ border-right: 1px solid grey
/* ----- BOOTSTRAP HACK FOR STICKY FOOTER ----- */
@@ -133,7 +87,7 @@ header, main, footer
footer
height: 100%
background: rgb(239, 248, 248)
- background: rgba(100, 200, 200, 0.1)
+ background: rgba(200, 200, 200, 0.1)
#footer_container
padding-top: 24px
@@ -154,7 +108,7 @@ footer
background-image: url('/website/static/src/img/drag_here.png')
.oe_structure.oe_empty:empty, [data-oe-type=html]:empty, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child
- background-image: url('/website/static/src/img/edit_here.png')
+ background-image: url('/website/static/src/img/under_construction.png')
background-repeat: no-repeat
background-position: center
height: 220px !important
@@ -163,7 +117,7 @@ footer
position: static
.oe_structure.oe_empty:empty:before, [data-oe-type=html]:empty:before, .oe_structure.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before
- content: 'Press The Top-Left Edit Button'
+ content: 'This page is under construction'
text-align: center
display: block
padding-top: 160px
@@ -174,6 +128,9 @@ footer
.oe_structure.oe_editable.oe_empty:empty:before, .oe_editable[data-oe-type=html]:empty:before, .oe_structure.oe_editable.oe_empty > .oe_drop_zone.oe_insert:only-child:before, [data-oe-type=html] > .oe_drop_zone.oe_insert:only-child:before
content: 'Drag Building Blocks Here'
+.css_editable_display
+ display: none
+
/* ---- HACK FOR COVERING UP CK EDITOR BOGUS P INSERTION --- */
.navbar .nav > li > p
@@ -242,18 +199,19 @@ ul.nav-stacked > li > a
color: white
/* ---- SNIPPETS --- */
+[data-snippet-id],.colmd,.hr,.blockquote
+ overflow: hidden
-.carousel-inner .item
+@media (max-width: 400px)
+ [data-snippet-id]
+ height: auto !important
+
+.carousel-inner
height: 100%
- background-size: 100%
-
+ .item
+ height: 100%
+ background-size: 100%
.carousel
- &.oe_small .carousel-inner
- height: 200px
- &.oe_medium .carousel-inner
- height: 300px
- &.oe_big .carousel-inner
- height: 450px
.carousel-caption
left: auto
right: auto
@@ -326,17 +284,52 @@ div.carousel[data-snippet-id="slider"]
padding: 32px 0
/* Background */
-
+
.oe_dark
background: #eff8f8
- background: rgba(100, 200, 200, 0.14)
+ background: rgba(200, 200, 200, 0.14)
+box-shadow(0px 5px 9px -7px rgba(0, 0, 255, 0.5) inset, 0px -3px 9px -7px rgba(0, 0, 255, 0.5) inset)
+
.oe_black
background-color: rgba(0, 0, 0, 0.9)
+ color: white
+
.oe_green
- background-color: rgba(0, 128, 0, 0.8)
+ background-color: #51d466
+ color: white
+ .text-muted
+ color: #ddd
+
+.oe_blue_light
+ background-color: #4791d2
+ color: white
+ .text-muted
+ color: #ddd
+
+.oe_blue
+ background-color: #34495e
+ color: white
+
+.oe_orange
+ background-color: #e67e22
+ color: white
+ .text-muted
+ color: #ddd
+
+.oe_purple
+ background-color: #b163a3
+ color: white
+ .text-muted
+ color: #ddd
+
.oe_red
- background-color: rgba(255, 0, 0, 0.8)
+ background-color: #f75353
+ color: white
+ .text-muted
+ color: #ddd
+
+/* Misc */
+
.oe_img_bg
background-size: 100%
@@ -382,30 +375,3 @@ span[data-oe-type="monetary"]
.oe_template_fallback
@include column-count(3)
-// ---- Callouts from bootstrap doc ---- {{{
-.bs-callout
- margin: 20px 0
- padding: 20px
- border-left: 3px solid #eee
-.bs-callout h4
- margin-top: 0
- margin-bottom: 5px
-.bs-callout p:last-child
- margin-bottom: 0
-
-.bs-callout-danger
- background-color: #fdf7f7
- border-color: #eed3d7
-.bs-callout-danger h4
- color: #b94a48
-.bs-callout-warning
- background-color: #faf8f0
- border-color: #faebcc
-.bs-callout-warning h4
- color: #8a6d3b
-.bs-callout-info
- background-color: #f4f8fa
- border-color: #bce8f1
-.bs-callout-info h4
- color: #34789a
-// }}}
diff --git a/addons/website/static/src/img/blocks/block_features.png b/addons/website/static/src/img/blocks/block_features.png
new file mode 100644
index 00000000000..b56b1f7ba98
Binary files /dev/null and b/addons/website/static/src/img/blocks/block_features.png differ
diff --git a/addons/website/static/src/img/under_construction.png b/addons/website/static/src/img/under_construction.png
new file mode 100644
index 00000000000..2d5ee85de9b
Binary files /dev/null and b/addons/website/static/src/img/under_construction.png differ
diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js
index f3b8a5c5885..4ff5aa44146 100644
--- a/addons/website/static/src/js/website.ace.js
+++ b/addons/website/static/src/js/website.ace.js
@@ -94,6 +94,11 @@
}).then(function (views) {
self.loadViews.call(self, views);
self.open.call(self);
+ // cf. fp's direct request
+ if (views.length >= 2) {
+ var mainTemplate = views[1];
+ self.$('#ace-view-list').val(mainTemplate.id).trigger('change');
+ }
});
var $editor = self.$('.ace_editor');
diff --git a/addons/website/static/src/js/website.seo.js b/addons/website/static/src/js/website.seo.js
index ecfc3d77b1c..563f850486e 100644
--- a/addons/website/static/src/js/website.seo.js
+++ b/addons/website/static/src/js/website.seo.js
@@ -92,7 +92,7 @@
}
});
}
- $.getJSON("http://seo.eu01.aws.af.cm/suggest/"+encodeURIComponent(this.root + " "), addSuggestions);
+ $.getJSON("http://suggest.hp.af.cm/suggest/"+encodeURIComponent(this.root + " "), addSuggestions);
},
});
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js
index 50975a7263d..6c0a062125d 100644
--- a/addons/website/static/src/js/website.snippets.editor.js
+++ b/addons/website/static/src/js/website.snippets.editor.js
@@ -126,6 +126,9 @@
self.make_active(false);
self.$el.toggleClass("hidden");
});
+ $("#wrapwrap").click(function () {
+ self.$el.addClass("hidden");
+ });
this.fetch_snippet_templates();
@@ -181,6 +184,7 @@
'top': pos.top - mt,
'left': pos.left
});
+ $el.find(".oe_handle.size").css("bottom", mb+'px');
},
show: function () {
this.$el.removeClass("hidden");
@@ -678,17 +682,6 @@
});
- website.snippet.styleRegistry.size = website.snippet.StyleEditor.extend({
- select: function(event, np) {
- this._super(event, np);
- this.parent.parent.cover_target(this.$overlay, this.$target);
- },
- preview: function (event, np) {
- this._super(event, np);
- this.parent.parent.cover_target(this.$overlay, this.$target);
- }
- });
-
website.snippet.styleRegistry.background = website.snippet.StyleEditor.extend({
_get_bg: function () {
return this.$target.css("background-image").replace(/url\(['"]*|['"]*\)|^none$/g, "");
@@ -879,7 +872,7 @@
}
var Editor = website.snippet.styleRegistry[val['snippet-style-id']] || website.snippet.StyleEditor;
var editor = new Editor(self, self.$target, val['snippet-style-id']);
- $ul.prepend(editor.$el);
+ $ul.prepend(editor.$el.addClass("snippet-style-" + val['snippet-style-id']));
});
if ($ul.find("li").length) {
@@ -973,96 +966,121 @@
if (!resize_values.s) $box.find(".oe_handle.s").remove();
if (!resize_values.e) $box.find(".oe_handle.e").remove();
if (!resize_values.w) $box.find(".oe_handle.w").remove();
+ if (!resize_values.size) $box.find(".oe_handle.size").remove();
this.$overlay.append($box.find(".oe_handles").html());
this.$overlay.find(".oe_handle").on('mousedown', function (event){
- event.preventDefault();
+ event.preventDefault();
- var $handle = $(this);
+ var $handle = $(this);
- var resize_values = self.getSize();
- var compass = false;
- var XY = false;
- if ($handle.hasClass('n')) {
- compass = 'n';
- XY = 'Y';
- }
- else if ($handle.hasClass('s')) {
- compass = 's';
- XY = 'Y';
- }
- else if ($handle.hasClass('e')) {
- compass = 'e';
- XY = 'X';
- }
- else if ($handle.hasClass('w')) {
- compass = 'w';
- XY = 'X';
- }
+ var resize_values = self.getSize();
+ var compass = false;
+ var XY = false;
+ if ($handle.hasClass('n')) {
+ compass = 'n';
+ XY = 'Y';
+ }
+ else if ($handle.hasClass('s')) {
+ compass = 's';
+ XY = 'Y';
+ }
+ else if ($handle.hasClass('e')) {
+ compass = 'e';
+ XY = 'X';
+ }
+ else if ($handle.hasClass('w')) {
+ compass = 'w';
+ XY = 'X';
+ }
+ else if ($handle.hasClass('size')) {
+ compass = 'size';
+ XY = 'Y';
+ }
- var resize = resize_values[compass];
- if (!resize) return;
+ var resize = resize_values[compass];
+ if (!resize) return;
+
+ if (compass === 'size') {
+ var grid = resize[0];
+ var offset = self.$target.offset().top;
+ if (self.$target.css("background").match(/rgba\(0, 0, 0, 0\)/)) {
+ self.$target.addClass("resize_editor_busy");
+ }
+ } else {
+ var xy = event['page'+XY];
var current = resize[2] || 0;
_.each(resize[0], function (val, key) {
if (self.$target.hasClass(val)) {
current = key;
}
});
-
- self.parent.editor_busy = true;
-
- var xy = event['page'+XY];
var begin = current;
var beginClass = self.$target.attr("class");
var regClass = new RegExp("\\s*" + resize[0][begin].replace(/[-]*[0-9]+/, '[-]*[0-9]+'), 'g');
+ }
- var cursor = $handle.css("cursor")+'-important';
- var $body = $(document.body);
- $body.addClass(cursor);
+ self.parent.editor_busy = true;
- var body_mousemove = function (event){
- event.preventDefault();
- var dd = event['page'+XY] - xy + resize[1][begin];
- var next = current+1 === resize[1].length ? current : (current+1);
- var prev = current ? (current-1) : 0;
+ var cursor = $handle.css("cursor")+'-important';
+ var $body = $(document.body);
+ $body.addClass(cursor);
- var change = false;
- if (dd > (2*resize[1][next] + resize[1][current])/3) {
- self.$target.attr("class", (self.$target.attr("class")||'').replace(regClass, ''));
- self.$target.addClass(resize[0][next]);
- current = next;
- change = true;
- }
- if (prev != current && dd < (2*resize[1][prev] + resize[1][current])/3) {
- self.$target.attr("class", (self.$target.attr("class")||'').replace(regClass, ''));
- self.$target.addClass(resize[0][prev]);
- current = prev;
- change = true;
- }
+ var body_mousemove = function (event){
+ event.preventDefault();
+ if (compass === 'size') {
+ var dy = event.pageY-offset;
+ dy = dy - dy%resize[0];
+ if (dy <= 0) dy = resize[0];
+ self.$target.css("height", dy+"px");
+ self.on_resize(compass, beginClass, current);
+ self.parent.cover_target(self.$overlay, self.$target);
+ return;
+ }
+ var dd = event['page'+XY] - xy + resize[1][begin];
+ var next = current+1 === resize[1].length ? current : (current+1);
+ var prev = current ? (current-1) : 0;
- if (change) {
- self.on_resize(compass, beginClass, current);
- self.parent.cover_target(self.$overlay, self.$target);
- }
- };
+ var change = false;
+ if (dd > (2*resize[1][next] + resize[1][current])/3) {
+ self.$target.attr("class", (self.$target.attr("class")||'').replace(regClass, ''));
+ self.$target.addClass(resize[0][next]);
+ current = next;
+ change = true;
+ }
+ if (prev != current && dd < (2*resize[1][prev] + resize[1][current])/3) {
+ self.$target.attr("class", (self.$target.attr("class")||'').replace(regClass, ''));
+ self.$target.addClass(resize[0][prev]);
+ current = prev;
+ change = true;
+ }
- var body_mouseup = function(){
- $body.unbind('mousemove', body_mousemove);
- $body.unbind('mouseup', body_mouseup);
- $body.removeClass(cursor);
- self.parent.editor_busy = false;
- };
- $body.mousemove(body_mousemove);
- $body.mouseup(body_mouseup);
- });
+ if (change) {
+ self.on_resize(compass, beginClass, current);
+ self.parent.cover_target(self.$overlay, self.$target);
+ }
+ };
+
+ var body_mouseup = function(){
+ $body.unbind('mousemove', body_mousemove);
+ $body.unbind('mouseup', body_mouseup);
+ $body.removeClass(cursor);
+ self.parent.editor_busy = false;
+ self.$target.removeClass("resize_editor_busy");
+ };
+ $body.mousemove(body_mousemove);
+ $body.mouseup(body_mouseup);
+ });
},
getSize: function () {
var grid = [0,4,8,16,32,48,64,92,128];
this.grid = {
+ // list of class (Array), grid (Array), default value (INT)
n: [_.map(grid, function (v) {return 'mt'+v;}), grid],
- s: [_.map(grid, function (v) {return 'mb'+v;}), grid]
+ s: [_.map(grid, function (v) {return 'mb'+v;}), grid],
+ size: [8]
};
return this.grid;
},
@@ -1089,6 +1107,8 @@
var grid = [-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11];
this.grid.w = [_.map(grid, function (v) {return 'col-md-offset-'+v;}), _.map(grid, function (v) {return width/12*v;}), 12];
+ this.grid.s = null;
+
return this.grid;
},
_drag_and_drop_after_insert_dropzone: function(){
@@ -1277,6 +1297,10 @@
this.$target.css("background-image", "");
this.$target.removeClass(this._class);
},
+ load_style_options : function () {
+ this._super();
+ $(".snippet-style-size li[data-class='']").remove();
+ },
start : function () {
var self = this;
this._super();
diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js
index 54b5dcfb02b..3e1763c0e20 100644
--- a/addons/website/static/src/js/website.tour.js
+++ b/addons/website/static/src/js/website.tour.js
@@ -291,7 +291,7 @@
var self = this;
var testId = 'test_'+tour.id+'_tour';
this.tours.push(tour);
- var stepDelay = 500; //ms
+ var defaultDelay = 500; //ms
var test = {
id: tour.id,
run: function (force) {
@@ -299,31 +299,33 @@
this.reset();
}
var actionSteps = _.filter(tour.steps, function (step) {
- return step.trigger;
+ return step.trigger || step.sampleText;
});
function executeStep (step) {
window.localStorage.setItem(testId, step.stepId);
- step.triggers(function () {
+ function next () {
var nextStep = actionSteps.shift();
if (nextStep) {
- // Ensure the previous step has been fully propagated
- setTimeout(function () {
- setTimeout(function () {
- executeStep(nextStep);
- }, stepDelay);
- }, 0);
+ executeStep(nextStep);
} else {
window.localStorage.removeItem(testId);
}
- });
- var $element = $(step.element);
- if (step.snippet && step.trigger === 'drag') {
- website.TestConsole.dragAndDropSnippet(step.snippet);
- } else if (step.trigger.id === 'change') {
- $element.trigger($.Event("change", { srcElement: $element }));
- } else {
- $element.trigger($.Event("click", { srcElement: $element }));
}
+ setTimeout(function () {
+ if (step.triggers) step.triggers(next);
+ var $element = $(step.element);
+ if (step.snippet && step.trigger === 'drag') {
+ website.TestConsole.dragAndDropSnippet(step.snippet);
+ } else if (step.trigger && step.trigger.id === 'change') {
+ $element.trigger($.Event("change", { srcElement: $element }));
+ } else if (step.sampleText) {
+ $element.val(step.sampleText);
+ $element.trigger($.Event("change", { srcElement: $element }));
+ } else if ($element.is(":visible")) { // Click by default
+ $element.trigger($.Event("click", { srcElement: $element }));
+ }
+ if (!step.triggers) next();
+ }, step.delay || defaultDelay);
}
var url = new website.UrlParser(window.location.href);
if (tour.path && url.pathname !== tour.path) {
@@ -342,11 +344,7 @@
executeStep(currentStep);
});
} else {
- setTimeout(function () {
- setTimeout(function () {
- executeStep(currentStep);
- }, stepDelay);
- }, 0);
+ executeStep(currentStep);
}
}
},
diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml
index ecc3bb8cc38..ca5cf01705f 100644
--- a/addons/website/static/src/xml/website.snippets.xml
+++ b/addons/website/static/src/xml/website.snippets.xml
@@ -86,6 +86,7 @@
+