From 21654d677c0207847f2ec0d966cb5553c55fbc13 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 2 May 2012 11:44:27 +0200 Subject: [PATCH] Fixed ref problem, did break overview conditions. --- .../ticket_overviews_controller.rb | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index 1ff1249e8..82c68029e 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -6,23 +6,32 @@ class TicketOverviewsController < ApplicationController def show # build up attributes hash - overview_selected = nil - overviews = Overview.all + overview_selected = nil + overview_selected_raw = nil + overviews = Overview.all 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 overview.condition.each { |item, value | if value == 'current_user.id' overview.condition[item] = current_user.id end } - - # remember selected view - if params[:view] && params[:view] == overview.meta[:url] - overview_selected = overview - end } - + # sortby # prio # state @@ -108,7 +117,7 @@ class TicketOverviewsController < ApplicationController # return result render :json => { - :overview => overview_selected, + :overview => overview_selected_raw, :tickets => tickets, :tickets_count => tickets_count, :users => users,