[FIX] mail: fixed display issue with the like button
[odoo/odoo.git] / addons / mail / static / src / xml / mail.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <template>
3
4     <!--
5         mail.Widget template used to namespace the css -->
6     <t t-name="mail.Root">
7         <div class="oe_mail">
8         </div>
9     </t>
10
11     <!--
12         mail.compose_message template
13         This template holds the composition form to write a note or send
14         an e-mail. It contains by default a textarea, that will be replaced
15         by another composition form in the main wall composition form, or
16         for main thread composition form in document form view.
17
18         mail.compose_message.compact template
19         This template holds the composition form to write a message, this box is converted into
20         mail.compose_message when focus on textarea
21         -->
22     <t t-name="mail.compose_message">
23         <div t-if="widget.show_composer and !widget.options.readonly" t-attf-class="oe_msg oe_msg_composer #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
24             <div class="oe_msg_left">
25                 <img class="oe_msg_icon" alt="User img" t-attf-src="#{widget.avatar}"/>
26             </div>
27             <div class="oe_msg_center">
28                 <div class="oe_msg_content">
29                     <button class="oe_full" title="Open the full mail composer"><span class='oe_e'>&amp;ograve</span></button>
30                     <t t-call="mail.thread.list_recipients"/>
31                     <textarea class="field_text"></textarea>
32                 </div>
33                 <div class="oe_msg_footer">
34                     <div class="oe_msg_attachment_list"></div>
35                     <button class="oe_post">
36                         <t t-if="!widget.is_log">Send</t>
37                         <t t-if="widget.is_log">Log an internal note</t>
38                     </button>
39                     <t t-call="mail.compose_message.add_attachment"/>
40                 </div>
41             </div>
42         </div>
43         <div t-if="widget.show_compact_message and !widget.show_composer and !widget.options.readonly" t-attf-class="oe_msg oe_msg_composer_compact #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
44             <t t-if="widget.options.view_mailbox">
45                 <div class="field_text oe_compact oe_compact_inbox">
46                     <t t-if="widget.options.compose_placeholder" t-raw="widget.options.compose_placeholder"/>
47                     <t t-if="!widget.options.compose_placeholder and widget.options.view_mailbox">Share with my followers...</t>
48                 </div>
49             </t>
50             <t t-if="!widget.options.view_mailbox">
51                 <div class="field_text oe_compact oe_compact_record">
52                     <a class="oe_compose_post" t-if="widget.options.compose_placeholder"><t t-raw="widget.options.compose_placeholder"/></a>
53                     <a class="oe_compose_post" t-if="!widget.options.compose_placeholder and !widget.options.view_mailbox">Send a message</a>
54                     <t t-if="widget.options.display_log_button">
55                        <span class="oe_grey oe_sep_word">or</span>
56                        <a class="oe_compose_log">Log an internal note</a>
57                     </t>
58                 </div>
59             </t>
60         </div>
61         <span t-if="!(widget.show_compact_message and !widget.show_composer) and !widget.show_composer" class="oe_placeholder_compose"></span>
62     </t>
63
64     <!--
65         mail.compose_message.add_attachment template
66         Small template to be inserted in the composition for add attachments
67         -->
68     <t t-name="mail.compose_message.add_attachment">
69         <span class="oe_attachment_file">
70             <span class="oe_add">
71                 <!-- uploader of file -->
72                 <button class="oe_attach"><span class="oe_e">'</span></button> 
73                 <span class='oe_attach_label'>Attach a File</span>
74                 <t t-call="HiddenInputFile">
75                     <t t-set="fileupload_id" t-value="widget.fileupload_id"/>
76                     <t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t>
77                     <input type="hidden" name="model" value="mail.compose.message"/>
78                     <input type="hidden" name="id" value="0"/>
79                     <input type="hidden" name="session_id" t-att-value="widget.session.session_id"/>
80                 </t>
81             </span>
82         </span>
83     </t>
84
85     <!--
86         mail.thread.message.attachments template
87         Template used to display attachments in a mail.message
88         -->
89     <t t-name="mail.thread.message.attachments">
90         <t t-foreach='widget.attachment_ids' t-as='attachment'>
91             <t t-if="attachment.file_type_icon !== 'webimage'">
92                 <div t-attf-class="oe_attachment #{attachment.upload ? 'oe_uploading' : ''}">
93                     <a t-att-href='attachment.url' target="_blank">
94                         <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.file_type_icon + '.png'"></img>
95                         <div class='oe_name'><t t-raw='attachment.name' /></div>
96                     </a>
97                     <div class='oe_delete oe_e' title="Delete this attachment" t-att-data-id="attachment.id">[</div>
98                     <div class='oe_progress_bar'>
99                         uploading
100                     </div>
101                 </div>
102             </t>
103             <t t-if="attachment.file_type_icon === 'webimage'">
104                 <div t-attf-class="oe_attachment oe_preview #{attachment.upload ? 'oe_uploading' : ''}">
105                     <a t-att-href='attachment.url' target="_blank">
106                         <img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img>
107                         <div class='oe_name'><t t-raw='attachment.name' /></div>
108                     </a>
109                     <div class='oe_delete oe_e' title="Delete this attachment" t-att-data-id="attachment.id">[</div>
110                     <div class='oe_progress_bar'>
111                         uploading
112                     </div>
113                 </div>
114             </t>
115         </t>
116     </t>
117
118     <!--
119         template to the recipients list
120         -->
121     <t t-name="mail.thread.list_recipients">
122         <div class="oe_mail_list_recipients" t-if="!widget.is_log">
123             To:
124             <t t-if="!widget.is_private">
125                 <span class="oe_all_follower">
126                     <t t-if="widget.parent_thread.parent_message.record_name">
127                         Followers of <t t-raw="'&quot;' + widget.parent_thread.parent_message.record_name + '&quot;'"/>
128                     </t>
129                     <t t-if="!widget.parent_thread.parent_message.record_name and widget.options.view_inbox">My Followers</t>
130                     <t t-if="!widget.parent_thread.parent_message.record_name and !widget.options.view_inbox">Followers of this document</t>
131                 </span>
132             </t>
133             <t t-set="inc" t-value="0"/>
134             <t t-foreach="widget.partner_ids" t-as="partner">
135                 <t t-if="widget.is_private or (widget.user_pid != partner[0])">
136                     <t t-if="!widget.is_private and inc==0"> and </t>
137                         <span t-attf-class="oe_partner_follower #{inc>=3?'oe_hidden':''}"><t t-if="inc" t-raw="', '"/>
138                         <a t-if="widget.options.show_link" t-attf-href="#model=res.partner&amp;id=#{partner[0]}"><t t-esc="partner[1]"/></a>
139                         <t t-if="!widget.options.show_link" t-esc="partner[1]"/>
140                         </span>
141                         <t t-set="inc" t-value="inc+1"/>
142                     </t>
143             </t>
144             <t t-if="widget.partner_ids.length > 3">
145                 <span class="oe_more">, <a><t t-esc="widget.partner_ids.length - 3"/> others...</a></span>
146                 <a class="oe_more_hidden">&lt;&lt;&lt;</a>
147             </t>
148         </div>
149         <div class="oe_recipients" t-if="!widget.is_log">
150             <t t-foreach='widget.recipients' t-as='recipient'>
151                 <label t-attf-title="Add as recipient and follower (reason: #{recipient.reason})">
152                     <input type="checkbox" t-att-checked="recipient.checked ? 'checked' : undefined" t-att-data="recipient.full_name"/>
153                     <t t-esc="recipient.name"/> 
154                     <t t-if="recipient.email_address">(<t t-esc="recipient.email_address"/>)</t>
155                     <t t-if="!recipient.email_address">(no email address)</t>
156                 </label>
157             </t>
158         </div>
159         <div t-if="widget.is_log">
160             <span>Add an internal note that will not be sent to the followers</span>
161         </div>
162     </t>
163
164     <!-- 
165         wall main template
166         Template used to display the communication history in the wall.
167         -->
168     <div t-name="mail.wall" class="oe_view_manager oe_mail_wall oe_view_manager_current">
169         <table class="oe_view_manager_header">
170           <colgroup>
171             <col width="33%"/>
172             <col width="33%"/>
173             <col width="34%"/>
174           </colgroup>
175           <tbody>
176             <tr class="oe_header_row oe_header_row_top">
177                 <td colspan="2">
178                     <h2 class="oe_view_title">
179                         <span class="oe_view_title_text">
180                             <t t-esc="widget.action.name"/>
181                         </span>
182                     </h2>
183                     <t t-if="widget.action.params.header_description">
184                         <br/>
185                         <span class="oe_view_subtitle_text">
186                             <t t-raw="widget.action.params.header_description"/>
187                         </span>
188                     </t>
189                 </td>
190                 <td><div class="oe_view_manager_view_search" t-opentag="true"/></td>
191             </tr>
192             <tr class="oe_header_row" t-if="widget.action.params.view_inbox and widget.action.params.show_compose_message" >
193                 <td colspan="2">
194                     <button type="button" class="oe_write_full oe_highlight">
195                         Compose a new message
196                     </button>
197                     <span class='oe_alternative'>
198                         or
199                         <a href='#'  class='oe_write_onwall oe_bold' help='Your followers can read this message'>Write to my followers</a>
200                     </span>
201                 </td>
202             </tr>
203           </tbody>
204         </table>
205         <div class="oe_mail-placeholder"></div>
206         <aside class="oe_mail_wall_aside"></aside>
207     </div>
208
209     <!--
210         Empty template that holds the sidebar of the Wall
211         -->
212     <t t-name="mail.wall.sidebar">
213         <div class="oe_mail_wall_sidebar"></div>
214     </t>
215
216     <!--
217         display message on the wall when there are no message
218         -->
219     <t t-name="mail.wall_no_message">
220         <div class="oe_view_nocontent">No messages.</div>
221     </t>
222
223     <!--
224         error message for uploading
225         -->
226     <t t-name="mail.error_upload">Uploading error</t>
227     <t t-name="mail.error_upload_please_wait">Please, wait while the file is uploading.</t>
228
229     <!--
230         record_thread main template
231         Template used to display the communication history in documents
232         form view.
233         -->
234     <div t-name="mail.record_thread" class="oe_record_thread">
235         <div class="oe_mail-placeholder">
236         </div>
237     </div>
238
239     <t t-name="mail.thread">
240         <div t-attf-class="oe_thread #{widget.root?'oe_root_thread':''}"/>
241     </t>
242
243     <!-- default layout -->
244     <t t-name="mail.thread.message">
245         <div t-attf-class="oe_msg #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''} #{widget.subtype ? '' : 'oe_msg_nobody'} oe_msg_#{widget.type}">
246
247             <div class='oe_msg_left'>
248                 <a t-if="widget.options.show_link" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}" t-att-title="widget.author_id[1]">
249                     <img class="oe_msg_icon" t-att-src="widget.avatar"/>
250                 </a>
251                 <img t-if="!widget.options.show_link" class="oe_msg_icon" t-att-src="widget.avatar"/>
252             </div>
253
254             <div class="oe_msg_center">
255                 <div class='oe_msg_icons' t-if="!widget.options.readonly">
256                     <span class='oe_read' t-if="widget.options.show_read"><a title="Done" class="oe_e">W</a></span>
257                     <span class='oe_unread' t-if="widget.is_favorite and widget.options.show_unread"><a title="Set back to Todo" class="oe_e">v</a></span>
258                     <span class='oe_unread' t-if="!widget.is_favorite and widget.options.show_unread"><a title="Move to Inbox" class="oe_e">v</a></span>
259                     <span class='oe_reply' t-if="widget.options.show_reply_button"><a title="Reply" class="oe_e">(</a></span>
260                     <span t-attf-class="oe_star #{widget.is_favorite?'oe_starred':''}"><a title="Mark as Todo" class="oe_e">7</a></span>
261                 </div>
262                 <!-- message itself -->
263                 <div class="oe_msg_content">
264                     <h1 t-if="(widget.show_record_name or widget.subject) and !widget.thread_level" class="oe_msg_title">
265                         <a t-if="widget.options.show_link and widget.show_record_name" class="oe_mail_action_model"
266                             t-attf-href="#action=mail.action_mail_redirect&amp;model=#{widget.model}&amp;res_id=#{widget.res_id}">
267                             <t t-esc="widget.record_name"/>
268                         </a>
269                         <span t-if="!widget.options.show_link and widget.show_record_name"><t t-esc="widget.record_name"/></span>
270                         <t t-if="widget.show_record_name and widget.subject">: </t>
271                         <t t-if="widget.subject" t-esc="widget.subject"/>
272                     </h1>
273                     <div class="oe_msg_body">
274                         <t t-if="widget.body_short">
275                             <div class="oe_msg_body_short"><t t-raw="widget.body_short"/></div>
276                             <div class="oe_msg_body_long" style="display: none;"><t t-raw="widget.body"/><span class="oe_mail_reduce"><a href="#">read less</a></span></div>
277                         </t>
278                         <t t-if="! widget.body_short">
279                             <t t-raw="widget.body"/>
280                         </t>
281                     </div>
282                 </div>
283                 <div class="oe_msg_footer">
284                     <t t-if="widget.attachment_ids.length > 0">
285                         <div class="oe_msg_attachment_list"></div>
286                     </t>
287                     <a t-if="widget.author_id and widget.options.show_link and widget.author_id[0]" t-attf-href="#model=res.partner&amp;id=#{widget.author_id[0]}" t-att-data-partner="widget.author_id[0]" class="oe_mail_action_author"><t t-esc="widget.author_id[2]"/></a>
288                     <span t-if="widget.author_id and (!widget.options.show_link or !widget.author_id[0])"><t t-esc="widget.author_id[2]"/></span>
289                     <t t-if="widget.type == 'notification'">
290                         updated document
291                         <t t-if="widget.partner_ids.length > 0">
292                             <span class='oe_subtle'>•</span>
293                         </t>
294                     </t>
295                     <t t-if="widget.type == 'comment' and ! widget.subtype and widget.partner_ids.length == 0">
296                         logged a note
297                     </t>
298                     <t t-if="(widget.type == 'comment' or widget.type == 'email') and (widget.subtype or widget.partner_ids.length > 0)">
299                         <!-- Remove nobody if user have no rights on partner that will display 'portal to nobody 5 minutes ago' that will confuse to end user, now it display 'portal 5 minutes ago' if no rights.-->
300                         <t t-if="widget.partner_ids.length > 0">
301                             to
302                         </t>
303                     </t>
304                     <t t-if="widget.type == 'notification' or ( (widget.type == 'email' or widget.type == 'comment') and (widget.subtype or widget.partner_ids.length > 0))"
305                             t-foreach="widget.partner_ids.slice(0, 3)" t-as="partner">
306                         <span t-attf-class="oe_partner_follower">
307                         <a t-if="widget.options.show_link" t-attf-href="#model=res.partner&amp;id=#{partner[0]}" t-att-data-partner="partner[0]" class="oe_mail_action_author"><t t-esc="partner[1]"/></a>
308                         <t t-if="!widget.options.show_link" t-esc="partner[1]"/>
309                         </span>
310                         <t t-if="!partner_last">,</t>
311                     </t>
312                     <t t-if="widget.partner_ids.length > 3">
313                         <span t-att-title="widget.extra_partners_str">and <t t-esc="widget.extra_partners_nbr"/> more</span>
314                     </t>
315                     <t t-if="widget.type == 'notification' and widget.partner_ids.length > 0">
316                         notified
317                     </t>
318                     <span class='oe_subtle'>•</span>
319                     <span t-att-title="widget.date">
320                         <t t-if="widget.timerelative" t-esc="widget.timerelative"/>
321                         <t t-if="!widget.timerelative" t-raw="widget.display_date"/>
322                     </span>
323                     <span t-if="!widget.options.readonly" class='oe_subtle'>•</span>
324                     <t t-if="!widget.options.readonly" t-call="mail.thread.message.vote"/>
325                 </div>
326             </div>
327         </div>
328     </t>
329
330     <!-- expandable message layout -->
331     <t t-name="mail.thread.expandable">
332         <div t-attf-class="oe_msg oe_msg_#{widget.type} #{widget.max_limit ? 'oe_max_limit' : ''} #{widget.thread_level and widget.options.display_indented_thread > -1 ? 'oe_msg_indented' : ''}">
333             <div class="oe_msg_content oe_msg_more_message">
334                 <div class='oe_separator'></div>
335                 <a t-if="widget.nb_messages &lt;= 0" class="oe_msg_fetch_more">show more message</a>
336                 <a t-if="widget.nb_messages === 1" class="oe_msg_fetch_more">show one more message</a>
337                 <a t-if="widget.nb_messages &gt; 1" class="oe_msg_fetch_more">show <t t-esc="widget.nb_messages" /> more messages</a>
338             </div>
339         </div>
340     </t>
341
342     <!--
343         mail.compose_message.button_top_bar
344         render of the button on the user bar for open wizard compose message
345         -->
346     <t t-name="mail.ComposeMessageTopButton">
347         <div title='Compose new Message' class="oe_topbar_item oe_topbar_compose_full_email">
348             <button class="oe_e">%</button>
349         </div>
350     </t>
351
352     <!-- mail.thread.message.vote
353         Template used to display Like/Unlike in a mail.message
354     -->
355     <span t-name="mail.thread.message.vote">
356         <span class="oe_mail_vote_count" t-if='widget.vote_nb > 0'>
357             <t t-esc='widget.vote_nb' />
358             <i class="fa fa-thumbs-o-up"></i>
359         </span>
360         <a href='#' class="oe_msg_vote">
361             <t t-if="!widget.has_voted">like</t>
362             <t t-if="widget.has_voted">unlike</t>
363         </a>
364     </span>
365
366 </template>