Moved to asset support for initial page load.
This commit is contained in:
parent
44590eb9b2
commit
5458de229f
3 changed files with 49 additions and 52 deletions
|
@ -1,34 +1,37 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module ExtraCollection
|
module ExtraCollection
|
||||||
def session( collections, user )
|
def session( collections, assets, user )
|
||||||
|
|
||||||
# all base stuff
|
# all base stuff
|
||||||
collections[ Taskbar.to_app_model ] = Taskbar.where( :user_id => user.id )
|
collections[ Taskbar.to_app_model ] = Taskbar.where( :user_id => user.id )
|
||||||
collections[ Role.to_app_model ] = Role.all
|
assets = {}
|
||||||
collections[ Group.to_app_model ] = Group.all
|
collections[ Taskbar.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
|
|
||||||
|
collections[ Role.to_app_model ] = Role.all
|
||||||
|
collections[ Role.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
|
|
||||||
|
collections[ Group.to_app_model ] = Group.all
|
||||||
|
collections[ Group.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
if !user.is_role('Customer')
|
if !user.is_role('Customer')
|
||||||
collections[ Organization.to_app_model ] = Organization.all
|
collections[ Organization.to_app_model ] = Organization.all
|
||||||
|
collections[ Organization.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if user.organization_id
|
if user.organization_id
|
||||||
collections[ Organization.to_app_model ] = Organization.where( :id => user.organization_id )
|
collections[ Organization.to_app_model ] = Organization.where( :id => user.organization_id )
|
||||||
|
collections[ Organization.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def push( collections, user )
|
module_function :session
|
||||||
|
|
||||||
# all base stuff
|
|
||||||
#collections[ Role.to_app_model ] = Role.all
|
|
||||||
#collections[ Group.to_app_model ] = Group.all
|
|
||||||
|
|
||||||
#if !user.is_role('Customer')
|
|
||||||
# collections[ Organization.to_app_model ] = Organization.all
|
|
||||||
#else
|
|
||||||
# if user.organization_id
|
|
||||||
# collections[ Organization.to_app_model ] = Organization.where( :id => user.organization_id )
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
end
|
|
||||||
module_function :session, :push
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module ExtraCollection
|
module ExtraCollection
|
||||||
def session( collections, user )
|
def session( collections, assets, user )
|
||||||
|
|
||||||
collections[ Network.to_app_model ] = Network.all
|
collections[ Network.to_app_model ] = Network.all
|
||||||
collections[ Network::Category.to_app_model ] = Network::Category.all
|
collections[ Network::Category.to_app_model ] = Network::Category.all
|
||||||
|
@ -9,13 +9,6 @@ module ExtraCollection
|
||||||
collections[ Network::Privacy.to_app_model ] = Network::Privacy.all
|
collections[ Network::Privacy.to_app_model ] = Network::Privacy.all
|
||||||
|
|
||||||
end
|
end
|
||||||
def push( collections, user )
|
|
||||||
|
|
||||||
collections[ Network.to_app_model ] = Network.all
|
|
||||||
collections[ Network::Category.to_app_model ] = Network::Category.all
|
|
||||||
collections[ Network::Category::Type.to_app_model ] = Network::Category::Type.all
|
|
||||||
collections[ Network::Privacy.to_app_model ] = Network::Privacy.all
|
|
||||||
|
|
||||||
end
|
module_function :session
|
||||||
module_function :session, :push
|
|
||||||
end
|
end
|
|
@ -1,42 +1,43 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module ExtraCollection
|
module ExtraCollection
|
||||||
def session( collections, user )
|
def session( collections, assets, user )
|
||||||
|
|
||||||
# all ticket stuff
|
# all ticket stuff
|
||||||
collections[ Ticket::StateType.to_app_model ] = Ticket::StateType.all
|
collections[ Ticket::StateType.to_app_model ] = Ticket::StateType.all
|
||||||
|
collections[ Ticket::StateType.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
collections[ Ticket::State.to_app_model ] = Ticket::State.all
|
collections[ Ticket::State.to_app_model ] = Ticket::State.all
|
||||||
|
collections[ Ticket::State.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
collections[ Ticket::Priority.to_app_model ] = Ticket::Priority.all
|
collections[ Ticket::Priority.to_app_model ] = Ticket::Priority.all
|
||||||
|
collections[ Ticket::Priority.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
collections[ Ticket::Article::Type.to_app_model ] = Ticket::Article::Type.all
|
collections[ Ticket::Article::Type.to_app_model ] = Ticket::Article::Type.all
|
||||||
|
collections[ Ticket::Article::Type.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
collections[ Ticket::Article::Sender.to_app_model ] = Ticket::Article::Sender.all
|
collections[ Ticket::Article::Sender.to_app_model ] = Ticket::Article::Sender.all
|
||||||
|
collections[ Ticket::Article::Sender.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
if !user.is_role('Customer')
|
if !user.is_role('Customer')
|
||||||
|
|
||||||
# all signatures
|
# all signatures
|
||||||
collections[ Signature.to_app_model ] = Signature.all
|
collections[ Signature.to_app_model ] = Signature.all
|
||||||
|
collections[ Signature.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
|
|
||||||
# all email addresses
|
# all email addresses
|
||||||
collections[ EmailAddress.to_app_model ] = EmailAddress.all
|
collections[ EmailAddress.to_app_model ] = EmailAddress.all
|
||||||
|
collections[ EmailAddress.to_app_model ].each {|item|
|
||||||
|
assets = item.assets(assets)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def push( collections, user )
|
module_function :session
|
||||||
|
|
||||||
# all ticket stuff
|
|
||||||
#collections[ Ticket::StateType.to_app_model ] = Ticket::StateType.all
|
|
||||||
#collections[ Ticket::State.to_app_model ] = Ticket::State.all
|
|
||||||
#collections[ Ticket::Priority.to_app_model ] = Ticket::Priority.all
|
|
||||||
#collections[ Ticket::Article::Type.to_app_model ] = Ticket::Article::Type.all
|
|
||||||
#collections[ Ticket::Article::Sender.to_app_model ] = Ticket::Article::Sender.all
|
|
||||||
|
|
||||||
#if !user.is_role('Customer')
|
|
||||||
|
|
||||||
# all signatures
|
|
||||||
# collections[ Signature.to_app_model ] = Signature.all
|
|
||||||
|
|
||||||
# all email addresses
|
|
||||||
# collections[ EmailAddress.to_app_model ] = EmailAddress.all
|
|
||||||
#end
|
|
||||||
end
|
|
||||||
|
|
||||||
module_function :session, :push
|
|
||||||
end
|
end
|
Loading…
Reference in a new issue