diff --git a/website_blog_usability/README.rst b/website_blog_usability/README.rst new file mode 100644 index 0000000000..3396a82a52 --- /dev/null +++ b/website_blog_usability/README.rst @@ -0,0 +1,208 @@ +====================== +Website Blog Usability +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:863399cec8d53e8afdeafd67a209002a74279b7a7a9904cf1e179818ea842b8b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/18.0/website_blog_usability + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_blog_usability + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module enhances the blog management capabilities in Odoo by adding +professional features for better content management. + +Features +-------- + +- **Visits Display**: Show visit counts in list, form, and kanban views +- **Backend Form Access**: Quick access button (gear icon) in list view + to open post form in backend +- **Professional Editing**: Content tab with HTML editor supporting + code view toggle +- **Enhanced Views**: Improved form, tree, and kanban views with visit + information +- **Search Filters**: Filter posts with no visits + +Usage +----- + +After installing this module: + +1. Navigate to **Website > Content > Blog Posts** +2. View visit counts in the list view (visits column) +3. Click the gear icon button next to a post name to open it in backend + form view +4. Use the enhanced form view to edit posts with HTML/code toggle in the + Content tab +5. Filter posts with no visits using the search filter +6. View visit counts in kanban cards + +Technical Details +----------------- + +- Extends blog.post model with method action_open_backend_form() to + open backend form view +- Inherits and enhances existing views from \`website_blog\`: + + - Form view: Adds statistics section with visits and Content tab + with HTML editor + - Tree view: Adds visits column, post_date column, and backend form + button + - Search view: Adds "No Visits" filter + - Kanban view: Displays visit count in cards + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To use this module, you need to: + +1. Install the module from Apps menu +2. Go to **Website > Content > Blog Posts** +3. The module automatically enhances the blog post views with: + + - Visit counts displayed in list, form, and kanban views + - Backend form access button (gear icon) in list view + - Statistics section in form view showing visit count + - Content editing tab with HTML/code toggle capability + - Search filter for posts with no visits + +4. Create or edit a blog post to see the enhanced features: + + - In the form view, you'll see a new "Statistics" section with visit + information + - A new "Content" tab in the notebook allows editing with HTML/code + toggle + - In the list view, visit counts are displayed and you can click the + gear icon to open backend form + - Use search filter "No Visits" to find posts that haven't been + visited yet + +5. The visit counts are automatically tracked when visitors view blog + posts on the website + +Note: Visit counts are incremented automatically by the website_blog +module when posts are viewed. This module only enhances the display and +management of this information. + +Usage +===== + +Usage Guide +----------- + +Viewing Visit Statistics +------------------------ + +After installing the module, visit counts are automatically displayed: + +- **List View**: The visits column shows the total number of views for + each post +- **Form View**: A new "Statistics" section displays: + + - Total visits (editable) + - Creation and last update dates + +- **Kanban View**: Visit count is displayed in each card with an eye + icon + +Accessing Backend Form +---------------------- + +In the list view, each post has a gear icon button next to its name: + +- Click the gear icon to open the post form view in the backend +- This allows quick access to edit posts without navigating to the + website +- The button opens the form view in the current window + +Filtering Posts +--------------- + +Use the search filters to find posts: + +- **No Visits**: Shows posts that haven't been visited yet (visits = 0) + +Editing Content +--------------- + +The module adds a "Content" tab in the blog post form view: + +- Edit blog post content with HTML visual editor +- Toggle to code view for direct HTML editing +- The editor supports syntax highlighting for HTML +- Use the ACE editor options to switch between visual and code modes + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Escodoo + +Contributors +------------ + +- `Escodoo `__: + + - Marcel Savegnago + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-marcelsavegnago| image:: https://github.com/marcelsavegnago.png?size=40px + :target: https://github.com/marcelsavegnago + :alt: marcelsavegnago + +Current `maintainer `__: + +|maintainer-marcelsavegnago| + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_blog_usability/__init__.py b/website_blog_usability/__init__.py new file mode 100644 index 0000000000..f6de863519 --- /dev/null +++ b/website_blog_usability/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2026 - TODAY, Escodoo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/website_blog_usability/__manifest__.py b/website_blog_usability/__manifest__.py new file mode 100644 index 0000000000..8135ca7a3f --- /dev/null +++ b/website_blog_usability/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2026 - TODAY, Escodoo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Website Blog Usability", + "summary": "Enhanced blog management with visits display, backend form " + "access, and HTML/code editing", + "version": "18.0.1.0.0", + "author": "Escodoo, Odoo Community Association (OCA)", + "maintainers": ["marcelsavegnago"], + "license": "AGPL-3", + "category": "Website", + "website": "https://github.com/OCA/website", + "depends": [ + "website_blog", + ], + "data": [ + "views/blog_post_views.xml", + ], + "installable": True, + "application": False, +} diff --git a/website_blog_usability/models/__init__.py b/website_blog_usability/models/__init__.py new file mode 100644 index 0000000000..d4c6e9012d --- /dev/null +++ b/website_blog_usability/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2026 - TODAY, Escodoo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import blog_post diff --git a/website_blog_usability/models/blog_post.py b/website_blog_usability/models/blog_post.py new file mode 100644 index 0000000000..7540ada41f --- /dev/null +++ b/website_blog_usability/models/blog_post.py @@ -0,0 +1,19 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class BlogPost(models.Model): + _inherit = "blog.post" + + def action_open_backend_form(self): + """Open the blog post form view in backend.""" + self.ensure_one() + return { + "type": "ir.actions.act_window", + "res_model": "blog.post", + "res_id": self.id, + "view_mode": "form", + "target": "current", + } diff --git a/website_blog_usability/pyproject.toml b/website_blog_usability/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_blog_usability/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_blog_usability/readme/CONFIGURE.md b/website_blog_usability/readme/CONFIGURE.md new file mode 100644 index 0000000000..6f70a38992 --- /dev/null +++ b/website_blog_usability/readme/CONFIGURE.md @@ -0,0 +1,25 @@ +To use this module, you need to: + +1. Install the module from Apps menu +2. Go to **Website \> Content \> Blog Posts** +3. The module automatically enhances the blog post views with: + - Visit counts displayed in list, form, and kanban views + - Backend form access button (gear icon) in list view + - Statistics section in form view showing visit count + - Content editing tab with HTML/code toggle capability + - Search filter for posts with no visits +4. Create or edit a blog post to see the enhanced features: + - In the form view, you'll see a new "Statistics" section with visit + information + - A new "Content" tab in the notebook allows editing with HTML/code + toggle + - In the list view, visit counts are displayed and you can click the + gear icon to open backend form + - Use search filter "No Visits" to find posts that haven't been + visited yet +5. The visit counts are automatically tracked when visitors view blog + posts on the website + +Note: Visit counts are incremented automatically by the website_blog +module when posts are viewed. This module only enhances the display and +management of this information. diff --git a/website_blog_usability/readme/CONTRIBUTORS.md b/website_blog_usability/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..e172ccafc0 --- /dev/null +++ b/website_blog_usability/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Escodoo](https://www.escodoo.com.br): + - Marcel Savegnago \<\> diff --git a/website_blog_usability/readme/DESCRIPTION.md b/website_blog_usability/readme/DESCRIPTION.md new file mode 100644 index 0000000000..5ab66de5c2 --- /dev/null +++ b/website_blog_usability/readme/DESCRIPTION.md @@ -0,0 +1,38 @@ +This module enhances the blog management capabilities in Odoo by adding +professional features for better content management. + +## Features + +- **Visits Display**: Show visit counts in list, form, and kanban views +- **Backend Form Access**: Quick access button (gear icon) in list view + to open post form in backend +- **Professional Editing**: Content tab with HTML editor supporting code + view toggle +- **Enhanced Views**: Improved form, tree, and kanban views with visit + information +- **Search Filters**: Filter posts with no visits + +## Usage + +After installing this module: + +1. Navigate to **Website \> Content \> Blog Posts** +2. View visit counts in the list view (visits column) +3. Click the gear icon button next to a post name to open it in backend + form view +4. Use the enhanced form view to edit posts with HTML/code toggle in + the Content tab +5. Filter posts with no visits using the search filter +6. View visit counts in kanban cards + +## Technical Details + +- Extends blog.post model with method action_open_backend_form() to open + backend form view +- Inherits and enhances existing views from \`website_blog\`: + - Form view: Adds statistics section with visits and Content tab with + HTML editor + - Tree view: Adds visits column, post_date column, and backend form + button + - Search view: Adds "No Visits" filter + - Kanban view: Displays visit count in cards diff --git a/website_blog_usability/readme/USAGE.md b/website_blog_usability/readme/USAGE.md new file mode 100644 index 0000000000..4546811863 --- /dev/null +++ b/website_blog_usability/readme/USAGE.md @@ -0,0 +1,37 @@ +## Usage Guide + +## Viewing Visit Statistics + +After installing the module, visit counts are automatically displayed: + +- **List View**: The visits column shows the total number of views for + each post +- **Form View**: A new "Statistics" section displays: + - Total visits (editable) + - Creation and last update dates +- **Kanban View**: Visit count is displayed in each card with an eye + icon + +## Accessing Backend Form + +In the list view, each post has a gear icon button next to its name: + +- Click the gear icon to open the post form view in the backend +- This allows quick access to edit posts without navigating to the + website +- The button opens the form view in the current window + +## Filtering Posts + +Use the search filters to find posts: + +- **No Visits**: Shows posts that haven't been visited yet (visits = 0) + +## Editing Content + +The module adds a "Content" tab in the blog post form view: + +- Edit blog post content with HTML visual editor +- Toggle to code view for direct HTML editing +- The editor supports syntax highlighting for HTML +- Use the ACE editor options to switch between visual and code modes diff --git a/website_blog_usability/static/description/icon.png b/website_blog_usability/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_blog_usability/static/description/icon.png differ diff --git a/website_blog_usability/static/description/index.html b/website_blog_usability/static/description/index.html new file mode 100644 index 0000000000..a40e70fffc --- /dev/null +++ b/website_blog_usability/static/description/index.html @@ -0,0 +1,27 @@ + + + + + Website Blog Usability + + +
+
+

Website Blog Usability

+

Enhanced blog management with professional features

+
+

+ This module enhances the blog management capabilities by adding: +

+
    +
  • Visit counts display in list, form, and kanban views
  • +
  • Backend form access button (gear icon) for quick editing
  • +
  • Content editing tab with HTML/code toggle
  • +
  • Statistics section in form view
  • +
  • Search filters for posts with no visits
  • +
+
+
+
+ + diff --git a/website_blog_usability/tests/__init__.py b/website_blog_usability/tests/__init__.py new file mode 100644 index 0000000000..10eea7c484 --- /dev/null +++ b/website_blog_usability/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_blog_post_usability diff --git a/website_blog_usability/tests/test_blog_post_usability.py b/website_blog_usability/tests/test_blog_post_usability.py new file mode 100644 index 0000000000..21fb127f12 --- /dev/null +++ b/website_blog_usability/tests/test_blog_post_usability.py @@ -0,0 +1,59 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestBlogPostUsability(TransactionCase): + def setUp(self): + super().setUp() + # Create a blog + self.blog = self.env["blog.blog"].create({"name": "Test Blog"}) + # Create a user with blog manager rights + group_internal_user = self.env.ref("base.group_user") + group_blog_manager = self.env.ref("website.group_website_designer") + self.user_blogmanager = ( + self.env["res.users"] + .with_context(no_reset_password=True) + .create( + { + "name": "Blog Manager", + "login": "blog_manager", + "email": "blog.manager@example.com", + "groups_id": [ + (6, 0, [group_internal_user.id, group_blog_manager.id]) + ], + } + ) + ) + # Create a test blog post + self.blog_post = ( + self.env["blog.post"] + .with_user(self.user_blogmanager) + .with_context(mail_create_nolog=True) + .create( + { + "name": "Test Blog Post", + "blog_id": self.blog.id, + "content": "

Test content

", + } + ) + ) + + def test_action_open_backend_form(self): + """Test that action_open_backend_form returns correct action.""" + # Test with single record (ensure_one is called) + action = self.blog_post.action_open_backend_form() + self.assertIsNotNone(action) + self.assertEqual(action["type"], "ir.actions.act_window") + self.assertEqual(action["res_model"], "blog.post") + self.assertEqual(action["res_id"], self.blog_post.id) + self.assertEqual(action["view_mode"], "form") + self.assertEqual(action["target"], "current") + + def test_visits_field_display(self): + """Test that visits field is accessible and editable.""" + self.assertEqual(self.blog_post.visits, 0) + # Update visits + self.blog_post.visits = 10 + self.assertEqual(self.blog_post.visits, 10) diff --git a/website_blog_usability/views/blog_post_views.xml b/website_blog_usability/views/blog_post_views.xml new file mode 100644 index 0000000000..cf6fb6ccac --- /dev/null +++ b/website_blog_usability/views/blog_post_views.xml @@ -0,0 +1,124 @@ + + + + + + blog.post.form.usability + blog.post + + + + + + + + + + + + + + + + + + + + + + + integer + 0 + + + + + + + blog.post.list.usability + blog.post + + + + + + + + + + + + + + +