Fixed new Ticket::ScreenOptions.attributes_to_change()

This commit is contained in:
Martin Edenhofer 2014-09-10 09:45:30 +02:00
parent ffaa1dc121
commit 188e21d3e7
2 changed files with 19 additions and 17 deletions

View file

@ -296,8 +296,8 @@ class TicketsController < ApplicationController
# get attributes to update # get attributes to update
attributes_to_change = Ticket::ScreenOptions.attributes_to_change( attributes_to_change = Ticket::ScreenOptions.attributes_to_change(
:user => current_user, :user => current_user,
# :ticket_id => params[:ticket_id], :ticket_id => params[:ticket_id],
# :article_id => params[:article_id] :article_id => params[:article_id]
) )
assets = attributes_to_change[:assets] assets = attributes_to_change[:assets]
@ -318,7 +318,10 @@ class TicketsController < ApplicationController
render :json => { render :json => {
:split => split, :split => split,
:assets => assets, :assets => assets,
:form_meta => attributes_to_change, :form_meta => {
:filter => attributes_to_change[:filter],
:dependencies => attributes_to_change[:dependencies],
}
} }
end end

View file

@ -8,9 +8,9 @@ class Sessions::Backend::TicketCreate
def load def load
# get whole collection # get attributes to update
ticket_create_attributes = Ticket::ScreenOptions.attributes_to_change( ticket_create_attributes = Ticket::ScreenOptions.attributes_to_change(
:current_user_id => @user.id, :user => @user.id,
) )
# no data exists # no data exists
@ -38,32 +38,31 @@ class Sessions::Backend::TicketCreate
# set new timeout # set new timeout
Sessions::CacheIn.set( self.client_key, true, { :expires_in => 25.seconds } ) Sessions::CacheIn.set( self.client_key, true, { :expires_in => 25.seconds } )
create_attributes = self.load ticket_create_attributes = self.load
return if !ticket_create_attributes
return if !create_attributes
users = {}
create_attributes[:owner_id].each {|user_id|
if !users[user_id]
users[user_id] = User.find(user_id).attributes
end
}
data = { data = {
:users => users, :assets => ticket_create_attributes[:assets],
:edit_form => create_attributes, :form_meta => {
:filter => ticket_create_attributes[:filter],
:dependencies => ticket_create_attributes[:dependencies],
}
} }
if !@client if !@client
return { return {
:collection => 'ticket_create_attributes', :collection => 'ticket_create_attributes',
:data => create_attributes, :data => data,
} }
end end
@client.log 'notify', "push ticket_create for user #{ @user.id }" @client.log 'notify', "push ticket_create for user #{ @user.id }"
@client.send({ @client.send({
:collection => 'ticket_create_attributes', :collection => 'ticket_create_attributes',
:data => create_attributes, :data => data,
}) })
end end