diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_image_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_image_view.coffee new file mode 100644 index 000000000..fc4223d14 --- /dev/null +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_image_view.coffee @@ -0,0 +1,19 @@ +class App.TicketZoomArticleImageView extends App.ControllerModal + buttonClose: true + buttonCancel: true + buttonSubmit: 'Download' + buttonClass: 'btn--success' + head: '' + large: true + + events: + 'submit form': 'submit' + 'click .js-cancel': 'cancel' + 'click .js-close': 'cancel' + + content: -> + "
#{@image}
" + + onSubmit: => + url = "#{$(@image).attr('src')}?disposition=attachment" + window.open(url, '_blank') diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee index 31163a60e..84ffe5d2f 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee @@ -50,9 +50,10 @@ class ArticleViewItem extends App.ObserverController '.textBubble-overflowContainer': 'textBubbleOverflowContainer' events: - 'click .textBubble': 'toggleMetaWithDelay' - 'click .textBubble a': 'stopPropagation' - 'click .js-toggleFold': 'toggleFold' + 'click .textBubble': 'toggleMetaWithDelay' + 'click .textBubble a': 'stopPropagation' + 'click .js-toggleFold': 'toggleFold' + 'click .richtext-content img': 'imageView' constructor: -> super @@ -367,3 +368,8 @@ class ArticleViewItem extends App.ObserverController remove: => @el.remove() + + imageView: (e) -> + e.preventDefault() + e.stopPropagation() + new App.TicketZoomArticleImageView(image: $(e.target).get(0).outerHTML) diff --git a/app/assets/javascripts/app/views/modal.jst.eco b/app/assets/javascripts/app/views/modal.jst.eco index b3d12f4b8..840f2c27e 100644 --- a/app/assets/javascripts/app/views/modal.jst.eco +++ b/app/assets/javascripts/app/views/modal.jst.eco @@ -7,7 +7,9 @@ <%- @Icon('diagonal-cross') %> <% end %> + <% if @head: %>

<% if @headPrefix: %><%- @T(@headPrefix) %>: <% end %><%- @T(@head) %>

+ <% end %>