Skip to content

Commit

Permalink
Merge 49ab4f6 into e55862b
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo committed Jun 2, 2016
2 parents e55862b + 49ab4f6 commit dbb9e6f
Show file tree
Hide file tree
Showing 12 changed files with 265 additions and 0 deletions.
88 changes: 88 additions & 0 deletions website_event_multi_image/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.. 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

==================================
Multi images for events in website
==================================

This module extends the functionality of website events to support having a
thumbnail in events list and an image gallery per event displayed as a carousel
at the bottom of the page, and allows you to choose which of those
customizations you want applied.

Installation
============

To install this module, you need to:

* Install `OCA/server-tools <https://github.com/OCA/server-tools/>`_.

Configuration
=============

To disable the thumbnail in the events list, you need to:

#. Log in.
#. Go to `the events list </event>`_.
#. Uncheck *Customize > Event thumbnail in list*.

To choose the placement of the carousel gallery in events, you need to:

#. Log in.
#. Go to `the events list </event>`_.
#. Enter any event.
#. Check any of *Customize > ...*
- *Carousel gallery at top*.
- *Carousel gallery at bottom*.
- *Carousel gallery at right*.

Usage
=====

To use this module, you need to:

#. Go to event management backend.
#. Add any number of images to any event.
#. Publish it.
#. Go to its website page and scroll to the bottom to see the carousel gallery.

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

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/event/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
event/issues/new?body=module:%20
website_event_multi_image%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

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

* Rafael Blasco <rafael.blasco@tecnativa.com>
* Jairo Llopis <jairo.llopis@tecnativa.com>

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.
5 changes: 5 additions & 0 deletions website_event_multi_image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
30 changes: 30 additions & 0 deletions website_event_multi_image/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Multi images for events in website",
"summary": "Show a gallery of images per event in their website",
"version": "8.0.1.0.0",
"category": "Event Management",
"website": "http://www.tecnativa.com",
"author": "Antiun Ingeniería S.L., "
"Tecnativa, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"event_multi_image",
"website_event",
"website_multi_image",
],
"data": [
"security/ir_rule.yml",
"security/ir.model.access.csv",
"views/event_templates.xml",
],
"images": [
"images/carousel.png",
"images/thumbnail.png",
],
}
29 changes: 29 additions & 0 deletions website_event_multi_image/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_multi_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-04 17:25+0000\n"
"PO-Revision-Date: 2016-02-04 18:26+0100\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: es\n"
"X-Generator: Poedit 1.8.5\n"

#. module: event_multi_image
#: model:ir.model,name:event_multi_image.model_event_event
msgid "Event"
msgstr "Evento"

#. module: event_multi_image
#: view:event.event:event_multi_image.view_event_form
#: field:event.event,image_ids:0
msgid "Images"
msgstr "Imágenes"
Binary file added website_event_multi_image/images/carousel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website_event_multi_image/images/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions website_event_multi_image/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import image
25 changes: 25 additions & 0 deletions website_event_multi_image/models/image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, fields, models


class MultiImage(models.Model):
_inherit = "base_multi_image.image"

event_published = fields.Boolean(
compute="_compute_event_published",
store=True,
)

@api.multi
@api.depends("owner_model", "owner_id")
def _compute_event_published(self):
"""Know if this image is from a published event."""
for s in self:
if s.owner_model == "event.event":
s.event_published = (self.env[s.owner_model].sudo()
.browse(s.owner_id).published)
else:
s.event_published = False
2 changes: 2 additions & 0 deletions website_event_multi_image/security/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
public_image_access,Allow public to read published event images,base_multi_image.model_base_multi_image_image,base.group_public,1,0,0,0
10 changes: 10 additions & 0 deletions website_event_multi_image/security/ir_rule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

- !record {model: ir.rule, id: public_image_rule}:
name: Public only sees images of published events
model_id: base_multi_image.model_base_multi_image_image
domain_force: [("event_published", "=", True)]
groups:
- base.group_public
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions website_event_multi_image/views/event_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antiun Ingeniería S.L. - Jairo Llopis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->

<openerp>
<data>

<template id="index"
inherit_id="website_event.index"
name="Event thumbnail in list"
customize_show="True"
active="True">
<xpath expr="//div[@class='media-body']" position="before">
<div t-if="event.image_main_medium" class="pull-right">
<a t-attf-href="/event/#{slug(event)}">
<img
t-att-src="website.image_url(event, 'image_main_medium')"
t-att-alt="event.display_name"
class="media-object"/>
</a>
</div>
</xpath>
</template>

<template id="gallery_top"
inherit_id="website_event.event_description_full"
name="Carousel gallery at top"
customize_show="True"
active="False">
<xpath expr="//div[@t-field='event.description']" position="before">
<h2>Image Gallery</h2>
<t t-call="website_multi_image.carousel">
<t t-set="multi_image_owner" t-value="event"/>
</t>
</xpath>
</template>

<template id="gallery_bottom"
inherit_id="website_event.event_description_full"
name="Carousel gallery at bottom"
customize_show="True"
active="False">
<xpath expr="//div[@t-field='event.description']" position="after">
<h2>Image Gallery</h2>
<t t-call="website_multi_image.carousel">
<t t-set="multi_image_owner" t-value="event"/>
</t>
</xpath>
</template>

<template id="gallery_right"
inherit_id="website_event.event_description_full"
name="Carousel gallery at right column"
customize_show="True"
active="False">
<xpath expr="//div[@class='col-md-4 css_noprint']" position="inside">
<div class="panel panel-default" t-if="event.address_id">
<div class="panel-heading">
<h4>Image Gallery</h4>
</div>
<div class="panel-body">
<t t-call="website_multi_image.carousel">
<t t-set="multi_image_owner" t-value="event"/>
</t>
</div>
</div>
</xpath>
</template>

</data>
</openerp>

0 comments on commit dbb9e6f

Please sign in to comment.