Added caching of tickets.
This commit is contained in:
parent
ca73a740b6
commit
2e9a94c8be
1 changed files with 27 additions and 19 deletions
|
@ -23,9 +23,13 @@ class Index extends App.Controller
|
||||||
@navupdate '#'
|
@navupdate '#'
|
||||||
|
|
||||||
@edit_form = undefined
|
@edit_form = undefined
|
||||||
# @render()
|
|
||||||
@ticket_id = params.ticket_id
|
@ticket_id = params.ticket_id
|
||||||
@article_id = params.article_id
|
@article_id = params.article_id
|
||||||
|
|
||||||
|
@key = 'ticket::' + @ticket_id
|
||||||
|
cache = App.Store.get( @key )
|
||||||
|
if cache
|
||||||
|
@load(cache)
|
||||||
@fetch(@ticket_id)
|
@fetch(@ticket_id)
|
||||||
|
|
||||||
fetch: (ticket_id) ->
|
fetch: (ticket_id) ->
|
||||||
|
@ -40,6 +44,11 @@ class Index extends App.Controller
|
||||||
}
|
}
|
||||||
processData: true,
|
processData: true,
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
@load(data)
|
||||||
|
App.Store.write( @key, data )
|
||||||
|
)
|
||||||
|
|
||||||
|
load: (data) =>
|
||||||
# reset old indexes
|
# reset old indexes
|
||||||
@ticket = undefined
|
@ticket = undefined
|
||||||
@articles = undefined
|
@articles = undefined
|
||||||
|
@ -58,7 +67,6 @@ class Index extends App.Controller
|
||||||
|
|
||||||
# render page
|
# render page
|
||||||
@render()
|
@render()
|
||||||
)
|
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue