Moved to ajax searchable select for organization selection.
This commit is contained in:
parent
2311d1c393
commit
a6b5b43994
4 changed files with 78 additions and 11 deletions
|
@ -26,19 +26,14 @@ module ExtraCollection
|
|||
Group.all.each {|item|
|
||||
assets = item.assets(assets)
|
||||
}
|
||||
if !user.role?(Z_ROLENAME_CUSTOMER)
|
||||
|
||||
collections[ Organization.to_app_model ] = []
|
||||
Organization.all.each {|item|
|
||||
assets = item.assets(assets)
|
||||
}
|
||||
else
|
||||
if user.organization_id
|
||||
collections[ Organization.to_app_model ] = []
|
||||
Organization.where( id: user.organization_id ).each {|item|
|
||||
assets = item.assets(assets)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
[collections, assets]
|
||||
end
|
||||
module_function :session
|
||||
|
|
|
@ -30,6 +30,7 @@ class CreateObjectManager < ActiveRecord::Migration
|
|||
display: 'Customer',
|
||||
data_type: 'user_autocompletion',
|
||||
data_option: {
|
||||
relation: 'User',
|
||||
autocapitalize: false,
|
||||
multiple: false,
|
||||
null: false,
|
||||
|
|
|
@ -292,7 +292,7 @@ class UpdateObjectManager2 < ActiveRecord::Migration
|
|||
object: 'User',
|
||||
name: 'organization_id',
|
||||
display: 'Organization',
|
||||
data_type: 'select',
|
||||
data_type: 'autocompletion_ajax',
|
||||
data_option: {
|
||||
multiple: false,
|
||||
nulloption: true,
|
||||
|
|
71
db/migrate/20150977000001_update_object_manager3.rb
Normal file
71
db/migrate/20150977000001_update_object_manager3.rb
Normal file
|
@ -0,0 +1,71 @@
|
|||
class UpdateObjectManager3 < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
ObjectManager::Attribute.add(
|
||||
object: 'User',
|
||||
name: 'organization_id',
|
||||
display: 'Organization',
|
||||
data_type: 'autocompletion_ajax',
|
||||
data_option: {
|
||||
multiple: false,
|
||||
nulloption: true,
|
||||
null: true,
|
||||
relation: 'Organization',
|
||||
item_class: 'formGroup--halfSize',
|
||||
},
|
||||
editable: false,
|
||||
active: true,
|
||||
screens: {
|
||||
signup: {},
|
||||
invite_agent: {},
|
||||
edit: {
|
||||
'-all-' => {
|
||||
null: true,
|
||||
},
|
||||
},
|
||||
view: {
|
||||
'-all-' => {
|
||||
shown: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
pending_migration: false,
|
||||
position: 900,
|
||||
created_by_id: 1,
|
||||
updated_by_id: 1,
|
||||
)
|
||||
|
||||
ObjectManager::Attribute.add(
|
||||
object: 'Ticket',
|
||||
name: 'customer_id',
|
||||
display: 'Customer',
|
||||
data_type: 'user_autocompletion',
|
||||
data_option: {
|
||||
relation: 'User',
|
||||
autocapitalize: false,
|
||||
multiple: false,
|
||||
null: false,
|
||||
limit: 200,
|
||||
placeholder: 'Enter Person or Organization/Company',
|
||||
minLengt: 2,
|
||||
translate: false,
|
||||
},
|
||||
editable: false,
|
||||
active: true,
|
||||
screens: {
|
||||
create_top: {
|
||||
Agent: {
|
||||
null: false,
|
||||
},
|
||||
},
|
||||
edit: {},
|
||||
},
|
||||
pending_migration: false,
|
||||
position: 10,
|
||||
created_by_id: 1,
|
||||
updated_by_id: 1,
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue