Skip to content
Snippets Groups Projects
Commit 5aa645c8 authored by qmo-odoo's avatar qmo-odoo Committed by jem-odoo
Browse files

[IMP] website_slides: add external links on slide

A slide can now have some external link. For instance, links to
the origin of the document (sources for scientifics papers, ...).
A new model is added to allow the user to provide several link
per slide. Those are display below the channel on website page.

Task-1938643
parent c2a38e46
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,15 @@ class SlidePartnerRelation(models.Model):
completed = fields.Boolean('Completed')
class SlideLink(models.Model):
_name = 'slide.slide.link'
_description = "External URL for a particular slide"
slide_id = fields.Many2one('slide.slide', required=True)
name = fields.Char('Title', required=True)
link = fields.Char("External Link", required=True)
class EmbeddedSlide(models.Model):
""" Embedding in third party websites. Track view count, generate statistics. """
_name = 'slide.embed'
......@@ -130,6 +139,7 @@ class Slide(models.Model):
datas = fields.Binary('Content', attachment=True)
url = fields.Char('Document URL', help="Youtube or Google Document URL")
document_id = fields.Char('Document ID', help="Youtube or Google Document ID")
link_ids = fields.One2many('slide.slide.link', 'slide_id', string="External URL for this slide")
mime_type = fields.Char('Mime-type')
# website
website_id = fields.Many2one(related='channel_id.website_id', readonly=True)
......
......@@ -17,3 +17,5 @@ access_slide_category_all,slide.category.all,model_slide_category,,1,0,0,0
access_slide_category_publisher,slide.category.publisher,model_slide_category,website.group_website_publisher,1,1,1,1
access_slide_embed_all,slide.embed.all,model_slide_embed,,1,0,0,0
access_slide_embed_user,slide.embed.user,model_slide_embed,base.group_user,1,1,1,1
access_slide_slide_link_all,slide.slide.link.all,model_slide_slide_link,,1,0,0,0
access_slide_slide_link_publisher,slide.slide.link.publisher,model_slide_slide_link,website.group_website_publisher,1,1,1,1
\ No newline at end of file
......@@ -92,6 +92,16 @@
<label for="index_content"/>
<field name="index_content"/>
</page>
<page string="External Links">
<group>
<field name="link_ids" widget="one2many" nolabel="1">
<tree editable="top">
<field name="name"/>
<field name="link" widget="url"/>
</tree>
</field>
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
......
......@@ -513,6 +513,11 @@
<i class="fa fa-bar-chart"></i> Statistics
</a>
</li>
<li class="nav-item" t-if="slide.link_ids">
<a href="#external-links" aria-controls="external-links" class="nav-link" role="tab" data-toggle="tab">
<i class="fa fa-link"></i> External Links
</a>
</li>
</ul>
<div class="tab-content" style="padding: 20px 5px 5px 5px; word-wrap: break-word;">
<div role="tabpanel" t-att-class="not comments and 'tab-pane fade in show active' or 'tab-pane fade'" id="about">
......@@ -628,6 +633,13 @@
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade oe_slides_transcript" id="external-links" t-if="slide.link_ids">
<ul>
<t t-foreach="slide.link_ids" t-as="link">
<li><a t-att-href="link.link" target="_blank"><t t-esc="link.name"/></a></li>
</t>
</ul>
</div>
</div>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment