[FIX] website_mail, websit_mail_group: moved discussion group snippet to the right...
[odoo/odoo.git] / addons / website_mail_group / views / website_mail_group.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <openerp>
3 <data>
4
5 <template id="footer_mailing_list" inherit_id="website.layout" name="Footer Mailing List Link">
6     <xpath expr="//footer//div[@name='info']/ul" position="inside">
7         <li><a t-attf-href="/groups">Mailing List</a></li>
8     </xpath>
9 </template>
10
11 <template id="head" inherit_id="website.layout" name="Mail Group Customization">
12     <xpath expr="//head" position="inside">
13         <script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.editor.js" groups="base.group_website_publisher"></script>
14         <script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.snippet.js"></script>
15     </xpath>
16 </template>
17
18 <template id="mail_groups" name="Mailing Lists">
19     <t t-call="website.layout">
20         <div id="wrap" class="oe_structure oe_empty">
21             <section class="bg-primary jumbotron mt0 mb0">
22                 <div class="container">
23                     <h1>Stay in touch with our Community</h1>
24                     <p>Alone we can do so little, together we can do so much</p>
25                 </div>
26             </section>
27         </div>
28         <div class="container mt32">
29             <div class="row mt8" t-foreach="groups" t-as="group">
30                 <div class="col-md-3">
31                     <img t-att-src="'/website/image?model=mail.group&amp;field=image_small&amp;id='+str(group['id'])" class="pull-left"/>
32                     <strong><a t-attf-href="/groups/#{ slug(group) }" t-esc="group.name"/></strong><br />
33                     <t t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
34                         <i class='fa fa-envelope-o'/>
35                         <a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
36                     </t>
37                 </div>
38                 <div class="col-md-4">
39                     <div t-esc="group.description" class="text-muted"/>
40                 </div>
41                 <div class="col-md-2">
42                     <i class='fa fa-user'/> <t t-esc="len(group.message_follower_ids)"/> participants<br />
43                     <i class='fa fa-envelope-o'/> <t t-esc="len(group.message_ids)"/> messages
44                 </div>
45                 <div class="col-md-3">
46                     <t t-call="website_mail.follow"><t t-set="object" t-value="group"/></t>
47                 </div>
48             </div>
49         </div>
50     </t>
51 </template>
52
53 <template id="group_messages" name="Message Threads">
54     <t t-call="website.layout">
55         <t t-set="head">
56             <link rel='stylesheet' href="/website_mail_group/static/src/css/website_mail_group.css"/>
57             <script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.js"/>
58         </t>
59         <section class="container">
60             <div class="row mt8">
61                 <ol class="breadcrumb pull-left">
62                     <li><a href="/groups">Mailing Lists</a></li>
63                     <li>
64                         <a t-attf-href="/groups/#{slug(group)}?#{mode and 'mode=%s' % mode or ''}#{date_begin and '&amp;date_begin=%s' % date_begin or ''}#{date_end and '&amp;date_end=%s' % date_end or ''}"><t t-esc="group.name"/></a>
65                     </li>
66                 </ol>
67             </div>
68             <div class="row">
69                 <h1 class="text-center">
70                     <t t-esc="group.name"/> mailing list archives
71                 </h1><h4 class="text-center text-muted" t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
72                     <i class='fa fa-envelope-o'/>
73                     <a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
74                 </h4>
75             </div>
76             <div class="row">
77                 <div class="col-md-3">
78                     <h2>Archives</h2>
79                     <ul class="nav nav-pills nav-stacked" id="group_mode">
80                         <li t-attf-class="#{mode=='thread' and 'active' or ''}">
81                             <a t-attf-href="/groups/#{ slug(group) }?mode=thread">By thread</a>
82                         </li>
83                         <li t-attf-class="#{mode=='date' and not date_begin and 'active' or ''}">
84                             <a t-attf-href="/groups/#{ slug(group) }?mode=date">By date</a>
85                             <ul class="nav nav-pills nav-stacked" style="margin-left: 8px;">
86                                 <t t-foreach="archives" t-as="month_archive">
87                                 <li t-att-class="month_archive['date_begin'] == date_begin and 'active' or None">
88                                     <a t-ignore="True" t-attf-href="/groups/#{ slug(group) }?mode=date&amp;date_begin=#{ month_archive['date_begin'] }&amp;date_end=#{month_archive['date_end']}">
89                                         <t t-esc="month_archive['date']"/>
90                                         <span class="pull-right badge" t-esc="month_archive['date_count']"/>
91                                     </a>
92                                 </li>
93                                 </t>
94                             </ul>
95                         </li>
96                     </ul>
97                 </div>
98                 <div class="col-md-9">
99                     <div>
100                         <t t-call="website.pager"/>
101                     </div>
102                     <t t-call="website_mail_group.messages_short">
103                         <t t-set="messages" t-value="messages"/>
104                         <t t-set="msg_more_count" t-value="0"/>
105                         <t t-set="thread_header" t-value="None"/>
106                     </t>
107                     <div>
108                         <t t-call="website.pager"/>
109                     </div>
110                 </div>
111             </div>
112         </section>
113     </t>
114 </template>
115
116 <template id="group_message">
117     <t t-call="website.layout">
118         <t t-set="head">
119             <link rel='stylesheet' href="/website_mail_group/static/src/css/website_mail_group.css"/>
120             <script type="text/javascript" src="/website_mail_group/static/src/js/website_mail_group.js"/>
121         </t>
122         <section class="container">
123             <div class="row mt8">
124                 <ol class="breadcrumb pull-left">
125                     <li><a href="/groups">Mailing Lists</a></li>
126                     <li>
127                         <a t-attf-href="/groups/#{slug(group)}?#{mode and 'mode=%s' % mode or ''}#{date_begin and '&amp;date_begin=%s' % date_begin or ''}#{date_end and '&amp;date_end=%s' % date_end or ''}"><t t-esc="group.name"/></a>
128                     </li>
129                     <li t-if="message" class="active"><t t-esc="message.description"/></li>
130                 </ol>
131             </div>
132             <div class="row">
133                 <h1 class="text-center">
134                     <t t-esc="group.name"/> mailing list archives
135                 </h1><h4 class="text-center text-muted" t-if="group.alias_id and group.alias_id.alias_name and group.alias_id.alias_domain">
136                     <i class='fa fa-envelope-o'/>
137                     <a t-attf-href="mailto:#{group.alias_id.alias_name}@#{group.alias_id.alias_domain}"><span t-field="group.alias_id"/></a>
138                 </h4>
139             </div>
140             <div class="row">
141                 <div class="col-md-3">
142                     <h4>Browse archives</h4>
143                     <ul class="nav nav-pills nav-stacked" id="group_mode">
144                         <li t-attf-class="#{mode=='thread' and 'active' or ''}">
145                             <a t-attf-href="/groups/#{ slug(group) }?mode=thread">By thread</a>
146                         </li>
147                         <li t-attf-class="#{mode=='date' and not date_begin and 'active' or ''}">
148                             <a t-attf-href="/groups/#{ slug(group) }?mode=date">By date</a>
149                             <ul class="nav nav-pills nav-stacked" style="margin-left: 8px;">
150                                 <t t-foreach="archives" t-as="month_archive">
151                                 <li t-att-class="month_archive['date_begin'] == date_begin and 'active' or None">
152                                     <a t-ignore="True" t-attf-href="/groups/#{ slug(group) }?mode=date&amp;date_begin=#{ month_archive['date_begin'] }&amp;date_end=#{month_archive['date_end']}">
153                                         <t t-esc="month_archive['date']"/>
154                                         <span class="pull-right badge" t-esc="month_archive['date_count']"/>
155                                     </a>
156                                 </li>
157                                 </t>
158                             </ul>
159                         </li>
160                     </ul>
161                 </div>
162                 <div class="col-md-9">
163                     <div class="row">
164                         <h4 class="col-md-6">
165                             <t t-if="prev_message"><a t-attf-href='/groups/#{slug(group)}/#{slug(prev_message)}?#{mode and "mode=%s" % mode or ""}'>
166                                 <i class="fa fa-arrow-left"/> <t t-esc="prev_message.description"/>
167                             </a></t>
168                         </h4>
169                         <h4 class="col-md-6">
170                             <t t-if="next_message"><a class="pull-right" t-attf-href='/groups/#{slug(group)}/#{slug(next_message)}?#{mode and "mode=%s" % mode or ""}'>
171                                 <t t-esc="next_message.description"/> <i class="fa fa-arrow-right"/>
172                             </a></t>
173                         </h4>
174                     </div>
175                     <div class="media">
176                         <img class="img-rounded pull-left mt0 media-object o_mg_avatar"
177                             t-att-src="'/website/image?model=mail.message&amp;field=author_avatar&amp;id='+str(message.id)"/>
178                         <div class="media-body">
179                             <h4 class="media-heading" t-esc="message.description"/>
180                             <small>
181                                 by
182                                 <t t-if="message.author_id">
183                                     <span t-field="message.author_id" style="display: inline-block;" t-field-options='{
184                                         "widget": "contact",
185                                         "fields": ["name"]
186                                     }'/>
187                                 </t>
188                                 <t t-if="not message.author_id"><t t-esc="message.email_from"/></t>
189                                 - <i class="fa fa-calendar"/> <t t-esc="message.date"/>
190                             </small>
191                             <div t-raw="message.body"/>
192
193                             <div>
194                                 <p t-if="message.attachment_ids" class="mt8">
195                                     <a href="#" class="o_mg_link_hide">
196                                         <i class="fa fa-chevron-right"/> <t t-raw="len(message.attachment_ids)"/> attachments
197                                     </a>
198                                     <a href="#" class="o_mg_link_show">
199                                         <i class="fa fa-chevron-down"/> <t t-raw="len(message.attachment_ids)"/> attachments
200                                     </a>
201                                 </p>
202                                 <div class="o_mg_link_content">
203                                     <div class="col-md-2 col-sm-3 text-center" t-foreach='message.attachment_ids' t-as='attachment'>
204                                         <a t-att-href="'/mail/download_attachment?model=mail.message&amp;id='+str(message.id)+'&amp;method=download_attachment&amp;attachment_id='+str(attachment.id)" target="_blank">
205                                             <t t-if="attachment.file_type == 'webimage'">
206                                                 <img t-att-src="'/web/binary/image?model=ir.attachment&amp;field=datas&amp;id=' + str(attachment.id) + '&amp;resize=100,80'"
207                                                     class='oe_attachment_embedded'
208                                                     t-att-title="attachment.name"/>
209                                             </t>
210                                             <t t-if="attachment.file_type != 'webimage'">
211                                                 <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.file_type + '.png'"
212                                                     class='oe_attachment_webimage'
213                                                     t-att-title="attachment.name"/>
214                                             </t>
215                                             <div class='oe_attachment_name'><t t-raw='attachment.name' /></div>
216                                         </a>
217                                     </div>
218                                 </div>
219                             </div>
220                         </div>
221                     </div>
222                     <div t-if="message.child_ids" class="o_mg_replies">
223                         <h4 class="page-header">Follow-Ups</h4>
224                         <t t-call="website_mail_group.messages_short">
225                             <t t-set="messages" t-value="message.child_ids[:replies_per_page]"/>
226                             <t t-set="msg_more_count" t-value="len(message.child_ids) - replies_per_page"/>
227                             <t t-set="thread_header" t-value="message"/>
228                         </t>
229                     </div>
230                     <div t-if="message.parent_id">
231                         <h4 class="page-header">Reference</h4>
232                         <t t-call="website_mail_group.messages_short">
233                             <t t-set="messages" t-value="[message.parent_id]"/>
234                         </t>
235                     </div>
236                 </div>
237             </div>
238         </section>
239     </t>
240 </template>
241
242 <template id="messages_short">
243     <div>
244         <ul class="media-list">
245             <li t-foreach="messages" t-as="thread" class="media">
246                 <img class="img-rounded pull-left mt0 media-object o_mg_avatar"
247                     t-att-src="'/website/image?model=mail.message&amp;field=author_avatar&amp;id='+str(thread.id)"/>
248                 <div class="media-body">
249                     <h4 class="media-heading">
250                         <a t-attf-href="/groups/#{slug(group)}/#{slug(thread)}?mode=#{mode}&amp;date_begin=#{date_begin}&amp;date_end=#{date_end}" t-esc="thread.description"/>
251                     </h4>
252                     <small>
253                         by
254                         <t t-if="thread.author_id">
255                             <span t-field="thread.author_id" style="display: inline-block;" t-field-options='{
256                                 "widget": "contact",
257                                 "fields": ["name"]
258                             }'/>
259                         </t>
260                         <t t-if="not thread.author_id"><t t-esc="thread.email_from"/></t>
261                         - <i class="fa fa-calendar"/> <t t-esc="thread.date"/>
262                         - <i class="fa fa-paperclip"/> <t t-esc="len(thread.attachment_ids)"/>
263                     </small>
264                     <p t-if="thread.child_ids" class="mt8">
265                         <a href="#" class="o_mg_link_hide">
266                             <i class="fa fa-chevron-right"/> <t t-raw="len(thread.child_ids)"/> replies
267                         </a>
268                         <a href="#" class="o_mg_link_show">
269                             <i class="fa fa-chevron-down"/> <t t-raw="len(thread.child_ids)"/> replies
270                         </a>
271                     </p>
272                     <div class="o_mg_link_content o_mg_replies">
273                         <t t-call="website_mail_group.messages_short">
274                             <t t-set="messages" t-value="thread.child_ids[:replies_per_page]"/>
275                             <t t-set="msg_more_count" t-value="len(thread.child_ids) - replies_per_page"/>
276                             <t t-set="thread_header" t-value="thread"/>
277                         </t>
278                     </div>
279                 </div>
280             </li>
281         </ul>
282         <p t-if="messages and msg_more_count > 0 and thread_header" class="well well-sm">
283             <button class="fa btn-link o_mg_read_more"
284                 t-attf-data-href="/groups/#{slug(group)}/#{slug(thread_header)}/get_replies"
285                 t-attf-data-msg-id="#{messages[-1].id}">
286                 show <t t-esc="msg_more_count"/> more replies
287             </button>
288         </p>
289     </div>
290 </template>
291
292 </data>
293 </openerp>