From d97d58f5db12f17b723bc9f1cb71b924470efc11 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 8 Sep 2013 23:01:39 +0200 Subject: [PATCH 1/5] [IMP] structure in snippets bzr revid: fp@openerp.com-20130908210139-3wsl86ij3yd5udqz --- addons/website/static/src/css/editor.css | 14 +- addons/website/static/src/css/editor.sass | 11 +- addons/website/views/views.xml | 253 +++++++++++++++------- 3 files changed, 189 insertions(+), 89 deletions(-) diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index df098f28353..1e751f861c9 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -1,3 +1,4 @@ +@charset "utf-8"; /* ---- CKEditor Minimal Reset ---- */ .navbar.navbar-inverse .cke_chrome { border: none; @@ -105,13 +106,18 @@ table.editorbar-panel td.selected { left: 0px; right: 0px; bottom: 0px; - max-height: 280px; - min-height: 140px; background: #282828; box-shadow: 0px 10px 10px -10px black inset; overflow-y: auto; z-index: 100; } +.oe_snippets .nav-pills { + padding: 3px 8px; + background: #444444; +} +.oe_snippets .nav-pills > li > a { + padding: 2px 10px !important; +} .oe_snippet { display: inline-block; @@ -120,10 +126,10 @@ table.editorbar-panel td.selected { width: 120px; height: 120px; border-radius: 3px; - margin: 10px; + margin: 8px; margin-right: 0px; position: relative; - box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.2); overflow: hidden; -webkit-user-select: none; user-select: none; diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index 2da2b4bbeeb..135523cc1c2 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -98,12 +98,15 @@ table.editorbar-panel left: 0px right: 0px bottom: 0px - max-height: 280px - min-height: 140px background: rgb(40,40,40) box-shadow: 0px 10px 10px -10px black inset overflow-y: auto z-index: 100 + .nav-pills + padding: 3px 8px + background: #444 + > li > a + padding: 2px 10px !important .oe_snippet display: inline-block @@ -112,10 +115,10 @@ table.editorbar-panel width: 120px height: 120px border-radius: 3px - margin: 10px + margin: 8px margin-right: 0px position: relative - box-shadow: 0px 3px 10px rgba(0,0,0,0.2) + box-shadow: 0px 3px 8px rgba(0,0,0,0.2) overflow: hidden -webkit-user-select: none user-select: none diff --git a/addons/website/views/views.xml b/addons/website/views/views.xml index 90de96e1541..6fabb6f2945 100644 --- a/addons/website/views/views.xml +++ b/addons/website/views/views.xml @@ -196,8 +196,8 @@
-

Welcome To Your New Homepage,

-

where everything can be customized

+

Your Company Slogan

+

Your company subheader slogan

@@ -229,7 +229,8 @@
-

Ut enim ad minim veniam

+

Ut enim ad minim veniam

+

Ut enim veniam

@@ -419,90 +420,180 @@ From cb8bdad1ec6380ff0d6afaab13fe6c99ecba9587 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 10 Sep 2013 13:51:59 +0200 Subject: [PATCH 2/5] [FIX] website_sale: reduce qty bzr revid: chm@openerp.com-20130910115159-qdmhi4rdmxqz5cm3 --- .../static/src/js/website_sale.js | 21 ++++++++++++------- addons/website_sale/views/website_sale.xml | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index d1278d3bed1..f45e1be81d6 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -22,13 +22,17 @@ $(document).ready(function () { $(".oe_website_sale .oe_mycart input.js_quantity").change(function () { var $input = $(this); var value = parseInt($input.val()); - if (!isNaN(value)) { - $.get("./set_cart/", {'order_line_id': $(this).data('id'), 'set_number': value, 'json': true}, function (data) { - var data = JSON.parse(data); - set_my_cart_quantity(data[1]); - $input.val(data[0]); - }); - } + if (isNaN(value)) value = 0; + $.get("./set_cart/", {'order_line_id': $input.data('id'), 'set_number': value, 'json': true}, function (data) { + var data = JSON.parse(data); + set_my_cart_quantity(data[1]); + $input.val(data[0]); + if (!+data[0]) { + $.get('/shop/remove_cart/', {'order_line_id': $input.data('id'), 'json': true,}, function (data) { + location.reload(); + }); + } + }); }); $(".oe_website_sale #product_detail select[name='public_categ_id']").change(function () { @@ -43,6 +47,9 @@ $(document).ready(function () { $link = $(ev.currentTarget); $.get($link.attr("href"), {'json': true}, function (data) { var data = JSON.parse(data); + if (!+data[0]) { + location.reload(); + } set_my_cart_quantity(data[1]); $link.parent().find(".js_quantity").val(data[0]); }); diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index cec36b21210..2d3ed3f20dc 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -48,7 +48,7 @@
  • - My cart + My cart
  • @@ -57,7 +57,7 @@
  • - My cart + My cart
  • From f61e65539eadd44be7894395d0b50cc97a73d0f9 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 10 Sep 2013 14:26:46 +0200 Subject: [PATCH 3/5] [IMP] website: auto open editor when create new product (use ?unable_editor in url) bzr revid: chm@openerp.com-20130910122646-ug8dn61rqgbm3eq3 --- addons/website/static/src/css/website.css | 5 ++--- addons/website/static/src/css/website.sass | 4 ++-- addons/website/static/src/js/website.editor.js | 10 +++++++--- addons/website_sale/controllers/main.py | 9 +++++---- addons/website_sale/views/website_sale.xml | 16 +++------------- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 3c8aee57ef2..77db53b45e9 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -193,6 +193,8 @@ a[data-publish][data-publish='on']:hover .css_published { [data-publish]:not(a) { position: relative; overflow: visible; + /*&:hover > [data-publish] */ + /* display: block */ } [data-publish]:not(a) > [data-publish] { position: absolute; @@ -200,6 +202,3 @@ a[data-publish][data-publish='on']:hover .css_published { top: -10px; display: none; } -[data-publish]:not(a):hover > [data-publish] { - display: block; -} diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass index b5468a4b0e8..9992a8586ef 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -156,5 +156,5 @@ a[data-publish] right: -6px top: -10px display: none - &:hover > [data-publish] - display: block \ No newline at end of file + /*&:hover > [data-publish]*/ + /* display: block*/ \ No newline at end of file diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 8056998eef9..dff61f1dd4a 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -118,7 +118,11 @@ var editor = new website.EditorBar(); var $body = $(document.body); - editor.prependTo($body); + editor.prependTo($body).then(function () { + if (location.search.indexOf("unable_editor") >= 0) { + editor.edit(); + } + }); $body.css('padding-top', '50px'); // Not working properly: editor.$el.outerHeight()); }; /* ----- TOP EDITOR BAR FOR ADMIN ---- */ @@ -240,7 +244,7 @@ defs.push(def); }); return $.when.apply(null, defs).then(function () { - window.location.reload(); + window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?/, ''); }); }, saveElement: function ($el) { @@ -263,7 +267,7 @@ }); }, cancel: function () { - window.location.reload(); + window.location.href = window.location.href.replace(/unable_editor(=[^&]*)?/, ''); }, }); diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index e50bdb71707..d36f822d273 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -122,10 +122,11 @@ class Ecommerce(http.Controller): } return request.webcontext.render("website_sale.product", values) - @website.route(['/shop/add_product/'], type='http', auth="public") - def add_product(self, **post): - product_id = request.registry.get('product.product').create(request.cr, request.uid, {'name': 'New Product'}, request.context) - return werkzeug.utils.redirect("/shop/product/%s/" % product_id) + @website.route(['/shop/add_product/', '/shop/category//add_product/'], type='http', auth="public") + def add_product(self, cat_id=0, **post): + product_id = request.registry.get('product.product').create(request.cr, request.uid, + {'name': 'New Product', 'public_categ_id': cat_id}, request.context) + return werkzeug.utils.redirect("/shop/product/%s/?unable_editor=1" % product_id) @website.route(['/shop/change_category//'], type='http', auth="public") def edit_product(self, product_id=0, **post): diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 2d3ed3f20dc..7633109a3a4 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -73,7 +73,6 @@ Shop - Categories
    - Create New Product
    @@ -121,6 +120,8 @@ Product + Create New Product +
    pull-left @@ -182,18 +183,7 @@ -
    -

    Category
    Select the public category

    - -

    Short Description for Quotations
    Displayed in your shop categories and for quotations

    -
    Enter a short description for this product
    -
    -
    Enter a short Website description for this product
    +
    Replace this text with your Website product description
    €
    From 9693c18da29200574ad84bfe6ae5e19525f6a901 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 10 Sep 2013 14:31:01 +0200 Subject: [PATCH 4/5] [FIX] website.snippet: don't call snippet if the thumbnail is not dropped inside a drop zone bzr revid: chm@openerp.com-20130910123101-ixosjev7tcx08g1z --- addons/website/static/src/js/website.snippets.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index cde25d7e692..eadd5549fbf 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -189,6 +189,11 @@ }, drop: function(){ var snipped_id = $snippet.data('snippet-id'); + + if (!$(".oe_drop_zone.oe_hover").length) { + return false; + } + if($snippet.find('.oe_snippet_body').size()){ var $toInsert = $snippet.find('.oe_snippet_body').clone(); $toInsert.removeClass('oe_snippet_body'); From 0e82448ed8adc54a73fd01046e7e5c4225b2bdd4 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 10 Sep 2013 15:41:33 +0200 Subject: [PATCH 5/5] [IMP] Refactor code + WIP multiwebsite bzr revid: fme@openerp.com-20130910134133-esdgbhbtt8eguapk --- addons/website/controllers/main.py | 12 +- addons/website/views/views.xml | 10 +- addons/website/website.py | 181 +++++++----------- addons/website/website_data.xml | 34 +--- addons/website_contract/controllers/main.py | 24 +-- addons/website_crm/controllers/main.py | 4 +- .../controllers/main.py | 17 +- addons/website_event/controllers/main.py | 22 +-- addons/website_google_map/controllers/main.py | 6 +- addons/website_hr/controllers/main.py | 2 +- addons/website_mail/controllers/main.py | 18 +- addons/website_membership/controllers/main.py | 9 +- addons/website_project/controllers/main.py | 15 +- addons/website_sale/controllers/main.py | 26 ++- addons/website_sale/views/website_sale.xml | 2 +- 15 files changed, 154 insertions(+), 228 deletions(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 3412d0afbd3..7b9fb9da846 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -105,15 +105,17 @@ class Website(openerp.addons.web.controllers.main.Home): view.write(request.cr, request.uid, [view_id], {'inherit_id': view_option_id}, context=request.context) - return request.webcontext.render('website.themes', {'theme_changed': True}) + return request.website.render('website.themes', {'theme_changed': True}) @website.route('/page/', type='http', auth="admin") def page(self, path, **kwargs): - request.webcontext['path'] = path + values = { + 'path': path, + } try: - html = request.webcontext.render(path) + html = request.website.render(path, values) except ValueError: - html = request.webcontext.render('website.404') + html = request.website.render('website.404', values) return html @website.route('/website/customize_template_toggle', type='json', auth='admin') # FIXME: auth @@ -266,6 +268,6 @@ class Website(openerp.addons.web.controllers.main.Home): @website.route(['/website/kanban/'], type='http', auth="public") def kanban(self, **post): - return request.registry['website'].kanban_col(**post) + return request.website.kanban_col(**post) # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/website/views/views.xml b/addons/website/views/views.xml index 1a58c37a313..db8d95b4e9b 100644 --- a/addons/website/views/views.xml +++ b/addons/website/views/views.xml @@ -69,16 +69,16 @@