Improved loading content performance (reduced count of http requests).
This commit is contained in:
parent
8ba9cc98e9
commit
12fc2adc3e
5 changed files with 48 additions and 3 deletions
|
@ -110,6 +110,12 @@ class App.TicketZoom extends App.Controller
|
||||||
# remember article ids
|
# remember article ids
|
||||||
@ticket_article_ids = data.ticket_article_ids
|
@ticket_article_ids = data.ticket_article_ids
|
||||||
|
|
||||||
|
# remember link
|
||||||
|
@links = data.links
|
||||||
|
|
||||||
|
# remember tags
|
||||||
|
@tags = data.tags
|
||||||
|
|
||||||
# get edit form attributes
|
# get edit form attributes
|
||||||
@form_meta = data.form_meta
|
@form_meta = data.form_meta
|
||||||
|
|
||||||
|
@ -263,7 +269,8 @@ class TicketInfo extends App.ControllerDrox
|
||||||
new App.WidgetTag(
|
new App.WidgetTag(
|
||||||
el: @el.find('.tag_info')
|
el: @el.find('.tag_info')
|
||||||
object_type: 'Ticket'
|
object_type: 'Ticket'
|
||||||
object: ticket
|
object: ticket
|
||||||
|
tags: @tags
|
||||||
)
|
)
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
|
@ -283,6 +290,7 @@ class Widgets extends App.Controller
|
||||||
new TicketInfo(
|
new TicketInfo(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
el: @el.find('.ticket_info')
|
el: @el.find('.ticket_info')
|
||||||
|
tags: @ui.tags
|
||||||
)
|
)
|
||||||
|
|
||||||
# start customer info controller
|
# start customer info controller
|
||||||
|
@ -299,6 +307,7 @@ class Widgets extends App.Controller
|
||||||
el: @el.find('.link_info')
|
el: @el.find('.link_info')
|
||||||
object_type: 'Ticket'
|
object_type: 'Ticket'
|
||||||
object: ticket
|
object: ticket
|
||||||
|
links: @ui.links
|
||||||
)
|
)
|
||||||
|
|
||||||
# show frontend times
|
# show frontend times
|
||||||
|
|
|
@ -6,7 +6,12 @@ class App.WidgetLink extends App.ControllerDrox
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
@fetch()
|
|
||||||
|
# if links are given, do not init fetch
|
||||||
|
if @links
|
||||||
|
@render()
|
||||||
|
else
|
||||||
|
@fetch()
|
||||||
|
|
||||||
fetch: =>
|
fetch: =>
|
||||||
# fetch item on demand
|
# fetch item on demand
|
||||||
|
|
|
@ -3,6 +3,11 @@ class App.WidgetTag extends App.Controller
|
||||||
super
|
super
|
||||||
|
|
||||||
@attribute_id = 'tags_' + @object.id + '_' + @object_type
|
@attribute_id = 'tags_' + @object.id + '_' + @object_type
|
||||||
|
|
||||||
|
if @tags
|
||||||
|
@render(@tags)
|
||||||
|
return
|
||||||
|
|
||||||
tags = App.Store.get( "tags::#{@attribute_id}" )
|
tags = App.Store.get( "tags::#{@attribute_id}" )
|
||||||
if tags
|
if tags
|
||||||
@render( tags )
|
@render( tags )
|
||||||
|
|
|
@ -162,6 +162,7 @@ class App.Model extends Spine.Model
|
||||||
attribute[item] = value
|
attribute[item] = value
|
||||||
attributesNew[ attribute.name ] = attribute
|
attributesNew[ attribute.name ] = attribute
|
||||||
|
|
||||||
|
# if no screen is given or no attribute has this screen - use default attributes
|
||||||
if !screen || _.isEmpty( attributesNew )
|
if !screen || _.isEmpty( attributesNew )
|
||||||
console.log(attributesNew)
|
console.log(attributesNew)
|
||||||
for attribute in attributes
|
for attribute in attributes
|
||||||
|
@ -327,8 +328,11 @@ class App.Model extends Spine.Model
|
||||||
# fetch init collection
|
# fetch init collection
|
||||||
if param.initFetch is true
|
if param.initFetch is true
|
||||||
@one 'refresh', (collection) =>
|
@one 'refresh', (collection) =>
|
||||||
|
@initFetchActive = false
|
||||||
callback(collection)
|
callback(collection)
|
||||||
@fetch( {}, { clear: true } )
|
if !@initFetchActive
|
||||||
|
@initFetchActive = true
|
||||||
|
@fetch( {}, { clear: true } )
|
||||||
|
|
||||||
# return key
|
# return key
|
||||||
key
|
key
|
||||||
|
|
|
@ -279,12 +279,34 @@ class TicketsController < ApplicationController
|
||||||
assets = article.assets(assets)
|
assets = article.assets(assets)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get links
|
||||||
|
links = Link.list(
|
||||||
|
:link_object => 'Ticket',
|
||||||
|
:link_object_value => ticket.id,
|
||||||
|
)
|
||||||
|
link_list = []
|
||||||
|
links.each { |item|
|
||||||
|
link_list.push item
|
||||||
|
if item['link_object'] == 'Ticket'
|
||||||
|
ticket = Ticket.lookup( :id => item['link_object_value'] )
|
||||||
|
assets = ticket.assets(assets)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
# get tags
|
||||||
|
tags = Tag.tag_list(
|
||||||
|
:object => 'Ticket',
|
||||||
|
:o_id => ticket.id,
|
||||||
|
)
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render :json => {
|
render :json => {
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_ids => article_ids,
|
:ticket_article_ids => article_ids,
|
||||||
:signature => signature,
|
:signature => signature,
|
||||||
:assets => assets,
|
:assets => assets,
|
||||||
|
:links => link_list,
|
||||||
|
:tags => tags,
|
||||||
:form_meta => attributes_to_change,
|
:form_meta => attributes_to_change,
|
||||||
:edit_form => attributes_to_change,
|
:edit_form => attributes_to_change,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue