Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] cms_delete_content_example #29

Merged
merged 6 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions cms_delete_content_example/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==========================
Cms Delete Content Example
==========================

This is an example for the CMS Delete Content addon.

Usage
=====

Go on the website app of Odoo. Then you can reach the page
/list-delete-content-example. This page show you demo records that you
can safely delete with the delete button.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/website-cms/10.0

.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "10.0" for example

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Simone Orsi <[email protected]>
* Rémy Taymans <[email protected]>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit https://odoo-community.org.
2 changes: 2 additions & 0 deletions cms_delete_content_example/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
21 changes: 21 additions & 0 deletions cms_delete_content_example/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Rémy Taymans
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Cms Delete Content Example',
'summary': """
Basic content to showcase the CMS delete content""",
'version': '10.0.1.0.0',
'license': 'LGPL-3',
'author': 'Rémy Taymans,Odoo Community Association (OCA)',
'depends': [
'website',
'cms_delete_content',
],
'data': [
'data/examples.xml',
'data/ir.model.access.csv',
'templates/example.xml',
],
}
1 change: 1 addition & 0 deletions cms_delete_content_example/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
15 changes: 15 additions & 0 deletions cms_delete_content_example/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Rémy Taymans
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import http


class ExampleModelDeleteControler(http.Controller):

@http.route(['/list-delete-content-example'],
type='http', auth='user', website=True)
def list_delete_content_example(self, **kw):
model = http.request.env['cms.delete.content.example']
return http.request.render('cms_delete_content_example.list_examples',
{'examples': model.search([])})
44 changes: 44 additions & 0 deletions cms_delete_content_example/data/examples.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="example1" model="cms.delete.content.example">
<field name="name">Record 1</field>
</record>

<record id="example2" model="cms.delete.content.example">
<field name="name">Record 2</field>
</record>

<record id="example3" model="cms.delete.content.example">
<field name="name">Record 3</field>
</record>

<record id="example4" model="cms.delete.content.example">
<field name="name">Record 4</field>
</record>

<record id="example5" model="cms.delete.content.example">
<field name="name">Record 5</field>
</record>

<record id="example6" model="cms.delete.content.example">
<field name="name">Record 6</field>
</record>

<record id="example7" model="cms.delete.content.example">
<field name="name">Record 7</field>
</record>

<record id="example8" model="cms.delete.content.example">
<field name="name">Record 8</field>
</record>

<record id="example9" model="cms.delete.content.example">
<field name="name">Record 9</field>
</record>

<record id="example10" model="cms.delete.content.example">
<field name="name">Record 10</field>
</record>

</odoo>
2 changes: 2 additions & 0 deletions cms_delete_content_example/data/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_cms_delete_content_example,access_cms_delete_content_example,model_cms_delete_content_example,,1,1,1,1
1 change: 1 addition & 0 deletions cms_delete_content_example/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import example
18 changes: 18 additions & 0 deletions cms_delete_content_example/models/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# # Copyright 2017 Rémy Taymans
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields


class ExampleModel(models.Model):
"""A test model"""

_name = "cms.delete.content.example"
_inherit = "website.published.mixin"

name = fields.Char(required=True)

@property
def cms_after_delete_url(self):
return '/list-delete-content-example'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions cms_delete_content_example/templates/example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<template id="list_examples" name="CMS Detele Content Example">

<t t-call="website.layout">
<div class="container">

<h1>List of examples</h1>
<p>Click on the delete button to remove an item.</p>

<ul>
<li t-foreach="examples" t-as="example">
<span t-field="example.name"/> <a class="btn btn-danger cms_delete_confirm" t-att-href="example.cms_delete_confirm_url">Delete</a>
</li>
</ul>

</div>
</t>

</template>

</odoo>