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
|
else
|
||||||
@el.removeClass('is-internal')
|
@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
|
# prepare html body
|
||||||
if article.content_type is 'text/html'
|
if article.content_type is 'text/html'
|
||||||
body = article.body
|
body = article.body
|
||||||
|
@ -152,22 +172,12 @@ class ArticleViewItem extends App.ObserverController
|
||||||
article['html'] = App.Utils.text2html(body)
|
article['html'] = App.Utils.text2html(body)
|
||||||
article['html'] = article['html'].replace(signatureDetected, '<span class="js-signatureMarker"></span>')
|
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
|
if article.preferences.delivery_message
|
||||||
@html App.view('ticket_zoom/article_view_delivery_failed')(
|
@html App.view('ticket_zoom/article_view_delivery_failed')(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
article: article
|
article: article
|
||||||
isCustomer: @permissionCheck('ticket.customer')
|
attachments: attachments
|
||||||
|
links: links
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
if article.sender.name is 'System'
|
if article.sender.name is 'System'
|
||||||
|
@ -175,13 +185,15 @@ class ArticleViewItem extends App.ObserverController
|
||||||
@html App.view('ticket_zoom/article_view_system')(
|
@html App.view('ticket_zoom/article_view_system')(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
article: article
|
article: article
|
||||||
isCustomer: @permissionCheck('ticket.customer')
|
attachments: attachments
|
||||||
|
links: links
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
@html App.view('ticket_zoom/article_view')(
|
@html App.view('ticket_zoom/article_view')(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
article: article
|
article: article
|
||||||
isCustomer: @permissionCheck('ticket.customer')
|
attachments: attachments
|
||||||
|
links: links
|
||||||
)
|
)
|
||||||
|
|
||||||
new App.WidgetAvatar(
|
new App.WidgetAvatar(
|
||||||
|
|
|
@ -19,8 +19,9 @@ class SidebarArticleAttachments extends App.Controller
|
||||||
html = ''
|
html = ''
|
||||||
for ticket_article_id, index in @ticket.article_ids
|
for ticket_article_id, index in @ticket.article_ids
|
||||||
article = App.TicketArticle.find(ticket_article_id)
|
article = App.TicketArticle.find(ticket_article_id)
|
||||||
if article && article.attachments && !_.isEmpty(article.attachments)
|
attachments = App.TicketArticle.contentAttachments(article)
|
||||||
html = App.view('ticket_zoom/sidebar_article_attachment')(article: article) + html
|
if !_.isEmpty(attachments)
|
||||||
|
html = App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments) + html
|
||||||
@el.html(html)
|
@el.html(html)
|
||||||
@el.delegate('.js-attachments img', 'click', (e) =>
|
@el.delegate('.js-attachments img', 'click', (e) =>
|
||||||
@imageView(e)
|
@imageView(e)
|
||||||
|
|
|
@ -47,3 +47,11 @@ class App.TicketArticle extends App.Model
|
||||||
else if item.type is 'update'
|
else if item.type is 'update'
|
||||||
return App.i18n.translateContent('%s updated Article for |%s|', item.created_by.displayName(), item.title)
|
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."
|
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 class="btn btn--text js-toggleFold"><%- @T('See more') %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% if !_.isEmpty(@article.attachments): %>
|
<% if !_.isEmpty(@attachments): %>
|
||||||
<div class="attachments attachments--list">
|
<div class="attachments attachments--list">
|
||||||
<%- @Icon('paperclip') %>
|
<%- @Icon('paperclip') %>
|
||||||
<div class="attachments-title"><%- @article.attachments.length %> <%- @T('Attached Files') %></div>
|
<div class="attachments-title"><%- @attachments.length %> <%- @T('Attached Files') %></div>
|
||||||
<% for attachment in @article.attachments: %>
|
<% for attachment in @attachments: %>
|
||||||
<% if !@C('ui_ticket_zoom_attachments_preview'): %>
|
<% if !@C('ui_ticket_zoom_attachments_preview'): %>
|
||||||
<div class="attachment attachment--row">
|
<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>
|
<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">
|
<div class="article-meta-value">
|
||||||
<%- @Icon(@article.type.name, 'article-meta-icon') %>
|
<%- @Icon(@article.type.name, 'article-meta-icon') %>
|
||||||
<%- @T(@article.type.name) %>
|
<%- @T(@article.type.name) %>
|
||||||
<% if @article.preferences.links: %>
|
<% if @links: %>
|
||||||
<% for item in @article.preferences.links: %>
|
<% count = 0 %>
|
||||||
<a class="text-muted" href="<%- item.url %>" target="<%- item.target %>"><%- @T(item.name) %></a>
|
<% 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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -180,6 +180,7 @@ class Channel::EmailParser
|
||||||
filename = 'message.html'
|
filename = 'message.html'
|
||||||
headers_store = {
|
headers_store = {
|
||||||
'content-alternative' => true,
|
'content-alternative' => true,
|
||||||
|
'original-format' => true,
|
||||||
}
|
}
|
||||||
if mail.mime_type
|
if mail.mime_type
|
||||||
headers_store['Mime-Type'] = mail.html_part.mime_type
|
headers_store['Mime-Type'] = mail.html_part.mime_type
|
||||||
|
@ -225,6 +226,7 @@ class Channel::EmailParser
|
||||||
# add body as attachment
|
# add body as attachment
|
||||||
headers_store = {
|
headers_store = {
|
||||||
'content-alternative' => true,
|
'content-alternative' => true,
|
||||||
|
'original-format' => true,
|
||||||
}
|
}
|
||||||
if mail.mime_type
|
if mail.mime_type
|
||||||
headers_store['Mime-Type'] = mail.mime_type
|
headers_store['Mime-Type'] = mail.mime_type
|
||||||
|
|
Loading…
Reference in a new issue