diff --git a/app/controllers/sessions/collection_network.rb b/app/controllers/sessions/collection_network.rb new file mode 100644 index 000000000..319000f70 --- /dev/null +++ b/app/controllers/sessions/collection_network.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/sessions/collection_ticket.rb b/app/controllers/sessions/collection_ticket.rb new file mode 100644 index 000000000..97414be62 --- /dev/null +++ b/app/controllers/sessions/collection_ticket.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 3168d9d68..19d921641 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -130,18 +130,18 @@ class SessionsController < ApplicationController # auto population of default collections default_collection = {} - 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 + default_collection['Role'] = Role.all + default_collection['Group'] = Group.all + default_collection['Organization'] = Organization.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 \ No newline at end of file