From 4d1f55ee6b2e9de5ee32b0fe1c166f4aeb20e837 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 17 Jan 2015 16:30:49 +0100 Subject: [PATCH] Implemented "see more" feature. --- .../app/controllers/layout_ref.js.coffee | 12 +++++ .../app/controllers/ticket_zoom.js.coffee | 46 ++++++++++++++++--- .../layout_ref/communication_overview.jst.eco | 39 ++++++++++------ .../views/ticket_zoom/article_view.jst.eco | 5 ++ 4 files changed, 80 insertions(+), 22 deletions(-) diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index ce1433073..9ff018978 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -138,6 +138,18 @@ class CommunicationOverview extends App.ControllerContent render: -> @html App.view('layout_ref/communication_overview')() + # set see more options + previewHeight = 240 + @$('.textBubble-content').each( (index) -> + bubble = $( @ ) + heigth = bubble.height() + if heigth > (previewHeight + 30) + bubble.attr('data-height', heigth) + bubble.css('height', "#{previewHeight}px") + else + bubble.parent().find('.textBubble-overflowContainer').addClass('hide') + ) + App.Config.set( 'layout_ref/communication_overview', CommunicationOverview, 'Routes' ) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index ce0a8bd97..671edc330 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -440,6 +440,18 @@ class App.TicketZoom extends App.Controller ui: @ ) + # set see more options + previewHeight = 240 + @$('.textBubble-content').each( (index) -> + bubble = $( @ ) + heigth = bubble.height() + if heigth > (previewHeight + 30) + bubble.attr('data-height', heigth) + bubble.css('height', "#{previewHeight}px") + else + bubble.parent().find('.textBubble-overflowContainer').addClass('hide') + ) + # scroll to article if given if @article_id && document.getElementById( 'article-' + @article_id ) offset = document.getElementById( 'article-' + @article_id ).offsetTop @@ -1278,13 +1290,14 @@ class Edit extends App.Controller class ArticleView extends App.Controller events: - 'click [data-type=public]': 'public_internal' - 'click [data-type=internal]': 'public_internal' - 'click .show_toogle': 'show_toogle' - 'click [data-type=reply]': 'reply' - 'click [data-type=replyAll]': 'replyAll' - 'click .textBubble': 'toggle_meta_with_delay' - 'click .textBubble a': 'stopPropagation' + 'click [data-type=public]': 'public_internal' + 'click [data-type=internal]': 'public_internal' + 'click .show_toogle': 'show_toogle' + 'click [data-type=reply]': 'reply' + 'click [data-type=replyAll]': 'replyAll' + 'click .textBubble': 'toggle_meta_with_delay' + 'click .textBubble a': 'stopPropagation' + 'click .js-unfold': 'unfold' constructor: -> super @@ -1434,6 +1447,25 @@ class ArticleView extends App.Controller metaTopClip.velocity({ height: metaTop.outerHeight() }, animSpeed, 'easeOutQuad') metaBottomClip.velocity({ height: metaBottom.outerHeight() }, animSpeed, 'easeOutQuad') + unfold: (e) -> + e.preventDefault() + e.stopPropagation() + container = $(e.currentTarget).parents('.textBubble-content') + overflowContainer = container.find('.textBubble-overflowContainer') + + overflowContainer.velocity + properties: + opacity: 0 + options: + duration: 300 + + container.velocity + properties: + height: container.attr('data-height') + options: + duration: 300 + complete: -> overflowContainer.addClass('hide'); + isOrContains: (node, container) -> while node if node is container diff --git a/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco index 0dab231b9..3803f941d 100644 --- a/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/communication_overview.jst.eco @@ -58,17 +58,24 @@
NB
-
Welcome! - -Thank you for installing Zammad. - -You will find updates and patches at http://zammad.org/. Online -documentation is available at http://guides.zammad.org/. You can also -use our forums at http://forums.zammad.org/ - -Regards, -See more
-The Zammad.org Project
+
+
+
+Welcome! +
+Thank you for installing Zammad.
+
+You will find updates and patches at http://zammad.org/. Online
+documentation is available at http://guides.zammad.org/. You can also
+use our forums at http://forums.zammad.org/
+
+Regards,
+The Zammad.org Project +
+
<%- @T('See more') %>
+
+
+
@@ -196,8 +203,9 @@ Grüße, Peter
-
-
Lieber HP,
+
+
+
Lieber HP,
anbei findest du die Midi Noten für Maria Maria "I Like it Loud".
Wünsche dir einen guten Auftritt in Hamburg.

@@ -217,7 +225,7 @@ Bin verheiratet, hab Kind. Is doch offensichtlich, Junge!
Alles gute,
Oliver
-
See More
+
<%- @T('See more') %>
@@ -231,7 +239,8 @@ Oliver
lyrics_I_Like_it_Loud.txt
17.1kb
-
+
+
diff --git a/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco b/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco index 723db1630..bbd619500 100644 --- a/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco @@ -44,7 +44,12 @@
+
<%- article.html %> +
+
<%- @T('See more') %>
+
+
<% if !_.isEmpty( article.attachments ): %>