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 .show_toogle': 'show_toogle'
'click [data-type=reply]': 'reply'
'click .more': 'more_toogle'
'click .text-bubble': 'more_toogle'
'click .close-details': 'more_toogle'
# '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')
show_toogle: (e) ->
e.stopPropagation()
e.preventDefault()
#$(e.target).hide()
if $(e.target).next('div')[0]
@ -647,16 +648,23 @@ class ArticleView extends App.Controller
more_toogle: (e) ->
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')
$(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('.article-meta.top').addClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.bottom').addClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-content-meta.bottom').addClass('hide')
articleMetaTop.addClass('hide')
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('.article-meta.top').removeClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-meta.bottom').removeClass('hide')
$(e.target).closest('.ticket-article-item').find('.article-content-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) =>

View file

@ -3,8 +3,6 @@
<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">
<% if 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>
<div class="article-content-meta">
<div class="article-meta bottom hide">
<div class="article-content-meta bottom hide">
<div class="article-meta bottom">
<div class="horizontal article-meta-row">
<div class="article-meta-key"><%- @T( 'Kanal' ) %></div>
<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) %>
<% if article.type.name is 'email': %>
<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>
<% if article.attachments: %>
<div class="always-shown">
<% for attachment in article.attachments: %>
@ -60,14 +57,17 @@
<% end %>
</div>
<% end %>
<% if article.actions: %>
<div class="article-actions horizontal stretch">
<% 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 %>
</div>
<% end %>
<div class="close-details hide"><%- @T('close details') %></div>
</div>
<small class="task-subline"><time class="humanTimeFromNow" datetime="<%- article.created_at %>" data-time="<%- article.created_at %>">?</time></small>