UI improvement: Show only real attachments in attachment list. Move original formatted message into footer of article (beside donwload raw message).
This commit is contained in:
parent
2ecc60f22a
commit
d830f0eb2d
5 changed files with 54 additions and 28 deletions
|
@ -118,6 +118,26 @@ class ArticleViewItem extends App.ObserverController
|
|||
else
|
||||
@el.removeClass('is-internal')
|
||||
|
||||
# check if email link need to be updated
|
||||
links = clone(article.preferences.links) || []
|
||||
if article.type.name is 'email'
|
||||
link =
|
||||
name: 'Raw'
|
||||
url: "#{@Config.get('api_path')}/ticket_article_plain/#{article.id}"
|
||||
target: '_blank'
|
||||
links.push link
|
||||
|
||||
# attachments prepare
|
||||
attachments = App.TicketArticle.contentAttachments(article)
|
||||
if article.attachments
|
||||
for attachment in article.attachments
|
||||
if attachment && attachment.preferences && attachment.preferences['original-format'] is true
|
||||
link =
|
||||
url: "#{App.Config.get('api_path')}/ticket_attachment/#{article.ticket_id}/#{article.id}/#{attachment.id}?disposition=attachment"
|
||||
name: 'Original Formatting'
|
||||
target: '_blank'
|
||||
links.push link
|
||||
|
||||
# prepare html body
|
||||
if article.content_type is 'text/html'
|
||||
body = article.body
|
||||
|
@ -152,22 +172,12 @@ class ArticleViewItem extends App.ObserverController
|
|||
article['html'] = App.Utils.text2html(body)
|
||||
article['html'] = article['html'].replace(signatureDetected, '<span class="js-signatureMarker"></span>')
|
||||
|
||||
# check if email link need to be updated
|
||||
if article.type.name is 'email'
|
||||
if !article.preferences.links
|
||||
article.preferences.links = [
|
||||
{
|
||||
name: 'Raw'
|
||||
url: "#{@Config.get('api_path')}/ticket_article_plain/#{article.id}"
|
||||
target: '_blank'
|
||||
}
|
||||
]
|
||||
|
||||
if article.preferences.delivery_message
|
||||
@html App.view('ticket_zoom/article_view_delivery_failed')(
|
||||
ticket: @ticket
|
||||
article: article
|
||||
isCustomer: @permissionCheck('ticket.customer')
|
||||
attachments: attachments
|
||||
links: links
|
||||
)
|
||||
return
|
||||
if article.sender.name is 'System'
|
||||
|
@ -175,13 +185,15 @@ class ArticleViewItem extends App.ObserverController
|
|||
@html App.view('ticket_zoom/article_view_system')(
|
||||
ticket: @ticket
|
||||
article: article
|
||||
isCustomer: @permissionCheck('ticket.customer')
|
||||
attachments: attachments
|
||||
links: links
|
||||
)
|
||||
return
|
||||
@html App.view('ticket_zoom/article_view')(
|
||||
ticket: @ticket
|
||||
article: article
|
||||
isCustomer: @permissionCheck('ticket.customer')
|
||||
attachments: attachments
|
||||
links: links
|
||||
)
|
||||
|
||||
new App.WidgetAvatar(
|
||||
|
|
|
@ -19,8 +19,9 @@ class SidebarArticleAttachments extends App.Controller
|
|||
html = ''
|
||||
for ticket_article_id, index in @ticket.article_ids
|
||||
article = App.TicketArticle.find(ticket_article_id)
|
||||
if article && article.attachments && !_.isEmpty(article.attachments)
|
||||
html = App.view('ticket_zoom/sidebar_article_attachment')(article: article) + html
|
||||
attachments = App.TicketArticle.contentAttachments(article)
|
||||
if !_.isEmpty(attachments)
|
||||
html = App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments) + html
|
||||
@el.html(html)
|
||||
@el.delegate('.js-attachments img', 'click', (e) =>
|
||||
@imageView(e)
|
||||
|
|
|
@ -47,3 +47,11 @@ class App.TicketArticle extends App.Model
|
|||
else if item.type is 'update'
|
||||
return App.i18n.translateContent('%s updated Article for |%s|', item.created_by.displayName(), item.title)
|
||||
return "Unknow action for (#{@objectDisplayName()}/#{item.type}), extend activityMessage() of model."
|
||||
|
||||
@contentAttachments: (article) ->
|
||||
return [] if !article.attachments
|
||||
attachments = []
|
||||
for attachment in article.attachments
|
||||
if attachment && (!attachment.preferences || attachment.preferences && attachment.preferences['original-format'] isnt true)
|
||||
attachments.push attachment
|
||||
attachments
|
||||
|
|
|
@ -51,11 +51,11 @@
|
|||
<div class="btn btn--text js-toggleFold"><%- @T('See more') %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% if !_.isEmpty(@article.attachments): %>
|
||||
<% if !_.isEmpty(@attachments): %>
|
||||
<div class="attachments attachments--list">
|
||||
<%- @Icon('paperclip') %>
|
||||
<div class="attachments-title"><%- @article.attachments.length %> <%- @T('Attached Files') %></div>
|
||||
<% for attachment in @article.attachments: %>
|
||||
<div class="attachments-title"><%- @attachments.length %> <%- @T('Attached Files') %></div>
|
||||
<% for attachment in @attachments: %>
|
||||
<% if !@C('ui_ticket_zoom_attachments_preview'): %>
|
||||
<div class="attachment attachment--row">
|
||||
<a class="attachment-name u-highlight" href="<%= App.Config.get('api_path') %>/ticket_attachment/<%= @article.ticket_id %>/<%= @article.id %>/<%= attachment.id %>?disposition=attachment" target="_blank" data-type="attachment"><%= attachment.filename %></a>
|
||||
|
@ -93,9 +93,12 @@
|
|||
<div class="article-meta-value">
|
||||
<%- @Icon(@article.type.name, 'article-meta-icon') %>
|
||||
<%- @T(@article.type.name) %>
|
||||
<% if @article.preferences.links: %>
|
||||
<% for item in @article.preferences.links: %>
|
||||
<a class="text-muted" href="<%- item.url %>" target="<%- item.target %>"><%- @T(item.name) %></a>
|
||||
<% if @links: %>
|
||||
<% count = 0 %>
|
||||
<% for link in @links: %>
|
||||
<% if count > 0: %>|<% end %>
|
||||
<a class="text-muted" href="<%- link.url %>" target="<%- link.target %>"><%- @T(link.name) %></a>
|
||||
<% count =+ 1 %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -180,6 +180,7 @@ class Channel::EmailParser
|
|||
filename = 'message.html'
|
||||
headers_store = {
|
||||
'content-alternative' => true,
|
||||
'original-format' => true,
|
||||
}
|
||||
if mail.mime_type
|
||||
headers_store['Mime-Type'] = mail.html_part.mime_type
|
||||
|
@ -225,6 +226,7 @@ class Channel::EmailParser
|
|||
# add body as attachment
|
||||
headers_store = {
|
||||
'content-alternative' => true,
|
||||
'original-format' => true,
|
||||
}
|
||||
if mail.mime_type
|
||||
headers_store['Mime-Type'] = mail.mime_type
|
||||
|
|
Loading…
Reference in a new issue