Fixed changing shown columns.

This commit is contained in:
Martin Edenhofer 2015-03-02 08:16:34 +01:00
parent 309369090b
commit 2269ef8e4e
2 changed files with 16 additions and 12 deletions

View file

@ -98,6 +98,10 @@ class Table extends App.Controller
@bind 'ticket_overview_fetch_force', => @bind 'ticket_overview_fetch_force', =>
@fetch() @fetch()
# force fetch ticket overview
@bind 'ticket_overview_local', =>
@render(true)
update: (params) => update: (params) =>
for key, value of params for key, value of params
@[key] = value @[key] = value
@ -144,16 +148,18 @@ class Table extends App.Controller
return data return data
false false
render: => render: (overview_changed = false) =>
#console.log('RENDER', @cache, @view) #console.log('RENDER', @cache, @view)
return if !@cache return if !@cache
return if !@cache[@view] return if !@cache[@view]
# use cache
overview = @cache[@view].overview overview = @cache[@view].overview
tickets_count = @cache[@view].tickets_count tickets_count = @cache[@view].tickets_count
ticket_ids = @cache[@view].ticket_ids ticket_ids = @cache[@view].ticket_ids
# get meta data # use cache if no local change
if !overview_changed
App.Overview.refresh( overview, { clear: true } ) App.Overview.refresh( overview, { clear: true } )
# get ticket list # get ticket list
@ -505,7 +511,6 @@ class Table extends App.Controller
overview_id: @overview.id overview_id: @overview.id
view_mode: @view_mode view_mode: @view_mode
container: @el.closest('.content') container: @el.closest('.content')
callback: @render,
) )
class App.OverviewSettings extends App.ControllerModal class App.OverviewSettings extends App.ControllerModal
@ -696,18 +701,18 @@ class App.OverviewSettings extends App.ControllerModal
@overview.group_by = params.group_by @overview.group_by = params.group_by
# rerender overview
if !@reload_needed
@callback()
@overview.save( @overview.save(
done: => done: =>
# fetch overview data again # fetch overview data again
if @reload_needed if @reload_needed
App.Event.trigger('ticket_overview_fetch_force') App.Event.trigger('ticket_overview_fetch_force')
) else
App.Event.trigger('ticket_overview_local')
# hide modal
@hide() @hide()
)
class Navbar extends App.Controller class Navbar extends App.Controller
constructor: -> constructor: ->

View file

@ -74,7 +74,6 @@ class AgentTicketOverviewLevel0Test < TestCase
# remember current overview count # remember current overview count
overview_counter_before = overview_counter() overview_counter_before = overview_counter()
# click options and enable number and article count # click options and enable number and article count
click( :css => '.active [data-type="settings"]' ) click( :css => '.active [data-type="settings"]' )
@ -101,7 +100,7 @@ class AgentTicketOverviewLevel0Test < TestCase
:css => '.modal input[value="article_count"]', :css => '.modal input[value="article_count"]',
) )
click( :css => '.modal .js-submit' ) click( :css => '.modal .js-submit' )
sleep 10 sleep 4
# check if number and article count is shown # check if number and article count is shown
match( match(
@ -141,7 +140,7 @@ class AgentTicketOverviewLevel0Test < TestCase
:css => '.modal input[value="article_count"]', :css => '.modal input[value="article_count"]',
) )
click( :css => '.modal .js-submit' ) click( :css => '.modal .js-submit' )
sleep 2 sleep 4
# check if number and article count is gone # check if number and article count is gone
match_not( match_not(