Fixed all users in ticket owner selection in zoom and bulk.

This commit is contained in:
Martin Edenhofer 2015-11-20 12:06:50 +01:00
parent 28dcee225d
commit 442da38eae
4 changed files with 23 additions and 19 deletions

View file

@ -238,7 +238,7 @@ class App.TicketCreate extends App.Controller
@ticketFormChanges, @ticketFormChanges,
signatureChanges, signatureChanges,
] ]
filter: @formMeta.filter filter: @formMeta.filter
autofocus: true autofocus: true
params: params params: params
) )

View file

@ -458,16 +458,23 @@ class BulkForm extends App.Controller
super super
@configure_attributes_ticket = [ @configure_attributes_ticket = [
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', filter: @bulk, translate: true, nulloption: true, default: '', class: '', item_class: '' }, { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: true, relation: 'TicketState', translate: true, nulloption: true, default: '' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', filter: @bulk, translate: true, nulloption: true, default: '', class: '', item_class: '' }, { name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: true, relation: 'TicketPriority', translate: true, nulloption: true, default: '' },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', filter: @bulk, nulloption: true, class: '', item_class: '' }, { name: 'group_id', display: 'Group', tag: 'select', multiple: false, null: true, relation: 'Group', nulloption: true },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', filter: @bulk, nulloption: true, class: '', item_class: '' } { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, null: true, relation: 'User', nulloption: true }
] ]
@holder = @options.holder @holder = @options.holder
@visible = false @visible = false
@render() load = (data) =>
App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta
@render()
@bindId = App.TicketCreateCollection.bind(load)
release: =>
App.TicketCreateCollection.unbind(@bindId)
render: -> render: ->
@el.css 'right', App.Utils.getScrollBarWidth() @el.css 'right', App.Utils.getScrollBarWidth()
@ -480,7 +487,11 @@ class BulkForm extends App.Controller
configure_attributes: @configure_attributes_ticket configure_attributes: @configure_attributes_ticket
className: 'create' className: 'create'
labelClass: 'input-group-addon' labelClass: 'input-group-addon'
form_data: @bulk handlers: [
@ticketFormChanges
]
params: {}
filter: @formMeta.filter
noFieldset: true noFieldset: true
) )
@ -490,7 +501,6 @@ class BulkForm extends App.Controller
configure_attributes: [{ name: 'body', display: 'Comment', tag: 'textarea', rows: 4, null: true, upload: false, item_class: 'flex' }] configure_attributes: [{ name: 'body', display: 'Comment', tag: 'textarea', rows: 4, null: true, upload: false, item_class: 'flex' }]
className: 'create' className: 'create'
labelClass: 'input-group-addon' labelClass: 'input-group-addon'
form_data: @bulk
noFieldset: true noFieldset: true
) )
@ -505,7 +515,6 @@ class BulkForm extends App.Controller
configure_attributes: @confirm_attributes configure_attributes: @confirm_attributes
className: 'create' className: 'create'
labelClass: 'input-group-addon' labelClass: 'input-group-addon'
form_data: @bulk
noFieldset: true noFieldset: true
) )

View file

@ -222,17 +222,17 @@ class TicketsController < ApplicationController
# permission check # permission check
ticket = Ticket.find( params[:id] ) ticket = Ticket.find( params[:id] )
return if !ticket_permission( ticket ) return if !ticket_permission(ticket)
# get attributes to update # get attributes to update
attributes_to_change = Ticket::ScreenOptions.attributes_to_change( user: current_user, ticket: ticket ) attributes_to_change = Ticket::ScreenOptions.attributes_to_change(user: current_user, ticket: ticket)
# get related users # get related users
assets = attributes_to_change[:assets] assets = attributes_to_change[:assets]
assets = ticket.assets(assets) assets = ticket.assets(assets)
# get related articles # get related articles
articles = Ticket::Article.where( ticket_id: params[:id] ) articles = Ticket::Article.where(ticket_id: params[:id])
# get related users # get related users
article_ids = [] article_ids = []
@ -275,10 +275,7 @@ class TicketsController < ApplicationController
assets: assets, assets: assets,
links: link_list, links: link_list,
tags: tags, tags: tags,
form_meta: { form_meta: attributes_to_change[:form_meta],
filter: attributes_to_change[:filter],
dependencies: attributes_to_change[:dependencies],
}
} }
end end

View file

@ -47,9 +47,7 @@ returns
end end
state_types.each {|type| state_types.each {|type|
state_type = Ticket::StateType.find_by(name: type) state_type = Ticket::StateType.find_by(name: type)
next if !state_type next if !state_type
state_type.states.each {|state| state_type.states.each {|state|
assets = state.assets(assets) assets = state.assets(assets)
state_ids.push state.id state_ids.push state.id
@ -87,7 +85,7 @@ returns
} }
dependencies = { group_id: { '' => { owner_id: [] } } } dependencies = { group_id: { '' => { owner_id: [] } } }
Group.where( active: true ).each { |group| Group.where(active: true).each { |group|
assets = group.assets(assets) assets = group.assets(assets)
dependencies[:group_id][group.id] = { owner_id: [] } dependencies[:group_id][group.id] = { owner_id: [] }
group.users.each {|user| group.users.each {|user|