Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Felix Niklas 2015-11-20 15:43:27 +01:00
commit 4b45d8b24c
7 changed files with 64 additions and 64 deletions

View file

@ -81,7 +81,7 @@ class App.TaskbarWidget extends App.Controller
throw 'No such key attributes found for task item' throw 'No such key attributes found for task item'
# check if input has changed # check if input has changed
worker = App.TaskManager.worker( key ) worker = App.TaskManager.worker(key)
if !force && worker && worker.changed if !force && worker && worker.changed
if worker.changed() if worker.changed()
new Remove( new Remove(
@ -91,7 +91,7 @@ class App.TaskbarWidget extends App.Controller
return return
# check if active task is closed # check if active task is closed
currentTask = App.TaskManager.get( key ) currentTask = App.TaskManager.get(key)
tasks = App.TaskManager.all() tasks = App.TaskManager.all()
active_is_closed = false active_is_closed = false
for task in tasks for task in tasks
@ -99,7 +99,9 @@ class App.TaskbarWidget extends App.Controller
active_is_closed = true active_is_closed = true
# remove task # remove task
App.TaskManager.remove( key ) App.TaskManager.remove(key, false)
$(e.target).closest('.task').remove()
# if we do not need to move to an other task # if we do not need to move to an other task
return if !active_is_closed return if !active_is_closed

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
load = (data) =>
App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta
@render() @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

@ -24,10 +24,10 @@ class App.TaskManager
_instance ?= new _taskManagerSingleton _instance ?= new _taskManagerSingleton
_instance.update( key, params ) _instance.update( key, params )
@remove: ( key ) -> @remove: (key, rerender = true) ->
if _instance == undefined if _instance == undefined
_instance ?= new _taskManagerSingleton _instance ?= new _taskManagerSingleton
_instance.remove( key ) _instance.remove(key, rerender)
@notify: ( key ) -> @notify: ( key ) ->
if _instance == undefined if _instance == undefined
@ -77,23 +77,19 @@ class _taskManagerSingleton extends Spine.Module
@tasksInitial() @tasksInitial()
# render on login # render on login
App.Event.bind( App.Event.bind('auth:login', =>
'auth:login'
=>
@tasksInitial() @tasksInitial()
'task' 'task'
) )
# render on logout # render on logout
App.Event.bind( App.Event.bind('auth:logout', =>
'auth:logout'
=>
@reset() @reset()
'task' 'task'
) )
# send updates to server # send updates to server
App.Interval.set( @taskUpdateLoop, 2500, 'check_update_to_server_pending', 'task' ) App.Interval.set(@taskUpdateLoop, 2500, 'check_update_to_server_pending', 'task')
init: -> init: ->
@workers = {} @workers = {}
@ -123,11 +119,11 @@ class _taskManagerSingleton extends Spine.Module
domID: (key) -> domID: (key) ->
"content_permanent_#{key}" "content_permanent_#{key}"
worker: ( key ) -> worker: (key) ->
return @workers[ key ] if @workers[ key ] return @workers[ key ] if @workers[ key ]
return return
execute: ( params ) -> execute: (params) ->
# input validation # input validation
params.key = App.Utils.htmlAttributeCleanup(params.key) params.key = App.Utils.htmlAttributeCleanup(params.key)
@ -159,7 +155,7 @@ class _taskManagerSingleton extends Spine.Module
@activeTaskHistory.push _.clone(params) @activeTaskHistory.push _.clone(params)
# check if task already exists in storage / e. g. from last session # check if task already exists in storage / e. g. from last session
task = @get( params.key ) task = @get(params.key)
#console.log 'debug', 'execute', params, 'task', task #console.log 'debug', 'execute', params, 'task', task
@ -220,6 +216,7 @@ class _taskManagerSingleton extends Spine.Module
# start worker for task if not exists # start worker for task if not exists
@startController(params) @startController(params)
if !params.init
App.Event.trigger 'task:render' App.Event.trigger 'task:render'
startController: (params) => startController: (params) =>
@ -238,7 +235,7 @@ class _taskManagerSingleton extends Spine.Module
@workersStarted[params.key] = true @workersStarted[params.key] = true
# create new controller instanz # create new controller instanz
@workers[params.key] = new App[params.controller]( params_app ) @workers[params.key] = new App[params.controller](params_app)
# if controller is started hidden, call hide of controller # if controller is started hidden, call hide of controller
if !params.show if !params.show
@ -246,9 +243,9 @@ class _taskManagerSingleton extends Spine.Module
# hide all other controller / show current controller # hide all other controller / show current controller
else else
@showControllerHideOthers( params.key, params_app ) @showControllerHideOthers(params.key, params_app)
showControllerHideOthers: ( thisKey, params_app ) => showControllerHideOthers: (thisKey, params_app) =>
for key of @workersStarted for key of @workersStarted
if key is thisKey if key is thisKey
@show(key, params_app) @show(key, params_app)
@ -269,7 +266,6 @@ class _taskManagerSingleton extends Spine.Module
# execute controllers show # execute controllers show
if controller.show if controller.show
controller.show(params_app) controller.show(params_app)
App.Event.trigger('ui:rerender:task')
true true
@ -291,27 +287,27 @@ class _taskManagerSingleton extends Spine.Module
true true
# get task # get task
get: ( key ) => get: (key) =>
for task in @allTasks for task in @allTasks
if task.key is key if task.key is key
return task return task
# update task # update task
update: ( key, params ) => update: (key, params) =>
task = @get( key ) task = @get(key)
if !task if !task
throw "No such task with '#{key}' to update" throw "No such task with '#{key}' to update"
for item, value of params for item, value of params
task[item] = value task[item] = value
@taskUpdate( task ) @taskUpdate(task)
# remove task certain task from tasks # remove task certain task from tasks
remove: ( key ) => remove: (key, rerender) =>
# remember started task # remember started task
delete @tasksStarted[key] delete @tasksStarted[key]
task = @get( key ) task = @get(key)
return if !task return if !task
# update @allTasks # update @allTasks
@ -327,44 +323,45 @@ class _taskManagerSingleton extends Spine.Module
@release(key) @release(key)
# rerender taskbar # rerender taskbar
if rerender
App.Event.trigger 'task:render' App.Event.trigger 'task:render'
# destroy in backend storage # destroy in backend storage
@taskDestroy(task) @taskDestroy(task)
# set notify of task # set notify of task
notify: ( key ) => notify: (key) =>
task = @get( key ) task = @get(key)
if !task if !task
throw "No such task with '#{key}' to notify" throw "No such task with '#{key}' to notify"
task.notify = true task.notify = true
@taskUpdate( task ) @taskUpdate(task)
# unset notify of task # unset notify of task
mute: ( key ) => mute: (key) =>
task = @get( key ) task = @get(key)
if !task if !task
throw "No such task with '#{key}' to mute" throw "No such task with '#{key}' to mute"
task.notify = false task.notify = false
@taskUpdate( task ) @taskUpdate(task)
# set new order of tasks (needed for dnd) # set new order of tasks (needed for dnd)
reorder: ( order ) => reorder: (order) =>
prio = 0 prio = 0
for key in order for key in order
task = @get( key ) task = @get(key)
if !task if !task
throw "No such task with '#{key}' of order" throw "No such task with '#{key}' of order"
prio++ prio++
if task.prio isnt prio if task.prio isnt prio
task.prio = prio task.prio = prio
@taskUpdate( task ) @taskUpdate(task)
# release one task # release one task
release: (key) => release: (key) =>
try try
@el.find( "##{@domID(key)}" ).html('') @el.find("##{@domID(key)}").html('')
@el.find( "##{@domID(key)}" ).remove() @el.find("##{@domID(key)}").remove()
catch catch
@log 'notice', "invalid key '#{key}'" @log 'notice', "invalid key '#{key}'"

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|

View file

@ -964,8 +964,8 @@ wait untill text in selector disabppears
=begin =begin
tasks_close_all( tasks_close_all(
:browser => browser1, browser: browser1,
:discard_changes => true, discard_changes: true,
) )
=end =end
@ -980,11 +980,8 @@ wait untill text in selector disabppears
begin begin
if instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0] if instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0]
instance.mouse.move_to( instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0] ) instance.mouse.move_to( instance.find_elements( { css: '.navigation .tasks .task:first-child' } )[0] )
sleep 0.2
click_element = instance.find_elements( { css: '.navigation .tasks .task:first-child .js-close' } )[0] click_element = instance.find_elements( { css: '.navigation .tasks .task:first-child .js-close' } )[0]
if click_element if click_element
sleep 0.1
click_element.click click_element.click
# accept task close warning # accept task close warning