From 901f57382605ccb3498666d2c2120ef5143f438d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2013 13:12:21 +0200 Subject: [PATCH 01/27] [REF] document_page: refactored the module, towards using it in website_blog Main modifications: - category is now a blog.catory object, instead of a document.page with type='category' - added blog.tag model, to be able to tag posts - cleaned document.page, now blog.post model, removing type and unnecessary features - added chatter on blog.post, blog.category - added subtypes to enable direct follow of posts when following a category - updated document.page.history (now blog.post.history) - commented menu creation, because this does not seem to be necessary anymore considering the new website - updated wizard.document.page.history.show_diff, now blog.post.history.show_diff - updated all views accordingly, as well as demo data - removed the use of document_user group, simplified rules on blog.post (not done for new models) - misc cleaning Next step: merge with website_mail bzr revid: tde@openerp.com-20130920111221-qy3x5eoyih26axn8 --- addons/document_page/__openerp__.py | 20 +- addons/document_page/document_page.py | 114 ++++++------ addons/document_page/document_page_data.xml | 58 +++--- addons/document_page/document_page_demo.xml | 44 +++-- addons/document_page/document_page_view.xml | 172 ++++++++++-------- .../security/document_page_security.xml | 8 +- .../security/ir.model.access.csv | 6 +- .../static/src/css/document_page.css | 4 - .../test/document_page_test00.yml | 8 +- addons/document_page/wizard/__init__.py | 2 +- .../wizard/document_page_show_diff.py | 8 +- .../wizard/document_page_show_diff_view.xml | 8 +- 12 files changed, 232 insertions(+), 220 deletions(-) diff --git a/addons/document_page/__openerp__.py b/addons/document_page/__openerp__.py index f08315bf61e..34138f3c719 100644 --- a/addons/document_page/__openerp__.py +++ b/addons/document_page/__openerp__.py @@ -30,19 +30,25 @@ Web pages """, 'author': ['OpenERP SA'], 'website': 'http://www.openerp.com/', - 'depends': ['knowledge'], + 'depends': ['mail', 'knowledge'], 'data': [ - 'wizard/document_page_create_menu_view.xml', + # 'wizard/document_page_create_menu_view.xml', 'wizard/document_page_show_diff_view.xml', 'document_page_view.xml', - 'security/document_page_security.xml', + 'document_page_data.xml', + # 'security/document_page_security.xml', 'security/ir.model.access.csv', ], - 'demo': ['document_page_demo.xml'], - 'test': ['test/document_page_test00.yml'], + 'demo': [ + 'document_page_demo.xml' + ], + 'test': [ + # 'test/document_page_test00.yml' + ], 'installable': True, 'auto_install': False, - 'images': [], - 'css' : ['static/src/css/document_page.css'], + 'css': [ + 'static/src/css/document_page.css' + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_page/document_page.py b/addons/document_page/document_page.py index 7f885018001..0290de6750c 100644 --- a/addons/document_page/document_page.py +++ b/addons/document_page/document_page.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-Today OpenERP SA (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,45 +22,56 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ import difflib -from openerp import tools -class document_page(osv.osv): - _name = "document.page" - _description = "Document Page" + +class BlogCategory(osv.Model): + _name = 'blog.category' + _description = 'Blog Category' + _inherit = ['mail.thread'] _order = 'name' - def _get_page_index(self, cr, uid, page, link=True): - index = [] - for subpage in page.child_ids: - index += ["
  • "+ self._get_page_index(cr, uid, subpage) +"
  • "] - r = '' - if link: - r = '%s'%(page.id,page.name) - if index: - r += "
      " + "".join(index) + "
    " - return r + _columns = { + 'name': fields.char('Name', required=True), + 'description': fields.text('Description'), + 'template': fields.text('Template'), + 'blog_ids': fields.one2many( + 'blog.post', 'category_id', + 'Blogs', + ), + } - def _get_display_content(self, cr, uid, ids, name, args, context=None): - res = {} - for page in self.browse(cr, uid, ids, context=context): - if page.type == "category": - content = self._get_page_index(cr, uid, page, link=False) - else: - content = page.content - res[page.id] = content - return res + +class BlogTag(osv.Model): + _name = 'blog.tag' + _description = 'Blog Tag' + _order = 'name' + + _columns = { + 'name': fields.char('Name', required=True), + } + + +class BlogPost(osv.Model): + _name = "blog.post" + _description = "Blog Post" + _inherit = ['mail.thread'] + _order = 'name' _columns = { 'name': fields.char('Title', required=True), - 'type':fields.selection([('content','Content'), ('category','Category')], 'Type', help="Page type"), - - 'parent_id': fields.many2one('document.page', 'Category', domain=[('type','=','category')]), - 'child_ids': fields.one2many('document.page', 'parent_id', 'Children'), + 'category_id': fields.many2one( + 'blog.category', 'Category', + ondelete='set null', + ), + 'tag_ids': fields.many2many( + 'blog.tag', 'blog_tag_rel', + 'blog_id', 'tag_id', + 'Tags', + ), 'content': fields.text("Content"), - 'display_content': fields.function(_get_display_content, string='Displayed Content', type='text'), - 'history_ids': fields.one2many('document.page.history', 'page_id', 'History'), + 'history_ids': fields.one2many('blog.post.history', 'post_id', 'History'), 'menu_id': fields.many2one('ir.ui.menu', "Menu", readonly=True), 'create_date': fields.datetime("Created on", select=True, readonly=True), @@ -68,52 +79,43 @@ class document_page(osv.osv): 'write_date': fields.datetime("Modification Date", select=True, readonly=True), 'write_uid': fields.many2one('res.users', "Last Contributor", select=True, readonly=True), } - _defaults = { - 'type':'content', - } - - def onchange_parent_id(self, cr, uid, ids, parent_id, content, context=None): - res = {} - if parent_id and not content: - parent = self.browse(cr, uid, parent_id, context=context) - if parent.type == "category": - res['value'] = { - 'content': parent.content, - } - return res def create_history(self, cr, uid, ids, vals, context=None): for i in ids: - history = self.pool.get('document.page.history') + history = self.pool.get('blog.post.history') if vals.get('content'): res = { 'content': vals.get('content', ''), - 'page_id': i, + 'post_id': i, } history.create(cr, uid, res) def create(self, cr, uid, vals, context=None): - page_id = super(document_page, self).create(cr, uid, vals, context) - self.create_history(cr, uid, [page_id], vals, context) - return page_id + if context is None: + context = {} + create_context = dict(context, mail_create_nolog=True) + post_id = super(BlogPost, self).create(cr, uid, vals, context=create_context) + self.create_history(cr, uid, [post_id], vals, context) + return post_id def write(self, cr, uid, ids, vals, context=None): - result = super(document_page, self).write(cr, uid, ids, vals, context) + result = super(BlogPost, self).write(cr, uid, ids, vals, context) self.create_history(cr, uid, ids, vals, context) return result -class document_page_history(osv.osv): - _name = "document.page.history" + +class BlogPostHistory(osv.Model): + _name = "blog.post.history" _description = "Document Page History" _order = 'id DESC' _rec_name = "create_date" _columns = { - 'page_id': fields.many2one('document.page', 'Page'), - 'summary': fields.char('Summary', size=256, select=True), - 'content': fields.text("Content"), - 'create_date': fields.datetime("Date"), - 'create_uid': fields.many2one('res.users', "Modified By"), + 'post_id': fields.many2one('blog.post', 'Blog Post'), + 'summary': fields.char('Summary', size=256, select=True), + 'content': fields.text("Content"), + 'create_date': fields.datetime("Date"), + 'create_uid': fields.many2one('res.users', "Modified By"), } def getDiff(self, cr, uid, v1, v2, context=None): diff --git a/addons/document_page/document_page_data.xml b/addons/document_page/document_page_data.xml index 1cef65694d8..85e8aaed530 100644 --- a/addons/document_page/document_page_data.xml +++ b/addons/document_page/document_page_data.xml @@ -1,41 +1,29 @@ - - - The OpenERP wiki - help, quick start, wiki, formatting - 0 - 1 - Initial Page - ==The OpenERP wiki== - -[[File:http://www.openerp.com/sites/all/themes/openerp/logo.png OpenERP]] + + -The OpenERP wiki allows you to manage your enterprise's contents using wiki -restructured texts. This module provides a collaborative way to manage internal -FAQs, quality manuals, technical references, etc. - -==Keypoints== -* Same formating style than MediaWiki, -* Any number of wiki group for different purposes, -* Detailed history on all pages, -* Integrated with the document management system. - -==Why you should use the OpenERP integrated wiki than a separate wiki system ?== -* Allows links to any document of the system, -* Uses the access controls of OpenERP for uniq access rights management, -* Use it to describe projects, tasks, products, -* Integrated with customer portal to provide restricted external accesses, -* Linked to users processes for quality manuals. - -==To get more information== -* [[Basic Wiki Editing]] -* [[Wiki Documentation]] -* [http://openerp.com The OpenERP website] - - - - + + + New Post + blog.post + + New Post + + Post Published + blog.post + + Post Published + + + + New Post + blog.category + + + category_id + + diff --git a/addons/document_page/document_page_demo.xml b/addons/document_page/document_page_demo.xml index f779ea8313f..f636f5631d0 100644 --- a/addons/document_page/document_page_demo.xml +++ b/addons/document_page/document_page_demo.xml @@ -1,13 +1,13 @@ - - - - - - OpenERP Features - category - + + + + + + News + Presentation of new OpenERP features + Summary of the feature Long explanation @@ -15,13 +15,22 @@ Long explanation Conclusion Additional ressources - - + - - OpenERP 6.1. Functional Demo - + + + functional + + + pos + + + + + OpenERP 7.0 Functional Demo + + @@ -48,9 +57,9 @@ company, with your clients and implement it now for your business.
    - + Personalise Dashboards - + @@ -89,9 +98,10 @@ you change your mind there is a reset button to return to the default view.
    - + Touchscreen Point of Sale - + + diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index 9d02b47d265..5cbc947e172 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -1,116 +1,128 @@ - - + + - - - document.page.tree - document.page - child_ids - 100 + + + blog.category.list + blog.category - + - - - - - document.page.list - document.page + + blog.category.form + blog.category - +
    + + + + + + + +
    + + +
    +
    +
    +
    + + + + blog.post.list + blog.post + + - + - - - document.page.form - document.page + + + blog.post.form + blog.post -
    - -

    - - - + + +

    + + + + + + + + + + - - - - - -
    -
    -
    - -
    - +
    + +
    + +
    + +
    - - - document.page.search - document.page + + + blog.post.search + blog.post - + - + - - - + + + - - Pages - document.page - [('type','=','content')] - {'default_type': 'content'} + + Blog Posts + blog.post form tree,form - - + + -

    - Click to create a new web page. -

    +

    + Click to create a new blog post. +

    - - + + + Category - document.page - [('type','=','category')] - {'default_type': 'category'} + blog.category form tree,form - - - + - - document.page.history.tree - document.page.history + + blog.post.history.tree + blog.post.history @@ -120,11 +132,11 @@ - - document.page.history.form - document.page.history + + blog.post.history.form + blog.post.history -
    +
    diff --git a/addons/mail/tests/test_mail_base.py b/addons/mail/tests/test_mail_base.py index b0f9f72b6f7..841a22c34dd 100644 --- a/addons/mail/tests/test_mail_base.py +++ b/addons/mail/tests/test_mail_base.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Business Applications -# Copyright (c) 2012-TODAY OpenERP S.A. +# Copyright (c) 20123TODAY OpenERP S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/addons/website_blog/__init__.py b/addons/website_blog/__init__.py index 85599508fdd..8b6698d444e 100644 --- a/addons/website_blog/__init__.py +++ b/addons/website_blog/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import controllers -import document_page +import website_blog import res_config +import wizard diff --git a/addons/website_blog/__openerp__.py b/addons/website_blog/__openerp__.py index 67a176df083..104b2f7c073 100644 --- a/addons/website_blog/__openerp__.py +++ b/addons/website_blog/__openerp__.py @@ -30,13 +30,23 @@ OpenERP Blog """, 'author': 'OpenERP SA', - 'depends': ['website_mail', 'document_page'], + 'depends': ['knowledge', 'website_mail'], 'data': [ - 'website_mail_data.xml', - 'views/website_mail.xml', + 'website_blog_data.xml', + 'views/website_blog_views.xml', + 'views/website_templates.xml', 'views/res_config.xml', + # 'wizard/document_page_create_menu_view.xml', + 'wizard/document_page_show_diff_view.xml', + 'security/ir.model.access.csv', 'security/website_mail.xml', ], + 'demo': [ + 'website_blog_demo.xml' + ], + 'test': [ + 'test/document_page_test00.yml' + ], 'qweb': [ 'static/src/xml/*.xml' ], diff --git a/addons/website_blog/document_page.py b/addons/website_blog/document_page.py deleted file mode 100644 index 994e1df028c..00000000000 --- a/addons/website_blog/document_page.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2013-Today OpenERP SA (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp import tools -from openerp import SUPERUSER_ID -from openerp.osv import osv, fields - - -class WebsiteDocumentPage(osv.Model): - """ Inherit document.page to add website-related columns - - - website_published: standard publish column - - website_message_ids: messages to display on website, aka comments - - """ - _inherit = "blog.post" - # maximum number of characters to display in summary - _shorten_max_char = 10 - - def get_shortened_content(self, cr, uid, ids, name, arg, context=None): - res = {} - for page in self.browse(cr, uid, ids, context=context): - try: - body_short = tools.html_email_clean(page.content, remove=True, shorten=True, max_length=self._shorten_max_char) - except Exception: - body_short = False - res[page.id] = body_short - return res - - _columns = { - 'website_published': fields.boolean( - 'Publish', help="Publish on the website" - ), - 'website_published_datetime': fields.datetime( - 'Publish Date' - ), - 'website_message_ids': fields.one2many( - 'mail.message', 'res_id', - domain=lambda self: [ - '&', ('model', '=', self._name), ('type', '=', 'comment') - ], - auto_join=True, - string='Website Messages', - help="Website communication history", - ), - 'shortened_content': fields.function( - get_shortened_content, - type='text', - string='Shortened Content', - help="Shortened content of the page that serves as a summary" - ), - } - - def img(self, cr, uid, ids, field='image_small', context=None): - post = self.browse(cr, SUPERUSER_ID, ids[0], context=context) - return "/website/image?model=%s&field=%s&id=%s" % ('res.users', field, post.create_uid.id) diff --git a/addons/document_page/security/ir.model.access.csv b/addons/website_blog/security/ir.model.access.csv similarity index 100% rename from addons/document_page/security/ir.model.access.csv rename to addons/website_blog/security/ir.model.access.csv diff --git a/addons/website_blog/test/document_page_test00.yml b/addons/website_blog/test/document_page_test00.yml new file mode 100644 index 00000000000..14d090dfd59 --- /dev/null +++ b/addons/website_blog/test/document_page_test00.yml @@ -0,0 +1,54 @@ +- + In order to test the document_page in OpenERP, I create a new page to category blog_category_1 +- + !record {model: blog.post, id: test_page0}: + name: Test Page0 + category_id: blog_category_1 + content: 'Test content + + The Open ERP wiki allows you to manage your enterprise contents using wiki + + restructured texts. This module provides a collaborative way to manage internal + + FAQs, quality manuals, technical references, etc.' + +# - +# I check the category index contains my page. +# - + # !python {model: blog.post}: | + # res = self.read(cr, uid, [ref('blog_category_1')], ['display_content']) + # assert res[0]['display_content'].find('Test Page') > 1 +- + !record {model: blog.post, id: test_page0}: + content: 'Test updated content + + The Open ERP wiki allows you to manage your enterprise contents using wiki + + restructured texts. This module provides a collaborative way to manage internal + + FAQs, quality manuals, technical references, etc. + + Wiki text can easily be edited + ' +- + I check the page history for the current page by clicking on "Page History".After that find difference between history. +- + !python {model: blog.post.history.show_diff}: | + hist_obj = model.pool.get('blog.post.history') + ids = hist_obj.search(cr, uid, [('post_id', '=', ref("test_page0"))]) + model.get_diff(cr, uid, {'active_ids': ids[:] }) +# - +# I click the "create menu" link and i fill the form. +# - + # !record {model: document.page.create.menu, id: test_create_menu0}: + # menu_name: Wiki Test menu + # menu_parent_id: base.menu_base_partner +# - +# I create a Menu by clicking on "create menu" +# - + # !python {model: document.page.create.menu}: | + # ids = [ref("test_create_menu0")] + # context['active_id'] = ref('test_page0') + # self.document_page_menu_create(cr, uid, ids, context) + + diff --git a/addons/document_page/__init__.py b/addons/website_blog/tests/__init__.py similarity index 80% rename from addons/document_page/__init__.py rename to addons/website_blog/tests/__init__.py index 7ce5f4b6474..97f1da2f54b 100644 --- a/addons/document_page/__init__.py +++ b/addons/website_blog/tests/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# +# OpenERP, Open Source Business Applications +# Copyright (c) 20123TODAY OpenERP S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -15,11 +15,14 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## -import document_page -import wizard +from openerp.addons.website_blog.tests import test_controllers + +checks = [ + test_controllers, +] # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/website_blog/tests/test_controllers.py b/addons/website_blog/tests/test_controllers.py new file mode 100644 index 00000000000..60ffa5ac9a3 --- /dev/null +++ b/addons/website_blog/tests/test_controllers.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2013-TODAY OpenERP S.A. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.addons.mail.tests.test_mail_base import TestMailBase +from openerp.tools import mute_logger, email_split + + +class TestControllers(TestMailBase): + + def test_00(self): + cr, uid = self.cr, self.uid diff --git a/addons/document_page/document_page_view.xml b/addons/website_blog/views/website_blog_views.xml similarity index 100% rename from addons/document_page/document_page_view.xml rename to addons/website_blog/views/website_blog_views.xml diff --git a/addons/website_blog/views/website_mail.xml b/addons/website_blog/views/website_templates.xml similarity index 98% rename from addons/website_blog/views/website_mail.xml rename to addons/website_blog/views/website_templates.xml index c6fbbb28b38..dddf59258f7 100644 --- a/addons/website_blog/views/website_mail.xml +++ b/addons/website_blog/views/website_templates.xml @@ -5,10 +5,10 @@ diff --git a/addons/document_page/document_page.py b/addons/website_blog/website_blog.py similarity index 74% rename from addons/document_page/document_page.py rename to addons/website_blog/website_blog.py index d198122aad3..63b5b3477e2 100644 --- a/addons/document_page/document_page.py +++ b/addons/website_blog/website_blog.py @@ -19,8 +19,12 @@ # ############################################################################## -from openerp.osv import fields, osv + +from openerp import tools +from openerp import SUPERUSER_ID +from openerp.osv import osv, fields from openerp.tools.translate import _ + import difflib @@ -56,6 +60,18 @@ class BlogPost(osv.Model): _description = "Blog Post" _inherit = ['mail.thread'] _order = 'name' + # maximum number of characters to display in summary + _shorten_max_char = 10 + + def get_shortened_content(self, cr, uid, ids, name, arg, context=None): + res = {} + for page in self.browse(cr, uid, ids, context=context): + try: + body_short = tools.html_email_clean(page.content, remove=True, shorten=True, max_length=self._shorten_max_char) + except Exception: + body_short = False + res[page.id] = body_short + return res _columns = { 'name': fields.char('Title', required=True), @@ -69,6 +85,28 @@ class BlogPost(osv.Model): 'Tags', ), 'content': fields.text('Content'), + 'shortened_content': fields.function( + get_shortened_content, + type='text', + string='Shortened Content', + help="Shortened content of the page that serves as a summary" + ), + # website control + 'website_published': fields.boolean( + 'Publish', help="Publish on the website" + ), + 'website_published_datetime': fields.datetime( + 'Publish Date' + ), + 'website_message_ids': fields.one2many( + 'mail.message', 'res_id', + domain=lambda self: [ + '&', ('model', '=', self._name), ('type', '=', 'comment') + ], + auto_join=True, + string='Website Messages', + help="Website communication history", + ), # technical stuff: history, menu (to keep ?) 'history_ids': fields.one2many( 'blog.post.history', 'post_id', @@ -105,6 +143,10 @@ class BlogPost(osv.Model): self.create_history(cr, uid, ids, vals, context) return result + def img(self, cr, uid, ids, field='image_small', context=None): + post = self.browse(cr, SUPERUSER_ID, ids[0], context=context) + return "/website/image?model=%s&field=%s&id=%s" % ('res.users', field, post.create_uid.id) + class BlogPostHistory(osv.Model): _name = "blog.post.history" @@ -121,7 +163,7 @@ class BlogPostHistory(osv.Model): } def getDiff(self, cr, uid, v1, v2, context=None): - history_pool = self.pool.get('document.page.history') + history_pool = self.pool.get('blog.post.history') text1 = history_pool.read(cr, uid, [v1], ['content'])[0]['content'] text2 = history_pool.read(cr, uid, [v2], ['content'])[0]['content'] line1 = line2 = '' diff --git a/addons/document_page/document_page_data.xml b/addons/website_blog/website_blog_data.xml similarity index 79% rename from addons/document_page/document_page_data.xml rename to addons/website_blog/website_blog_data.xml index b60ab1c8dc4..5883da445c4 100644 --- a/addons/document_page/document_page_data.xml +++ b/addons/website_blog/website_blog_data.xml @@ -3,6 +3,16 @@ + + Website Blogs + self + /blog + + + + open + + News diff --git a/addons/document_page/document_page_demo.xml b/addons/website_blog/website_blog_demo.xml similarity index 100% rename from addons/document_page/document_page_demo.xml rename to addons/website_blog/website_blog_demo.xml diff --git a/addons/website_blog/website_mail_data.xml b/addons/website_blog/website_mail_data.xml deleted file mode 100644 index cb5db2e250d..00000000000 --- a/addons/website_blog/website_mail_data.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Website Blogs - self - /blog - - - - open - - - - diff --git a/addons/document_page/wizard/__init__.py b/addons/website_blog/wizard/__init__.py similarity index 100% rename from addons/document_page/wizard/__init__.py rename to addons/website_blog/wizard/__init__.py diff --git a/addons/document_page/wizard/document_page_create_menu.py b/addons/website_blog/wizard/document_page_create_menu.py similarity index 100% rename from addons/document_page/wizard/document_page_create_menu.py rename to addons/website_blog/wizard/document_page_create_menu.py diff --git a/addons/document_page/wizard/document_page_create_menu_view.xml b/addons/website_blog/wizard/document_page_create_menu_view.xml similarity index 100% rename from addons/document_page/wizard/document_page_create_menu_view.xml rename to addons/website_blog/wizard/document_page_create_menu_view.xml diff --git a/addons/document_page/wizard/document_page_show_diff.py b/addons/website_blog/wizard/document_page_show_diff.py similarity index 100% rename from addons/document_page/wizard/document_page_show_diff.py rename to addons/website_blog/wizard/document_page_show_diff.py diff --git a/addons/document_page/wizard/document_page_show_diff_view.xml b/addons/website_blog/wizard/document_page_show_diff_view.xml similarity index 100% rename from addons/document_page/wizard/document_page_show_diff_view.xml rename to addons/website_blog/wizard/document_page_show_diff_view.xml From 0ae0ebcdf6d97d59328e6ef3cd7160f738e692e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2013 16:29:34 +0200 Subject: [PATCH 05/27] [DOC] website_blog: added skeleton for doc, and added changelog with initial create mention of the module. bzr revid: tde@openerp.com-20130920142934-ak0tvgdlti1z6oq1 --- addons/website_blog/doc/changelog.rst | 9 +++++++++ addons/website_blog/doc/index.rst | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 addons/website_blog/doc/changelog.rst create mode 100644 addons/website_blog/doc/index.rst diff --git a/addons/website_blog/doc/changelog.rst b/addons/website_blog/doc/changelog.rst new file mode 100644 index 00000000000..8b6131b5806 --- /dev/null +++ b/addons/website_blog/doc/changelog.rst @@ -0,0 +1,9 @@ +.. _changelog: + +Changelog +========= + +`trunk (saas-3)` +---------------- + + - created ``website_blog`` menu, build on defunct document_page module. diff --git a/addons/website_blog/doc/index.rst b/addons/website_blog/doc/index.rst new file mode 100644 index 00000000000..953748fd48d --- /dev/null +++ b/addons/website_blog/doc/index.rst @@ -0,0 +1,10 @@ +Blog Module documentation topics +'''''''''''''''''''''''''''''''' + +Changelog +''''''''' + +.. toctree:: + :maxdepth: 1 + + changelog.rst From 9ce9bbc13866f4363ea204c9fcd55e9fde45c44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 20 Sep 2013 17:38:23 +0200 Subject: [PATCH 06/27] [FIX] website_blog: quite fixed demo data bzr revid: tde@openerp.com-20130920153823-36rhrr8wcyncw0wn --- addons/website_blog/website_blog_demo.xml | 147 ++++++++++------------ 1 file changed, 65 insertions(+), 82 deletions(-) diff --git a/addons/website_blog/website_blog_demo.xml b/addons/website_blog/website_blog_demo.xml index de4ac4f87cc..b9fa3b893f5 100644 --- a/addons/website_blog/website_blog_demo.xml +++ b/addons/website_blog/website_blog_demo.xml @@ -17,27 +17,23 @@ - -
    -The news is out, OpenERP's latest version 6.1. is here. It's more
    -user-friendly, even more business oriented and efficient to manage your company
    -
    -How to discover the latest version 6.1.?
    -
    -Demo :
    -Online:
    -Download:
    -
    -We have also put together a functional demo that presents 6.1. Watch this video
    -to learn directly from us what OpenERP 6.1. can do for you. Share it in your
    -company, with your clients and implement it now for your business.
    -
    -

    Watch on Youtube!


    -
    -
    -
    -
    +The news is out, OpenERP's latest version 7.0 is here. It's more +user-friendly, even more business oriented and efficient to manage your company.

    +

    How to discover the latest version 6.1.?

    + +

    We have also put together a functional demo that presents 6.1. Watch this video +to learn directly from us what OpenERP 6.1. can do for you. Share it in your +company, with your clients and implement it now for your business.

    +

    Watch on Youtube!

    + ]]>
    @@ -47,38 +43,27 @@ company, with your clients and implement it now for your business.
    -You like OpenERP, but feel like you want to personalise it more? Now, OpenERP
    -goes a step further and lets you customize your dashboard. Thanks to a new
    -feature that allows you to customize your dashboard by adding new boards of any
    -search view.
    -
    -

    How is it done?


    -
    -Step 1: access one search view
    -
    -Step 2: apply the filter you want to see at each connection to the application
    -(eg. on sales, manufacturing, etc)
    -
    -Step 3: add it into the dashboard in the same space where you can save the filter
    -
    -Step 4: choose the application you want it visible on and the name of the array
    -
    -Look at this simple example below from Purchase, where I want to put on the
    -application's dashboard "Purchases to Approve". After I access the search view
    -and apply the filter for "Purchases to Approve", I can add it immediately to my
    -Purchase dashboard.
    -
    -
    -
    -In less than a minute, the search view is visible on the dashboard
    -
    -
    -
    -Of course, you are free to delete what you don't need or like, but just in case
    -you change your mind there is a reset button to return to the default view.
    -
    -
    +

    You like OpenERP, but feel like you want to personalise it more? Now, OpenERP +goes a step further and lets you customize your dashboard. Thanks to a new +feature that allows you to customize your dashboard by adding new boards of any +search view.

    +

    How is it done?

    +
      +
    • Step 1: access one search view
    • +
    • Step 2: apply the filter you want to see at each connection to the application +(eg. on sales, manufacturing, etc)
    • +
    • Step 3: add it into the dashboard in the same space where you can save the filter
    • +
    • Step 4: choose the application you want it visible on and the name of the array
    • +
    +

    Look at this simple example below from Purchase, where I want to put on the +application's dashboard "Purchases to Approve". After I access the search view +and apply the filter for "Purchases to Approve", I can add it immediately to my +Purchase dashboard.

    + +

    In less than a minute, the search view is visible on the dashboard

    + +

    Of course, you are free to delete what you don't need or like, but just in case
    +you change your mind there is a reset button to return to the default view.

    ]]>
    @@ -88,35 +73,33 @@ you change your mind there is a reset button to return to the default view.
    - -The brand new OpenERP touchscreen point of sale available with 6.1 allows you
    -to manage your shop sales very easily. It's fully web based so that you don't
    -have to install or deploy any software and all the sales shops can be easily
    -consolidated. It works in connected and disconnected modes so that you can
    -continue to sell if you lose your internet connection.
    -
    -
    -
    -

    Here's a summary of its main features and benefits:


    -
    -100% WEB based
    -
    -
    • available for any touchscreen device (ipod, ipad, any tablet)mobile (with portable devices)
    • no installation required
    • no synchronization needed, completely integrated
    • continue working even when your connection is down if you close your browser, data won't be lost
    • fully web based with a clean interface smart interface

    -
    -You have different options to select your products. You can do it through the
    -barcode reader, just browse through the categories you have put in place (ie.
    -drinks, snacks, meals, etc.), or text search in case neither of the other
    -options work for you. If you need to use the POS for your restaurant, for
    -example, your employees can record at the same time multiple tickets without
    -having to wait to do one transaction at a time. Along, to facilitate payment,
    -the application allows multiple payment methods.
    -
    -The POS application is so simple and accessible to use that your shop or
    -restaurant will never need any other tool to manage orders. Due to its smart
    -and user-friendly interface you don't need any training to learn how to use it.
    -Think of it as an out-of-the-box solution to boost your business' productivity.
    -
    +The brand new OpenERP touchscreen point of sale available with 6.1 allows you +to manage your shop sales very easily. It's fully web based so that you don't +have to install or deploy any software and all the sales shops can be easily +consolidated. It works in connected and disconnected modes so that you can +continue to sell if you lose your internet connection.

    + +

    Here's a summary of its main features and benefits:

    +
      +
    • 100% WEB based
    • +
    • available for any touchscreen device (ipod, ipad, any tablet)mobile (with portable devices)
    • +
    • no installation required
    • +
    • no synchronization needed, completely integrated
    • +
    • continue working even when your connection is down if you close your browser, data won't be lost
    • +
    • fully web based with a clean interface smart interface
    • +
    +

    You have different options to select your products. You can do it through the +barcode reader, just browse through the categories you have put in place (ie. +drinks, snacks, meals, etc.), or text search in case neither of the other +options work for you. If you need to use the POS for your restaurant, for +example, your employees can record at the same time multiple tickets without +having to wait to do one transaction at a time. Along, to facilitate payment, +the application allows multiple payment methods.

    +

    The POS application is so simple and accessible to use that your shop or +restaurant will never need any other tool to manage orders. Due to its smart +and user-friendly interface you don't need any training to learn how to use it. +Think of it as an out-of-the-box solution to boost your business' productivity. +

    ]]>
    From b34f746c36586b5f1a986e36d721513f95b88108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 23 Sep 2013 11:59:09 +0200 Subject: [PATCH 07/27] [ADD] website_mail: added templates, js and css to have a generic follow button. Based on the same principle as publish, there is now a generic button to follow or unfollow objects in openerp. This should replace all custom instance of subscription in other addons. bzr revid: tde@openerp.com-20130923095909-4p5aiswlwy14g32k --- addons/website_mail/__init__.py | 1 + addons/website_mail/__openerp__.py | 17 ++++-- addons/website_mail/controllers/__init__.py | 1 + addons/website_mail/controllers/main.py | 58 +++++++++++++++++++ addons/website_mail/static/src/css/Makefile | 2 + .../static/src/css/website_mail.css | 40 +++++++++++++ .../static/src/css/website_mail.sass | 33 +++++++++++ .../static/src/js/website_mail.js | 27 +++++++++ addons/website_mail/views/website_mail.xml | 22 +++++++ 9 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 addons/website_mail/controllers/__init__.py create mode 100644 addons/website_mail/controllers/main.py create mode 100644 addons/website_mail/static/src/css/Makefile create mode 100644 addons/website_mail/static/src/css/website_mail.css create mode 100644 addons/website_mail/static/src/css/website_mail.sass create mode 100644 addons/website_mail/static/src/js/website_mail.js create mode 100644 addons/website_mail/views/website_mail.xml diff --git a/addons/website_mail/__init__.py b/addons/website_mail/__init__.py index f452f9f142e..4eb031ad44b 100644 --- a/addons/website_mail/__init__.py +++ b/addons/website_mail/__init__.py @@ -19,4 +19,5 @@ # ############################################################################## +import controllers import mail_message diff --git a/addons/website_mail/__openerp__.py b/addons/website_mail/__openerp__.py index df01cb69ca1..bf4620d7a8c 100644 --- a/addons/website_mail/__openerp__.py +++ b/addons/website_mail/__openerp__.py @@ -24,12 +24,21 @@ 'category': 'Website', 'summary': 'Glue Module', 'version': '0.1', - 'description': """Glue module holding mail improvements for website. - """, + 'description': """Glue module holding mail improvements for website.""", 'author': 'OpenERP SA', 'depends': ['website', 'mail'], - 'data': [], - 'qweb': [], + 'data': [ + 'views/website_mail.xml', + ], + 'css': [ + 'static/src/css/website_mail.css', + ], + 'js': [ + 'static/src/js/website_mail.js', + ], + 'qweb': [ + 'static/src/xml/website_mail.xml' + ], 'installable': True, 'auto_install': True, } diff --git a/addons/website_mail/controllers/__init__.py b/addons/website_mail/controllers/__init__.py new file mode 100644 index 00000000000..8ee9bae18d9 --- /dev/null +++ b/addons/website_mail/controllers/__init__.py @@ -0,0 +1 @@ +import main diff --git a/addons/website_mail/controllers/main.py b/addons/website_mail/controllers/main.py new file mode 100644 index 00000000000..f1b91ed22a2 --- /dev/null +++ b/addons/website_mail/controllers/main.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2013-Today OpenERP SA (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import SUPERUSER_ID +from openerp.addons.web import http +from openerp.addons.web.http import request +from openerp.addons.website import website + + +class WebsiteMail(http.Controller): + + def _find_or_create_partner(self, email, context=None): + # TDE TODO: FIXME: use mail_thread method + partner_obj = request.registry['res.partner'] + user_obj = request.registry['res.users'] + partner_ids = [] + if request.context['is_public_user'] and email: + partner_ids = partner_obj.search(request.cr, SUPERUSER_ID, [("email", "=", email)], context=request.context) + if not partner_ids: + partner_ids = [partner_obj.create(request.cr, SUPERUSER_ID, {"email": email, "name": email}, request.context)] + else: + partner_ids = [user_obj.browse(request.cr, request.uid, request.uid, request.context).partner_id.id] + return partner_ids + + @website.route(['/website_mail/follow/'], type='http', auth="public") + def website_message_subscribe(self, **post): + _id = int(post['id']) + _message_is_follower = post['message_is_follower'] == 'on' + _object = request.registry[post['object']] + partner_ids = self._find_or_create_partner(post.get('email'), request.context) + + if _message_is_follower: + _object.check_access_rule(request.cr, request.uid, [_id], 'read', request.context) + _object.message_unsubscribe(request.cr, SUPERUSER_ID, [_id], partner_ids, context=request.context) + else: + _object.check_access_rule(request.cr, request.uid, [_id], 'read', request.context) + _object.message_subscribe(request.cr, SUPERUSER_ID, [_id], partner_ids, context=request.context) + obj = _object.browse(request.cr, request.uid, _id) + + return obj.message_is_follower and "1" or "0" diff --git a/addons/website_mail/static/src/css/Makefile b/addons/website_mail/static/src/css/Makefile new file mode 100644 index 00000000000..d7c1ea77439 --- /dev/null +++ b/addons/website_mail/static/src/css/Makefile @@ -0,0 +1,2 @@ +sass: + sass -t expanded --unix-newlines --watch website_mail.sass:website_mail.css& diff --git a/addons/website_mail/static/src/css/website_mail.css b/addons/website_mail/static/src/css/website_mail.css new file mode 100644 index 00000000000..a93199a2ddf --- /dev/null +++ b/addons/website_mail/static/src/css/website_mail.css @@ -0,0 +1,40 @@ +/* ---- FOLLOW ---- */ +a[data-follow] { + text-decoration: none !important; + z-index: 2; +} +a[data-follow] .label { + padding: 5px 8px; +} +a[data-follow] .css_unfollow, a[data-follow] .css_follow, a[data-follow] .css_unfollowed, a[data-follow] .css_followed { + display: none; +} +a[data-follow][data-follow='off'] .css_unfollowed, a[data-follow][data-follow='off']:hover .css_follow { + display: inline; +} +a[data-follow][data-follow='off']:hover .css_unfollowed { + display: none; +} +a[data-follow][data-follow='on'] .css_followed, a[data-follow][data-follow='on']:hover .css_unfollow { + display: inline; +} +a[data-follow][data-follow='on']:hover .css_followed { + display: none; +} + +[data-follow='off']:not(a) > :not([data-follow]) { + opacity: 0.5; +} + +[data-follow]:not(a) { + position: relative; + overflow: visible; + /*&:hover > [data-follow] */ + /* display: block */ +} +[data-follow]:not(a) > [data-follow] { + position: absolute; + right: -6px; + top: -10px; + display: none; +} diff --git a/addons/website_mail/static/src/css/website_mail.sass b/addons/website_mail/static/src/css/website_mail.sass new file mode 100644 index 00000000000..b648270ec04 --- /dev/null +++ b/addons/website_mail/static/src/css/website_mail.sass @@ -0,0 +1,33 @@ + +/* ---- FOLLOW ---- */ +a[data-follow] + text-decoration: none !important + z-index: 2 + .label + padding: 5px 8px + .css_unfollow, .css_follow, .css_unfollowed, .css_followed + display: none + &[data-follow='off'] + .css_unfollowed, &:hover .css_follow + display: inline + &:hover .css_unfollowed + display: none + &[data-follow='on'] + .css_followed, &:hover .css_unfollow + display: inline + &:hover .css_followed + display: none + +[data-follow='off']:not(a) + >:not([data-follow]) + opacity: 0.5 +[data-follow]:not(a) + position: relative + overflow: visible + >[data-follow] + position: absolute + right: -6px + top: -10px + display: none + /*&:hover > [data-follow]*/ + /* display: block*/ diff --git a/addons/website_mail/static/src/js/website_mail.js b/addons/website_mail/static/src/js/website_mail.js new file mode 100644 index 00000000000..e40715c30fc --- /dev/null +++ b/addons/website_mail/static/src/js/website_mail.js @@ -0,0 +1,27 @@ +$(document).ready(function () { + + /* ----- FOLLOWING STUFF ---- */ + $('[data-follow]:has([data-follow])').each(function () { + var $pub = $("[data-follow]", this); + if($pub.size()) + $(this).attr("data-follow", $pub.attr("data-follow")); + else + $(this).removeAttr("data-follow"); + }); + + $(document).on('click', '.js_follow', function (ev) { + console.log(ev); + ev.preventDefault(); + var $data = $(":first", this).parents("[data-follow]"); + var message_is_follower = $data.first().attr("data-follow"); + $data.attr("data-follow", message_is_follower == 'off' ? 'on' : 'off'); + $.post('/website_mail/follow', { + 'id': $(this).data('id'), + 'object': $(this).data('object'), + 'message_is_follower': message_is_follower, + }, function (result) { + $data.attr("data-follow", + result ? 'on' : 'off'); + }); + }); + +}); diff --git a/addons/website_mail/views/website_mail.xml b/addons/website_mail/views/website_mail.xml new file mode 100644 index 00000000000..7a55352f07b --- /dev/null +++ b/addons/website_mail/views/website_mail.xml @@ -0,0 +1,22 @@ + + + + + + + + + + From 8c89bfda88fc33ebcc85c13352417688dd88e752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 23 Sep 2013 12:17:30 +0200 Subject: [PATCH 08/27] [IMP] website_blog: Some file renaming Delegated followers of categories / blog posts management to website_mail, allowing to remove some templates and controllers Various cleanings and improvements in blog templates bzr revid: tde@openerp.com-20130923101730-b9606qcyd3sj2pwx --- addons/website_blog/__openerp__.py | 7 +- addons/website_blog/controllers/main.py | 61 ++----------- addons/website_blog/static/src/css/Makefile | 2 +- addons/website_blog/static/src/css/blog.sass | 42 --------- .../src/css/{blog.css => website_blog.css} | 0 .../static/src/css/website_blog.sass | 9 ++ .../src/js/{blog.js => website_blog.js} | 3 +- ...log_views.xml => website_blog_classic.xml} | 0 ...mplates.xml => website_blog_templates.xml} | 90 +++++++------------ addons/website_blog/website_blog.py | 4 +- .../static/src/js/website_mail.js | 1 - 11 files changed, 56 insertions(+), 163 deletions(-) delete mode 100644 addons/website_blog/static/src/css/blog.sass rename addons/website_blog/static/src/css/{blog.css => website_blog.css} (100%) create mode 100644 addons/website_blog/static/src/css/website_blog.sass rename addons/website_blog/static/src/js/{blog.js => website_blog.js} (95%) rename addons/website_blog/views/{website_blog_views.xml => website_blog_classic.xml} (100%) rename addons/website_blog/views/{website_templates.xml => website_blog_templates.xml} (56%) diff --git a/addons/website_blog/__openerp__.py b/addons/website_blog/__openerp__.py index 104b2f7c073..8b38698dc35 100644 --- a/addons/website_blog/__openerp__.py +++ b/addons/website_blog/__openerp__.py @@ -33,8 +33,9 @@ OpenERP Blog 'depends': ['knowledge', 'website_mail'], 'data': [ 'website_blog_data.xml', - 'views/website_blog_views.xml', - 'views/website_templates.xml', + 'website_blog_demo.xml', + 'views/website_blog_classic.xml', + 'views/website_blog_templates.xml', 'views/res_config.xml', # 'wizard/document_page_create_menu_view.xml', 'wizard/document_page_show_diff_view.xml', @@ -42,7 +43,7 @@ OpenERP Blog 'security/website_mail.xml', ], 'demo': [ - 'website_blog_demo.xml' + # 'website_blog_demo.xml' ], 'test': [ 'test/document_page_test00.yml' diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index 564beeaed39..090a4bfba4d 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -59,11 +59,12 @@ class website_mail(http.Controller): blog_post = None blog_posts = None pager = None - if not category_id: - category_ids = category_obj.search(cr, uid, [], context=context) - categories = category_obj.browse(cr, uid, category_ids, context=context) + + category_ids = category_obj.search(cr, uid, [], context=context) + categories = category_obj.browse(cr, uid, category_ids, context=context) + # category but no post chosen: display the last ones, create pager - elif category_id and not blog_post_id: + if category_id and not blog_post_id: pager_begin = (page - 1) * self._category_post_per_page pager_end = page * self._category_post_per_page category = category_obj.browse(cr, uid, category_id, context=context) @@ -129,55 +130,3 @@ class website_mail(http.Controller): 'website_published': False, }, context=create_context) return werkzeug.utils.redirect("/blog/%s/%s/?unable_editor=1" % (category_id, blog_id)) - - def _find_or_create_partner(self, email, context=None): - partner_obj = request.registry['res.partner'] - user_obj = request.registry['res.users'] - partner_ids = [] - if request.context['is_public_user'] and email: - partner_ids = partner_obj.search(request.cr, SUPERUSER_ID, [("email", "=", email)], context=request.context) - if not partner_ids: - partner_ids = [partner_obj.create(request.cr, SUPERUSER_ID, {"email": email, "name": email}, request.context)] - else: - partner_ids = [user_obj.browse(request.cr, request.uid, request.uid, request.context).partner_id.id] - return partner_ids - - @website.route(['/blog//subscribe'], type='http', auth="public") - def category_subscribe(self, category_id=None, **post): - partner_ids = self._find_or_create_partner(post.get('email'), request.context) - category_obj = request.registry['blog.category'] - - category_obj.check_access_rule(request.cr, request.uid, [category_id], 'read', request.context) - category_obj.message_subscribe(request.cr, SUPERUSER_ID, [category_id], partner_ids, context=request.context) - - return self.blog(category_id=category_id) - - @website.route(['/blog//unsubscribe'], type='http', auth="public") - def category_unsubscribe(self, category_id=None, **post): - partner_ids = self._find_or_create_partner(post.get('email'), request.context) - category_obj = request.registry['blog.category'] - - category_obj.check_access_rule(request.cr, request.uid, [category_id], 'read', request.context) - category_obj.message_unsubscribe(request.cr, SUPERUSER_ID, [category_id], partner_ids, context=request.context) - - return self.blog(category_id=category_id) - - @website.route(['/blog///subscribe'], type='http', auth="public") - def blog_post_subscribe(self, category_id=None, blog_post_id=None, **post): - partner_ids = self._find_or_create_partner(post.get('email'), request.context) - blog_post_obj = request.registry['blog.post'] - - blog_post_obj.check_access_rule(request.cr, request.uid, [blog_post_id], 'read', request.context) - blog_post_obj.message_subscribe(request.cr, SUPERUSER_ID, [blog_post_id], partner_ids, context=request.context) - - return self.blog(category_id=category_id, blog_post_id=blog_post_id) - - @website.route(['/blog///unsubscribe'], type='http', auth="public") - def blog_post_unsubscribe(self, category_id=None, blog_post_id=None, **post): - partner_ids = self._find_or_create_partner(post.get('email'), request.context) - blog_post_obj = request.registry['blog.post'] - - blog_post_obj.check_access_rule(request.cr, request.uid, [blog_post_id], 'read', request.context) - blog_post_obj.message_unsubscribe(request.cr, SUPERUSER_ID, [blog_post_id], partner_ids, context=request.context) - - return self.blog(category_id=category_id, blog_post_id=blog_post_id) diff --git a/addons/website_blog/static/src/css/Makefile b/addons/website_blog/static/src/css/Makefile index 5042d6d8f54..f71f4dd7be8 100644 --- a/addons/website_blog/static/src/css/Makefile +++ b/addons/website_blog/static/src/css/Makefile @@ -1,2 +1,2 @@ sass: - sass --compass --trace -t expanded blog.sass blog.css + sass --compass --trace -t expanded website_blog.sass website_blog.css diff --git a/addons/website_blog/static/src/css/blog.sass b/addons/website_blog/static/src/css/blog.sass deleted file mode 100644 index b176996ca80..00000000000 --- a/addons/website_blog/static/src/css/blog.sass +++ /dev/null @@ -1,42 +0,0 @@ -@import "compass/css3" - -.css_website_mail - .has-error - border-color: red - .css_nav_month - display: none - &:first-of-type - display: block - -/* ---- PUBLISH ---- */ -/ a[data-publish] -/ text-decoration: none !important -/ z-index: 2 -/ .label -/ padding: 5px 8px -/ .css_unpublish, .css_publish, .css_unpublished, .css_published -/ display: none -/ &[data-publish='off'] -/ .css_unpublished, &:hover .css_publish -/ display: inline -/ &:hover .css_unpublished -/ display: none -/ &[data-publish='on'] -/ .css_published, &:hover .css_unpublish -/ display: inline -/ &:hover .css_published -/ display: none - -/ [data-publish='off']:not(a) -/ >:not([data-publish]) -/ opacity: 0.5 -/ [data-publish]:not(a) -/ position: relative -/ overflow: visible -/ >[data-publish] -/ position: absolute -/ right: -6px -/ top: -10px -/ display: none - /*&:hover > [data-publish]*/ - /* display: block*/ diff --git a/addons/website_blog/static/src/css/blog.css b/addons/website_blog/static/src/css/website_blog.css similarity index 100% rename from addons/website_blog/static/src/css/blog.css rename to addons/website_blog/static/src/css/website_blog.css diff --git a/addons/website_blog/static/src/css/website_blog.sass b/addons/website_blog/static/src/css/website_blog.sass new file mode 100644 index 00000000000..8a7c5f30a5e --- /dev/null +++ b/addons/website_blog/static/src/css/website_blog.sass @@ -0,0 +1,9 @@ +@import "compass/css3" + +.css_website_mail + .has-error + border-color: red + .css_nav_month + display: none + &:first-of-type + display: block diff --git a/addons/website_blog/static/src/js/blog.js b/addons/website_blog/static/src/js/website_blog.js similarity index 95% rename from addons/website_blog/static/src/js/blog.js rename to addons/website_blog/static/src/js/website_blog.js index 4db3726123a..ed39817ca59 100644 --- a/addons/website_blog/static/src/js/blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -27,9 +27,10 @@ $(document).ready(function () { } }); - $form = $('.js_website_mail form#post'); + $form = $('.js_website_blog form#comment'); $form.submit(function (e) { e.preventDefault(); + console.log(e) var error = $form.find("textarea").val().length < 3; $form.find("textarea").toggleClass("has-error", error); if (!error) { diff --git a/addons/website_blog/views/website_blog_views.xml b/addons/website_blog/views/website_blog_classic.xml similarity index 100% rename from addons/website_blog/views/website_blog_views.xml rename to addons/website_blog/views/website_blog_classic.xml diff --git a/addons/website_blog/views/website_templates.xml b/addons/website_blog/views/website_blog_templates.xml similarity index 56% rename from addons/website_blog/views/website_templates.xml rename to addons/website_blog/views/website_blog_templates.xml index dddf59258f7..c5c2ef0ee62 100644 --- a/addons/website_blog/views/website_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -12,47 +12,29 @@ - - - - - - - + + - - -