Added module layer to load default collections.
This commit is contained in:
parent
b8111353ba
commit
3c38b2fd7c
3 changed files with 35 additions and 12 deletions
11
app/controllers/sessions/collection_network.rb
Normal file
11
app/controllers/sessions/collection_network.rb
Normal 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
|
12
app/controllers/sessions/collection_ticket.rb
Normal file
12
app/controllers/sessions/collection_ticket.rb
Normal 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
|
|
@ -130,18 +130,18 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
# auto population of default collections
|
# auto population of default collections
|
||||||
default_collection = {}
|
default_collection = {}
|
||||||
default_collection['Role'] = Role.all
|
default_collection['Role'] = Role.all
|
||||||
default_collection['Group'] = Group.all
|
default_collection['Group'] = Group.all
|
||||||
default_collection['Organization'] = Organization.all
|
default_collection['Organization'] = Organization.all
|
||||||
default_collection['TicketStateType'] = Ticket::StateType.all
|
|
||||||
default_collection['TicketState'] = Ticket::State.all
|
# load routes from external files
|
||||||
default_collection['TicketPriority'] = Ticket::Priority.all
|
dir = File.expand_path('../', __FILE__)
|
||||||
default_collection['TicketArticleType'] = Ticket::Article::Type.all
|
files = Dir.glob( "#{dir}/sessions/collection_*.rb" )
|
||||||
default_collection['TicketArticleSender'] = Ticket::Article::Sender.all
|
for file in files
|
||||||
default_collection['Network'] = Network.all
|
require file
|
||||||
default_collection['NetworkCategory'] = Network::Category.all
|
ExtraCollection.add(default_collection)
|
||||||
default_collection['NetworkCategoryType'] = Network::Category::Type.all
|
end
|
||||||
default_collection['NetworkPrivacy'] = Network::Privacy.all
|
|
||||||
return default_collection
|
return default_collection
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue