blog.xml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- © 2016 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
  3. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
  4. <openerp>
  5. <data>
  6. <template id="blog_post_short"
  7. inherit_id="website_blog.blog_post_short">
  8. <!-- Entries are Bootstrap rows -->
  9. <xpath expr="//div[@t-as='blog_post']" position="attributes">
  10. <attribute name="class">mb32 row</attribute>
  11. </xpath>
  12. <xpath expr="//h2/.." position="attributes">
  13. <attribute name="class">col-xs-10</attribute>
  14. </xpath>
  15. <xpath expr="//div[@name='blog_post_data']/.." position="attributes">
  16. <attribute name="class">text-muted col-xs-12 mb16</attribute>
  17. </xpath>
  18. <!-- Excerpt, image, read more button -->
  19. <xpath expr="//div[@name='blog_post_data']/.." position="after">
  20. <t
  21. t-set="image_url"
  22. t-value="(
  23. blog_post.background_image and
  24. not blog_post.background_image.startswith(
  25. '%s/blog/' %
  26. env['ir.config_parameter']
  27. .get_param('web.base.url')) and
  28. blog_post.background_image
  29. )"/>
  30. <t t-if="not (image_url)">
  31. <t t-foreach="env['ir.fields.converter']
  32. .imgs_from_html(blog_post.content, 1)"
  33. t-as="image_url"/>
  34. </t>
  35. <div t-attf-class="excerpt-txt col-sm-#{7 if image_url else 12}">
  36. <p t-esc="env['ir.fields.converter']
  37. .text_from_html(blog_post.content, 80)"/>
  38. <p>
  39. <a t-attf-href="/blog/#{slug(blog_post.blog_id)}/post/#{slug(blog_post)}"
  40. class="btn btn-primary">
  41. Read more
  42. </a>
  43. </p>
  44. </div>
  45. <div t-if="image_url" class="col-sm-5 text-center excerpt-img">
  46. <!-- Use cover image if available -->
  47. <img class="img img-responsive img-thumbnail"
  48. t-att-src="image_url"/>
  49. </div>
  50. </xpath>
  51. </template>
  52. </data>
  53. </openerp>