' end if user.preferences[:locale] =~ /^de/i - subject = 'Ticket aktualisiert (#{ticket.title.text2html})' + subject = 'Ticket aktualisiert (#{ticket.title})' body = '
diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 078e3dd82..1820ef8a7 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -467,6 +467,31 @@ class App.Controller extends Spine.Controller ws_send: (data) -> App.Event.trigger( 'ws:send', JSON.stringify(data) ) + # central method, is getting called on every ticket form change + ticketFormChanges: (params, attribute, attributes, classname, form, ui) => + if @form_meta.dependencies && @form_meta.dependencies[attribute.name] + dependency = @form_meta.dependencies[attribute.name][ parseInt(params[attribute.name]) ] + if !dependency + dependency = @form_meta.dependencies[attribute.name][ params[attribute.name] ] + if dependency + for fieldNameToChange of dependency + filter = [] + if dependency[fieldNameToChange] + filter = dependency[fieldNameToChange] + + # find element to replace + for item in attributes + if item.name is fieldNameToChange + item['filter'] = {} + item['filter'][ fieldNameToChange ] = filter + item.default = params[item.name] + #if !item.default + # delete item['default'] + newElement = ui.formGenItem( item, classname, form ) + + # replace new option list + form.find('[name="' + fieldNameToChange + '"]').closest('.form-group').replaceWith( newElement ) + class App.ControllerPermanent extends App.Controller constructor: -> super @@ -485,10 +510,10 @@ class App.ControllerModal extends App.Controller '.modal-body': 'body' events: - 'submit form': 'onSubmit' + 'submit form': 'onSubmit' 'click .js-submit:not(.is-disabled)': 'onSubmit' - 'click .js-cancel': 'hide' - 'click .js-close': 'hide' + 'click .js-cancel': 'hide' + 'click .js-close': 'hide' className: 'modal fade' diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 15d66648e..35397afa9 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -35,7 +35,11 @@ class App.ControllerForm extends App.Controller formGen: -> App.Log.debug 'ControllerForm', 'formGen', @model.configure_attributes - fieldset = $('
') + # check if own fieldset should be generated + if @noFieldset + fieldset = @el + else + fieldset = $('') # collect form attributes @attributes = [] @@ -81,9 +85,6 @@ class App.ControllerForm extends App.Controller item = @formGenItem( attribute, className, fieldset, attribute_count ) item.appendTo(fieldset) - if @noFieldset - fieldset = fieldset.children() - if @fullForm if !@formClass @formClass = '' diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index aa7632475..387657240 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -205,29 +205,6 @@ class App.TicketCreate extends App.Controller form_id: @form_id ) - formChanges = (params, attribute, attributes, classname, form, ui) => - if @form_meta.dependencies && @form_meta.dependencies[attribute.name] - dependency = @form_meta.dependencies[attribute.name][ parseInt(params[attribute.name]) ] - if dependency - - for fieldNameToChange of dependency - filter = [] - if dependency[fieldNameToChange] - filter = dependency[fieldNameToChange] - - # find element to replace - for item in attributes - if item.name is fieldNameToChange - item['filter'] = {} - item['filter'][ fieldNameToChange ] = filter - item.default = params[item.name] - #if !item.default - # delete item['default'] - newElement = ui.formGenItem( item, classname, form ) - - # replace new option list - form.find('[name="' + fieldNameToChange + '"]').closest('.form-group').replaceWith( newElement ) - signatureChanges = (params, attribute, attributes, classname, form, ui) => if attribute && attribute.name is 'group_id' signature = undefined @@ -274,7 +251,7 @@ class App.TicketCreate extends App.Controller events: 'change [name=customer_id]': @localUserInfo handlers: [ - formChanges, + @ticketFormChanges, signatureChanges, ] filter: @form_meta.filter @@ -297,7 +274,7 @@ class App.TicketCreate extends App.Controller events: 'change [name=customer_id]': @localUserInfo handlers: [ - formChanges, + @ticketFormChanges, signatureChanges, ] filter: @form_meta.filter @@ -312,7 +289,7 @@ class App.TicketCreate extends App.Controller events: 'change [name=customer_id]': @localUserInfo handlers: [ - formChanges, + @ticketFormChanges, signatureChanges, ] filter: @form_meta.filter diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee index 62b295826..fbcf2bd60 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee @@ -64,29 +64,6 @@ class Index extends App.ControllerContent groupFilter = [groupFilter] @form_meta.filter.group_id = groupFilter - formChanges = (params, attribute, attributes, classname, form, ui) => - if @form_meta.dependencies && @form_meta.dependencies[attribute.name] - dependency = @form_meta.dependencies[attribute.name][ parseInt(params[attribute.name]) ] - if dependency - - for fieldNameToChange of dependency - filter = [] - if dependency[fieldNameToChange] - filter = dependency[fieldNameToChange] - - # find element to replace - for item in attributes - if item.name is fieldNameToChange - item['filter'] = {} - item['filter'][ fieldNameToChange ] = filter - item.default = params[item.name] - #if !item.default - # delete item['default'] - newElement = ui.formGenItem( item, classname, form ) - - # replace new option list - form.find('[name="' + fieldNameToChange + '"]').closest('.form-group').replaceWith( newElement ) - @html App.view('customer_ticket_create')( head: 'New Ticket' ) new App.ControllerForm( @@ -95,7 +72,7 @@ class Index extends App.ControllerContent model: App.Ticket screen: 'create_top' handlers: [ - formChanges + @ticketFormChanges ] filter: @form_meta.filter autofocus: true @@ -115,7 +92,7 @@ class Index extends App.ControllerContent model: App.Ticket screen: 'create_middle' handlers: [ - formChanges + @ticketFormChanges ] filter: @form_meta.filter params: defaults diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 9ff018978..1bc2bac8e 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -777,4 +777,16 @@ class insufficientRightsRef extends App.ControllerContent App.Config.set( 'layout_ref/insufficient_rights', insufficientRightsRef, 'Routes' ) + +class errorRef extends App.ControllerContent + + constructor: -> + super + @render() + + render: -> + @html App.view('layout_ref/error')() + +App.Config.set( 'layout_ref/error', errorRef, 'Routes' ) + App.Config.set( 'LayoutRef', { prio: 1700, parent: '#current_user', name: 'Layout Reference', target: '#layout_ref', role: [ 'Admin' ] }, 'NavBarRight' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 0d888dce8..53ede62f5 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -115,6 +115,9 @@ class App.Navigation extends App.Controller render: () -> + # reset result cache + @searchResultCache = {} + user = App.Session.get() @html App.view('navigation')( user: user @@ -127,6 +130,11 @@ class App.Navigation extends App.Controller @renderPersonal() searchFunction = => + + # use cache for search result + if @searchResultCache[@term] + @renderResult( @searchResultCache[@term] ) + App.Ajax.request( id: 'search' type: 'GET' @@ -139,6 +147,9 @@ class App.Navigation extends App.Controller # load assets App.Collection.loadAssets( data.assets ) + # cache search result + @searchResultCache[@term] = data.result + result = data.result for area in result if area.name is 'Ticket' @@ -222,7 +233,7 @@ class App.Navigation extends App.Controller return if term is @term @term = term @$('.search').toggleClass('filled', !!@term) - @delay( searchFunction, 220, 'search' ) + @delay( searchFunction, 200, 'search' ) ) # bind to empty search diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 501225356..2a6f337b6 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -267,29 +267,6 @@ class App.TicketZoom extends App.Controller console.log('SHOW', ticket.id) el.find('.edit').html('') - formChanges = (params, attribute, attributes, classname, form, ui) => - if @form_meta.dependencies && @form_meta.dependencies[attribute.name] - dependency = @form_meta.dependencies[attribute.name][ parseInt(params[attribute.name]) ] - if dependency - - for fieldNameToChange of dependency - filter = [] - if dependency[fieldNameToChange] - filter = dependency[fieldNameToChange] - - # find element to replace - for item in attributes - if item.name is fieldNameToChange - item['filter'] = {} - item['filter'][ fieldNameToChange ] = filter - item.default = params[item.name] - #if !item.default - # delete item['default'] - newElement = ui.formGenItem( item, classname, form ) - - # replace new option list - form.find('[name="' + fieldNameToChange + '"]').closest('.form-group').replaceWith( newElement ) - defaults = ticket.attributes() task_state = @taskGet('ticket') modelDiff = @getDiff( defaults, task_state ) @@ -305,7 +282,7 @@ class App.TicketZoom extends App.Controller screen: 'edit' params: App.Ticket.find(ticket.id) handlers: [ - formChanges + @ticketFormChanges ] filter: @form_meta.filter params: defaults @@ -1502,10 +1479,10 @@ class ArticleView extends App.Controller e.preventDefault() # get reference article - article_id = $(e.target).parents('[data-id]').data('id') - article = App.TicketArticle.fullLocal( article_id ) - type = App.TicketArticleType.find( article.type_id ) - customer = App.User.find( article.created_by_id ) + article_id = $(e.target).parents('[data-id]').data('id') + article = App.TicketArticle.fullLocal( article_id ) + type = App.TicketArticleType.find( article.type_id ) + customer = App.User.find( article.created_by_id ) @ui.el.find('.article-add').ScrollTo() @@ -1534,12 +1511,18 @@ class ArticleView extends App.Controller to = customer.accounts['twitter'].username || customer.accounts['twitter'].uid articleNew.to = to - else if type.name is 'email' + else if type.name is 'email' || type.name is 'phone' || type.name is 'web' + if article.sender.name is 'Agent' articleNew.to = article.to else articleNew.to = article.from + # if sender is customer but in article.from is no email, try to get + # customers email via customer user + if articleNew.to && !articleNew.to.match(/@/) + articleNew.to = article.created_by.email + # filter for uniq recipients recipientAddresses = {} recipient = emailAddresses.parseAddressList(articleNew.to) @@ -1678,22 +1661,28 @@ class Article extends App.Controller ] #if @article.type.name is 'note' # actions.push [] - if @article.type.name is 'email' + if @article.type.name is 'email' || @article.type.name is 'phone' || @article.type.name is 'web' actions.push { name: 'reply' type: 'reply' href: '#' } recipients = [] - if @article.to - localRecipients = emailAddresses.parseAddressList(@article.to) - if localRecipients - recipients = recipients.concat localRecipients + if @article.sender.name is 'Agent' + if @article.to + localRecipients = emailAddresses.parseAddressList(@article.to) + if localRecipients + recipients = recipients.concat localRecipients + else + if @article.from + localRecipients = emailAddresses.parseAddressList(@article.from) + if localRecipients + recipients = recipients.concat localRecipients if @article.cc localRecipients = emailAddresses.parseAddressList(@article.cc) if localRecipients recipients = recipients.concat localRecipients - if recipients.length > 0 + if recipients.length > 1 actions.push { name: 'reply all' type: 'replyAll' diff --git a/app/assets/javascripts/app/controllers/widget/ff_lt_35.js.coffee b/app/assets/javascripts/app/controllers/widget/ff_lt_35.js.coffee new file mode 100644 index 000000000..31260a917 --- /dev/null +++ b/app/assets/javascripts/app/controllers/widget/ff_lt_35.js.coffee @@ -0,0 +1,10 @@ +class FFlt35 + constructor: -> + data = App.Browser.detection() + if data.browser is 'Firefox' && data.version && data.version < 35 + + # for firefox lower 35 we need to set a class to hide own dropdown images + # whole file can be removed after dropping firefox 34 and lower support + $('html').addClass('ff-lt-35') + +App.Config.set( 'aaa_ff-lt-35', FFlt35, 'Widgets' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index ac7c0348e..2dd7e937e 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -47,6 +47,7 @@ class App.OnlineNotificationWidget extends App.Controller @toggle.append('<%- @T('Status Code') %>: <%= @status %>
-<%= @detail %>
+