From 6b38eac5d9ce84353eb8f28136d9603d52200cb9 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Mon, 1 Jul 2013 02:20:54 +0200 Subject: [PATCH] website layout, contactus, homepage bzr revid: al@openerp.com-20130701002054-wggvlsjfxjcza3o6 --- addons/account/account_view.xml | 1 + addons/ecommerce/views/ecommerce.xml | 20 ++- addons/website/__openerp__.py | 2 +- addons/website/controllers/main.py | 74 +++------ addons/website/static/src/css/website.css | 104 ++++++++++-- addons/website/views/homepage.html | 187 ---------------------- addons/website/views/test.xml | 42 ----- addons/website/views/views.xml | 160 ++++++++++++++++++ 8 files changed, 291 insertions(+), 299 deletions(-) delete mode 100644 addons/website/views/homepage.html delete mode 100644 addons/website/views/test.xml create mode 100644 addons/website/views/views.xml diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 758385d66cb..cf66b4f9ccb 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1204,6 +1204,7 @@ account.move.line + tree diff --git a/addons/ecommerce/views/ecommerce.xml b/addons/ecommerce/views/ecommerce.xml index b59a17ee568..3dee1eb50d1 100644 --- a/addons/ecommerce/views/ecommerce.xml +++ b/addons/ecommerce/views/ecommerce.xml @@ -2,6 +2,23 @@ + + + + layout_ecommerce + + + + +
  • Shop
  • +
    + + SHOP Footer + +
    +
    +
    + @@ -69,6 +86,7 @@ ecommerce_categories form +

    Product categories

    @@ -93,4 +111,4 @@ - \ No newline at end of file + diff --git a/addons/website/__openerp__.py b/addons/website/__openerp__.py index 2bb8fedb714..e148f0101a9 100644 --- a/addons/website/__openerp__.py +++ b/addons/website/__openerp__.py @@ -11,7 +11,7 @@ OpenERP Website CMS 'depends': ['base'], 'installable': True, 'data': [ - 'views/test.xml' + 'views/views.xml' ], 'js': ['static/src/js/website.js'], 'css': ['static/src/css/website.css'], diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index ea74b71728b..5b0a99d4093 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -1,61 +1,14 @@ # -*- coding: utf-8 -*- - -from jinja2 import Template # WIP ! - import openerp from openerp.addons.web import http from openerp.addons.web.controllers.main import manifest_list from openerp.addons.web.http import request -def get_html_head(): - head = ['' % i for i in manifest_list('js', db=request.db)] - head += ['' % i for i in manifest_list('css', db=request.db)] - head += [''] - return "\n ".join(head) - -# WIIIP !! -module_template = Template(""" - {%- for module in modules %} - -
    -
    - -
    -
    -
    {{ module.shortdesc }}
    -
    {{ module.summary }}
    -
    - {%- endfor %} -""") - - class Website(openerp.addons.web.controllers.main.Home): @http.route('/', type='http', auth="db") def index(self, **kw): - editable = bool(request.session._uid) - try: - request.session.check_security() - except http.SessionExpiredException: - editable = False - # WIIIIIIIP !!! - html = open(openerp.addons.get_module_resource('website', 'views', 'homepage.html'), 'rb').read().decode('utf8') - modules = request.registry.get("ir.module.module").search_read(request.cr, openerp.SUPERUSER_ID, fields=['id', 'shortdesc', 'summary', 'icon_image'], limit=50) - modules_html = module_template.render(modules=modules) - html = html.replace(u'', modules_html) - if editable: - html = html.replace('', get_html_head()) - return html + return self.page("website.homepage") @http.route('/admin', type='http', auth="none") def admin(self, *args, **kw): @@ -63,17 +16,30 @@ class Website(openerp.addons.web.controllers.main.Home): @http.route('/page/', type='http', auth="db") def page(self, path): - editable = bool(request.session._uid) - uid = request.session._uid or openerp.SUPERUSER_ID + #def get_html_head(): + # head = ['' % i for i in manifest_list('js', db=request.db)] + # head += ['' % i for i in manifest_list('css', db=request.db)] + # head += [''] + #modules = request.registry.get("ir.module.module").search_read(request.cr, openerp.SUPERUSER_ID, fields=['id', 'shortdesc', 'summary', 'icon_image'], limit=50) try: request.session.check_security() + editable = True + uid = request.session._uid except http.SessionExpiredException: editable = False uid = openerp.SUPERUSER_ID - html = request.registry.get("ir.ui.view").render(request.cr, uid, path, {}) - if editable: - html = html.replace('', get_html_head()) + context = { + 'inherit_branding': editable + } + values = { + 'editable': editable, + 'request': request, + 'registry': request.registry, + 'cr': request.cr, + 'uid': uid, + 'res_company': request.registry['res.company'].browse(request.cr, uid, 1, context=context), + } + html = request.registry.get("ir.ui.view").render(request.cr, uid, path, values, context) return html - # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 9d407de8f85..a7f79c31faa 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -1,24 +1,100 @@ +/* vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker:fdl=0 +*/ @charset "utf-8"; -.oe_website_editorbar { - position: fixed; - top: 0; - right: 0; - z-index: 10; - display: block; - width: 100%; - padding: 10px; - margin: 0px; - background: #e9e9e9; - box-sizing: border-box; + +.oe_website { + background: #e9e9e9; + color: #646464; } + +.oe_website_header { + background: #fff; + color: #333; + padding-top: 8px; +} + +/* Body {{{ */ +.oe_website_body { + background: #fff; + color: #333; + padding-bottom: 32px; + padding-top: 32px; +} +/* }}} */ + +/* Footer {{{ */ +.oe_website_footer { + border-top: solid 1px #e0e0e0; + padding-bottom: 32px; + padding-top: 32px; +} + +.oe_website_footer h5 { + border-bottom: solid 1px rgba(0, 0, 0, 0.06); + margin-right: 24px; + padding-bottom: 6px; + margin-bottom: 6px; + margin-top: 24px; +} + +.oe_website_footer ul { + list-style: none; + padding: 0; + margin: 0; +} + +.oe_website_footer ul li { + display: block; + margin-bottom: 4px; + font-size: 14px; + margin-right: 32px; +} + +.oe_website_footer ul li a { + color: inherit; + text-decoration: inherit; +} + +.oe_website_footer ul li a:visited { + color: inherit; + text-decoration: inherit; +} + +.oe_website_footer ul li a:hover { + color: black; + text-decoration: inherit; +} + +.oe_website_copy { + margin-top: 24px; + margin-bottom: 6px; +} +/* }}} */ + +/* Editor {{{ */ +.oe_website_editorbar { + position: fixed; + top: 0; + right: 0; + z-index: 10; + display: block; + width: 100%; + padding: 10px; + margin: 0px; + background: #e9e9e9; + box-sizing: border-box; +} + .oe_website_editorbar li { - display: inline; + display: inline; } .oe_website_editor_container .oe_editable { - outline: 1px dotted green; + outline: 1px dotted green; } .oe_website_editor_container .oe_editable.oe_dirty { - outline: 1px dotted red; + outline: 1px dotted red; } + +/* }}} */ diff --git a/addons/website/views/homepage.html b/addons/website/views/homepage.html deleted file mode 100644 index d27bbf882f1..00000000000 --- a/addons/website/views/homepage.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - OpenERP - Beautiful Business Applications - - - - - - - - - - - - - - - -
    -
    - -
    - -
    -
    -
    -
    -
    OpenERP7.0
    -
    - Beautiful Business Applications
    - Powerful, Integrated, Open Source
    - Start your free trial -
    -
    -
    -
    -
    -
    -
    OpenDays
    -
    The Open Source event of the year
    July 1-5, 2013
    Agenda & Registration
    -
    -
    -
    -
    - - -
    - -
    - -
    -

    Choose Your Application

    -
    - -
    -
    - - - - diff --git a/addons/website/views/test.xml b/addons/website/views/test.xml deleted file mode 100644 index dfac956dbc5..00000000000 --- a/addons/website/views/test.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - template1 - form - - - -
    This is the header
    -
    This is the header
    -
    This is the main content
    - - - -
    -
    - - - template2 - - res.users - - - -
  • Event
  • -
    - - - -
    -
    -
    - -
    -
    diff --git a/addons/website/views/views.xml b/addons/website/views/views.xml new file mode 100644 index 00000000000..49bbdc31e57 --- /dev/null +++ b/addons/website/views/views.xml @@ -0,0 +1,160 @@ + + + + + layout + qweb + + + + + <t t-esc="res_company.name"/> + + + + + + + + +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +

    I'm an empty page, please edit me...

    +
    +
    +
    + + + +
    +
    + + + homepage + qweb + + + +
    +
    +
    +

    Banner title

    +
    +
    +
    +
    +
    +
    + Description +
    +
    +
    +
    +
    +
    + + + contactus + qweb + + + Contact us - +
    +
    +
    +

    Contact us

    +
    +
    +
    + Name
    +
    + ,
    + Belgium
    +
    + &#x2706;
    + +
    + +
    +
    +
    +
    +
    +
    + + + +
    +