Added module layer to load default collections.

This commit is contained in:
Martin Edenhofer 2012-05-18 15:53:20 +02:00
parent b8111353ba
commit 3c38b2fd7c
3 changed files with 35 additions and 12 deletions

View file

@ -0,0 +1,11 @@
module ExtraCollection
def add(collections)
collections['Network'] = Network.all
collections['NetworkCategory'] = Network::Category.all
collections['NetworkCategoryType'] = Network::Category::Type.all
collections['NetworkPrivacy'] = Network::Privacy.all
end
module_function :add
end

View file

@ -0,0 +1,12 @@
module ExtraCollection
def add(collections)
collections['TicketStateType'] = Ticket::StateType.all
collections['TicketState'] = Ticket::State.all
collections['TicketPriority'] = Ticket::Priority.all
collections['TicketArticleType'] = Ticket::Article::Type.all
collections['TicketArticleSender'] = Ticket::Article::Sender.all
end
module_function :add
end

View file

@ -133,15 +133,15 @@ class SessionsController < ApplicationController
default_collection['Role'] = Role.all
default_collection['Group'] = Group.all
default_collection['Organization'] = Organization.all
default_collection['TicketStateType'] = Ticket::StateType.all
default_collection['TicketState'] = Ticket::State.all
default_collection['TicketPriority'] = Ticket::Priority.all
default_collection['TicketArticleType'] = Ticket::Article::Type.all
default_collection['TicketArticleSender'] = Ticket::Article::Sender.all
default_collection['Network'] = Network.all
default_collection['NetworkCategory'] = Network::Category.all
default_collection['NetworkCategoryType'] = Network::Category::Type.all
default_collection['NetworkPrivacy'] = Network::Privacy.all
# load routes from external files
dir = File.expand_path('../', __FILE__)
files = Dir.glob( "#{dir}/sessions/collection_*.rb" )
for file in files
require file
ExtraCollection.add(default_collection)
end
return default_collection
end
end