Init version of ticket zoom enhancements.

This commit is contained in:
Martin Edenhofer 2012-05-05 16:18:52 +02:00
parent 26419171e3
commit fbe5d1002f
3 changed files with 24 additions and 3 deletions

View file

@ -9,6 +9,7 @@ class Index extends App.Controller
'click [data-type=internal]': 'public_internal', 'click [data-type=internal]': 'public_internal',
'click [data-type=history]': 'history_view', 'click [data-type=history]': 'history_view',
'change [name="ticket_article_type_id"]': 'form_update', 'change [name="ticket_article_type_id"]': 'form_update',
'click .show_toogle': 'show_toogle',
constructor: (params) -> constructor: (params) ->
super super
@ -66,7 +67,16 @@ class Index extends App.Controller
if !@articles if !@articles
@articles = [] @articles = []
for article_id in @ticket.article_ids for article_id in @ticket.article_ids
@articles.push App.TicketArticle.find(article_id) article = App.TicketArticle.find(article_id)
# build html body
article['html'] = window.linkify( article.body.trim() )
notify = "<a href=\"#\" style=\"color:blue\" class=\"show_toogle\">" + T('See more') + "</a>"
article['html'] = article['html'].replace /--/m, (match) ->
notify + '<div class="hide">' + match
article['html'] = article['html'] + '</div>'
@articles.push article
# check attachments # check attachments
for article in @articles for article in @articles
@ -157,6 +167,11 @@ class Index extends App.Controller
debug: false debug: false
) )
show_toogle: (e) ->
e.preventDefault()
$(e.target).hide()
$(e.target).next('div').show()
history_view: (e) -> history_view: (e) ->
e.preventDefault() e.preventDefault()
new History( ticket_id: @ticket_id ) new History( ticket_id: @ticket_id )

View file

@ -53,7 +53,7 @@
</div> </div>
<% end %> <% end %>
<hr/> <hr/>
<div style="white-space:pre-wrap;"><%- window.linkify( article.body.trim() ) %></div> <div style="white-space:pre-wrap;" class="article-content"><%- article.html %></div>
</div> </div>
</div> </div>
<% end %> <% end %>

View file

@ -158,6 +158,12 @@ footer {
width: 602px; width: 602px;
} }
.show_toogle {
font-size: 10px;
line-height: 12px;
color: #999999;
}
.well-muted { .well-muted {
background-color: whiteSmoke; background-color: whiteSmoke;
border: 1px solid #eee; border: 1px solid #eee;