toogle article on click

This commit is contained in:
Felix Niklas 2014-08-26 16:38:08 +02:00
parent 98ebb20692
commit f136462059
2 changed files with 23 additions and 15 deletions

View file

@ -583,7 +583,7 @@ class ArticleView extends App.Controller
'click [data-type=internal]': 'public_internal' 'click [data-type=internal]': 'public_internal'
'click .show_toogle': 'show_toogle' 'click .show_toogle': 'show_toogle'
'click [data-type=reply]': 'reply' 'click [data-type=reply]': 'reply'
'click .more': 'more_toogle' 'click .text-bubble': 'more_toogle'
'click .close-details': 'more_toogle' 'click .close-details': 'more_toogle'
# 'click [data-type=reply-all]': 'replyall' # 'click [data-type=reply-all]': 'replyall'
@ -635,6 +635,7 @@ class ArticleView extends App.Controller
$(e.target).closest('.ticket-article-item').find('.text-bubble').removeClass('internal') $(e.target).closest('.ticket-article-item').find('.text-bubble').removeClass('internal')
show_toogle: (e) -> show_toogle: (e) ->
e.stopPropagation()
e.preventDefault() e.preventDefault()
#$(e.target).hide() #$(e.target).hide()
if $(e.target).next('div')[0] if $(e.target).next('div')[0]
@ -647,16 +648,23 @@ class ArticleView extends App.Controller
more_toogle: (e) -> more_toogle: (e) ->
e.preventDefault() e.preventDefault()
articleMetaTop = $(e.target).closest('.ticket-article-item').find('.article-meta.top')
if !$(e.target).closest('.ticket-article-item').find('.article-meta.top').hasClass('hide') if !$(e.target).closest('.ticket-article-item').find('.article-meta.top').hasClass('hide')
$(e.target).closest('.ticket-article-item').find('.more').removeClass('hide') # scroll back up
articleMetaTop.scrollParent().scrollTop( articleMetaTop.scrollParent().scrollTop() - 2* articleMetaTop.outerHeight() )
$(e.target).closest('.ticket-article-item').removeClass('state--folde-out')
$(e.target).closest('.ticket-article-item').find('.close-details').addClass('hide') $(e.target).closest('.ticket-article-item').find('.close-details').addClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.top').addClass('hide') $(e.target).closest('.ticket-article-item').find('.article-content-meta.bottom').addClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.bottom').addClass('hide') articleMetaTop.addClass('hide')
else else
$(e.target).closest('.ticket-article-item').find('.more').addClass('hide') $(e.target).closest('.ticket-article-item').addClass('state--folde-out')
$(e.target).closest('.ticket-article-item').find('.close-details').removeClass('hide') $(e.target).closest('.ticket-article-item').find('.close-details').removeClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.top').removeClass('hide') $(e.target).closest('.ticket-article-item').find('.article-content-meta.bottom').removeClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.bottom').removeClass('hide') articleMetaTop.removeClass('hide')
# balance out the top meta height by scrolling down
articleMetaTop.scrollParent().scrollTop( articleMetaTop.scrollParent().scrollTop() + articleMetaTop.outerHeight() )
checkIfSignatureIsNeeded: (type) => checkIfSignatureIsNeeded: (type) =>

View file

@ -3,8 +3,6 @@
<div class="article-content-meta"> <div class="article-content-meta">
<div class="more"><%- @T('more') %></div>
<div class="close-details hide"><%- @T('close details') %></div>
<div class="article-meta top hide"> <div class="article-meta top hide">
<% if article.from: %> <% if article.from: %>
<div class="horizontal article-meta-row" title="<%- @Ti( 'From' ) %>: <%= article.from %>"> <div class="horizontal article-meta-row" title="<%- @Ti( 'From' ) %>: <%= article.from %>">
@ -39,12 +37,12 @@
<div class="flex text-bubble <%= ' internal' if article.internal is true %>"><div class="bubble-arrow"></div><%- article.html %></div> <div class="flex text-bubble <%= ' internal' if article.internal is true %>"><div class="bubble-arrow"></div><%- article.html %></div>
</div> </div>
<div class="article-content-meta"> <div class="article-content-meta bottom hide">
<div class="article-meta bottom hide"> <div class="article-meta bottom">
<div class="horizontal article-meta-row"> <div class="horizontal article-meta-row">
<div class="article-meta-key"><%- @T( 'Kanal' ) %></div> <div class="article-meta-key"><%- @T( 'Kanal' ) %></div>
<div class="article-meta-value"> <div class="article-meta-value">
<span class="icon <%- article.type.name %> channel"></span> <span class="white <%- article.type.name %> channel icon"></span>
<%- @T(article.type.name) %> <%- @T(article.type.name) %>
<% if article.type.name is 'email': %> <% if article.type.name is 'email': %>
<a class="text-muted" href="<%= App.Config.get('api_path') %>/ticket_article_plain/<%= article.id %>"><%- @T( 'raw' ) %></a> <a class="text-muted" href="<%= App.Config.get('api_path') %>/ticket_article_plain/<%= article.id %>"><%- @T( 'raw' ) %></a>
@ -52,7 +50,6 @@
</div> </div>
</div> </div>
</div> </div>
<% if article.attachments: %> <% if article.attachments: %>
<div class="always-shown"> <div class="always-shown">
<% for attachment in article.attachments: %> <% for attachment in article.attachments: %>
@ -64,10 +61,13 @@
<% if article.actions: %> <% if article.actions: %>
<div class="article-actions horizontal stretch"> <div class="article-actions horizontal stretch">
<% for action in article.actions: %> <% for action in article.actions: %>
<a href="<%= action.href %>" data-type="<%= action.type %>" class="<% if action.class: %><%= action.class %><% end %>"><%- @T( action.name ) %></a> <a href="<%= action.href %>" data-type="<%= action.type %>" class="article-action<% if action.class: %> <%= action.class %><% end %>">
<span class="<%= action.type %> icon"></span><%- @T( action.name ) %>
</a>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="close-details hide"><%- @T('close details') %></div>
</div> </div>
<small class="task-subline"><time class="humanTimeFromNow" datetime="<%- article.created_at %>" data-time="<%- article.created_at %>">?</time></small> <small class="task-subline"><time class="humanTimeFromNow" datetime="<%- article.created_at %>" data-time="<%- article.created_at %>">?</time></small>