edgar пре 8 година
комит
856dd5a5aa

+ 72 - 0
README.rst

@@ -0,0 +1,72 @@
+.. 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
+
+=======================
+Excerpt + Image in Blog
+=======================
+
+This module extends the functionality of blogs to support having a more
+attractive layout that automatically displays an excerpt of each post, a "Read
+more" button and an image.
+
+Installation
+============
+
+To install this module, you need to:
+
+* Install `OCA/server-tools <https://github.com/OCA/server-tools>`_.
+
+Usage
+=====
+
+To use this module, you need to:
+
+* Go to your blog.
+
+.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
+   :alt: Try me on Runbot
+   :target: https://runbot.odoo-community.org/runbot/186/8.0
+
+Known issues / Roadmap
+======================
+
+* Right now, it will display the cover image if available, and an image
+  extracted from the post body otherwise. It would be nice to let the web admin
+  choose that, or even better to display a carousel with all images from the
+  post.
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues
+<https://github.com/OCA/website/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/
+website/issues/new?body=module:%20
+website_blog_excerpt_img%0Aversion:%20
+8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Jairo Llopis <yajo.sk8@gmail.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.



+ 27 - 0
__openerp__.py

@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+{
+    "name": "Excerpt + Image in Blog",
+    "summary": "New layout for blog summary, including an excerpt and image",
+    "version": "8.0.1.0.0",
+    "category": "Website",
+    "website": "https://grupoesoc.es",
+    "author": "Grupo ESOC Ingeniería de Servicios, "
+              "Odoo Community Association (OCA)",
+    "license": "AGPL-3",
+    "application": False,
+    "installable": True,
+    "images": [
+        "images/style-default.png",
+    ],
+    "depends": [
+        "website_blog",
+        "html_image_url_extractor",
+        "html_text",
+    ],
+    "data": [
+        "views/assets.xml",
+        "views/blog.xml",
+    ],
+}

+ 38 - 0
i18n/es.po

@@ -0,0 +1,38 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* website_blog_excerpt_img
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-02-11 12:37+0000\n"
+"PO-Revision-Date: 2016-02-11 13:38+0100\n"
+"Last-Translator: Jairo Llopis <j.llopis@grupoesoc.es>\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.6\n"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "Read more"
+msgstr "Leer más"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "col-xs-10"
+msgstr "col-xs-10"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "mb32 row"
+msgstr "mb32 row"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "text-muted col-xs-12 mb16"
+msgstr "text-muted col-xs-12 mb16"

+ 39 - 0
i18n/fr.po

@@ -0,0 +1,39 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * website_blog_excerpt_img
+# 
+# Translators:
+# Christophe CHAUVET <christophe.chauvet@gmail.com>, 2016
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-07-29 17:03+0000\n"
+"PO-Revision-Date: 2016-07-29 17:03+0000\n"
+"Last-Translator: Christophe CHAUVET <christophe.chauvet@gmail.com>, 2016\n"
+"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: fr\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "Read more"
+msgstr "Lire plus"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "col-xs-10"
+msgstr "col-xs-10"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "mb32 row"
+msgstr "mb32 row"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "text-muted col-xs-12 mb16"
+msgstr "text-muted col-xs-12 mb16"

+ 39 - 0
i18n/sl.po

@@ -0,0 +1,39 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * website_blog_excerpt_img
+# 
+# Translators:
+# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2016-06-23 03:09+0000\n"
+"PO-Revision-Date: 2016-06-23 03:09+0000\n"
+"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>, 2016\n"
+"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Language: sl\n"
+"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "Read more"
+msgstr "Preberi več"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "col-xs-10"
+msgstr "col-xs-10"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "mb32 row"
+msgstr "mb32 row"
+
+#. module: website_blog_excerpt_img
+#: view:website:website_blog.blog_post_short
+msgid "text-muted col-xs-12 mb16"
+msgstr "text-muted col-xs-12 mb16"

BIN
images/style-default.png


BIN
static/description/icon.png


+ 10 - 0
static/src/css/website_blog_excerpt_img.css

@@ -0,0 +1,10 @@
+@charset "UTF-8";
+/* © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
+ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
+.website_blog .excerpt-img .img {
+  height: 15em;
+  width: 100%;
+  object-fit: cover;
+  object-position: center; }
+
+/*# sourceMappingURL=website_blog_excerpt_img.css.map */

+ 7 - 0
static/src/css/website_blog_excerpt_img.css.map

@@ -0,0 +1,7 @@
+{
+"version": 3,
+"mappings": ";;;AAKI,+BAAiB;EACb,MAAM,EAAE,IAAI;EACZ,KAAK,EAAE,IAAI;EAEP,UAAG,EAAE,KAAK;EACV,eAAQ,EAAE,MAAM",
+"sources": ["website_blog_excerpt_img.sass"],
+"names": [],
+"file": "website_blog_excerpt_img.css"
+}

+ 11 - 0
static/src/css/website_blog_excerpt_img.sass

@@ -0,0 +1,11 @@
+@charset "utf-8"
+/* © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
+   License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+.website_blog
+    .excerpt-img .img
+        height: 15em
+        width: 100%
+        object:
+            fit: cover
+            position: center

+ 17 - 0
views/assets.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
+     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
+
+<openerp>
+<data>
+
+<template id="assets_frontend" inherit_id="website_blog.assets_frontend">
+    <xpath expr=".">
+        <link
+            rel="stylesheet"
+            href="/website_blog_excerpt_img/static/src/css/website_blog_excerpt_img.css"/>
+    </xpath>
+</template>
+
+</data>
+</openerp>

+ 58 - 0
views/blog.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
+     License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
+
+<openerp>
+<data>
+
+<template id="blog_post_short"
+          inherit_id="website_blog.blog_post_short">
+    <!-- Entries are Bootstrap rows -->
+    <xpath expr="//div[@t-as='blog_post']" position="attributes">
+        <attribute name="class">mb32 row</attribute>
+    </xpath>
+    <xpath expr="//h2/.." position="attributes">
+        <attribute name="class">col-xs-10</attribute>
+    </xpath>
+    <xpath expr="//div[@name='blog_post_data']/.." position="attributes">
+        <attribute name="class">text-muted col-xs-12 mb16</attribute>
+    </xpath>
+
+    <!-- Excerpt, image, read more button -->
+    <xpath expr="//div[@name='blog_post_data']/.." position="after">
+        <t
+            t-set="image_url"
+            t-value="(
+                blog_post.background_image and
+                not blog_post.background_image.startswith(
+                  '%s/blog/' %
+                      env['ir.config_parameter']
+                      .get_param('web.base.url')) and
+                blog_post.background_image
+            )"/>
+        <t t-if="not (image_url)">
+            <t t-foreach="env['ir.fields.converter']
+                          .imgs_from_html(blog_post.content, 1)"
+               t-as="image_url"/>
+        </t>
+
+        <div t-attf-class="excerpt-txt col-sm-#{7 if image_url else 12}">
+            <p t-esc="env['ir.fields.converter']
+                      .text_from_html(blog_post.content, 80)"/>
+            <p>
+                <a t-attf-href="/blog/#{slug(blog_post.blog_id)}/post/#{slug(blog_post)}"
+                   class="btn btn-primary">
+                   Read more
+                </a>
+            </p>
+        </div>
+        <div t-if="image_url" class="col-sm-5 text-center excerpt-img">
+            <!-- Use cover image if available -->
+            <img class="img img-responsive img-thumbnail"
+                 t-att-src="image_url"/>
+        </div>
+    </xpath>
+</template>
+
+</data>
+</openerp>