Fixed ref problem, did break overview conditions.
This commit is contained in:
parent
5ac3ad8b8b
commit
21654d677c
1 changed files with 18 additions and 9 deletions
|
@ -6,21 +6,30 @@ class TicketOverviewsController < ApplicationController
|
||||||
def show
|
def show
|
||||||
|
|
||||||
# build up attributes hash
|
# build up attributes hash
|
||||||
overview_selected = nil
|
overview_selected = nil
|
||||||
overviews = Overview.all
|
overview_selected_raw = nil
|
||||||
|
overviews = Overview.all
|
||||||
overviews.each { |overview|
|
overviews.each { |overview|
|
||||||
|
|
||||||
|
# for cleanup reasons, remove me later!
|
||||||
|
overview.condition.each { |item, value |
|
||||||
|
if item == 'owner_id'
|
||||||
|
overview.condition[item] = 'current_user.id'
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
# remember selected view
|
||||||
|
if params[:view] && params[:view] == overview.meta[:url]
|
||||||
|
overview_selected = overview
|
||||||
|
overview_selected_raw = Marshal.load( Marshal.dump(overview.attributes) )
|
||||||
|
end
|
||||||
|
|
||||||
# replace 'current_user.id' with current_user.id
|
# replace 'current_user.id' with current_user.id
|
||||||
overview.condition.each { |item, value |
|
overview.condition.each { |item, value |
|
||||||
if value == 'current_user.id'
|
if value == 'current_user.id'
|
||||||
overview.condition[item] = current_user.id
|
overview.condition[item] = current_user.id
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# remember selected view
|
|
||||||
if params[:view] && params[:view] == overview.meta[:url]
|
|
||||||
overview_selected = overview
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# sortby
|
# sortby
|
||||||
|
@ -108,7 +117,7 @@ class TicketOverviewsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render :json => {
|
render :json => {
|
||||||
:overview => overview_selected,
|
:overview => overview_selected_raw,
|
||||||
:tickets => tickets,
|
:tickets => tickets,
|
||||||
:tickets_count => tickets_count,
|
:tickets_count => tickets_count,
|
||||||
:users => users,
|
:users => users,
|
||||||
|
|
Loading…
Reference in a new issue