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