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
attributes_to_change = Ticket::ScreenOptions.attributes_to_change(
:user => current_user,
# :ticket_id => params[:ticket_id],
# :article_id => params[:article_id]
:ticket_id => params[:ticket_id],
:article_id => params[:article_id]
)
assets = attributes_to_change[:assets]
@ -318,7 +318,10 @@ class TicketsController < ApplicationController
render :json => {
:split => split,
:assets => assets,
:form_meta => attributes_to_change,
:form_meta => {
:filter => attributes_to_change[:filter],
:dependencies => attributes_to_change[:dependencies],
}
}
end

View file

@ -8,9 +8,9 @@ class Sessions::Backend::TicketCreate
def load
# get whole collection
# get attributes to update
ticket_create_attributes = Ticket::ScreenOptions.attributes_to_change(
:current_user_id => @user.id,
:user => @user.id,
)
# no data exists
@ -38,32 +38,31 @@ class Sessions::Backend::TicketCreate
# set new timeout
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 = {
:users => users,
:edit_form => create_attributes,
:assets => ticket_create_attributes[:assets],
:form_meta => {
:filter => ticket_create_attributes[:filter],
:dependencies => ticket_create_attributes[:dependencies],
}
}
if !@client
return {
:collection => 'ticket_create_attributes',
:data => create_attributes,
:data => data,
}
end
@client.log 'notify', "push ticket_create for user #{ @user.id }"
@client.send({
:collection => 'ticket_create_attributes',
:data => create_attributes,
:data => data,
})
end