From 7125e54b1316b8f7da9a81e18f7b350f127f6eb9 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Mon, 26 Apr 2021 10:54:02 +0100 Subject: [PATCH] Fixes #3522 - Google and Microsoft 365 are missing filter & signature page content. --- .../controllers/_channel/_email_filter.coffee | 48 ++++++ .../_channel/_email_signature.coffee | 94 +++++++++++ .../app/controllers/_channel/email.coffee | 148 +----------------- 3 files changed, 144 insertions(+), 146 deletions(-) create mode 100644 app/assets/javascripts/app/controllers/_channel/_email_filter.coffee create mode 100644 app/assets/javascripts/app/controllers/_channel/_email_signature.coffee diff --git a/app/assets/javascripts/app/controllers/_channel/_email_filter.coffee b/app/assets/javascripts/app/controllers/_channel/_email_filter.coffee new file mode 100644 index 000000000..17ec6f63a --- /dev/null +++ b/app/assets/javascripts/app/controllers/_channel/_email_filter.coffee @@ -0,0 +1,48 @@ +class App.ChannelEmailFilter extends App.Controller + events: + 'click [data-type=new]': 'new' + + constructor: -> + super + App.PostmasterFilter.subscribe(@render, initFetch: true) + + render: => + data = App.PostmasterFilter.search(sortBy: 'name') + + template = $( '
' + App.i18n.translateContent('New') + '
' ) + + description = 'With filters you can e. g. dispatch new tickets into certain groups or set a certain priority for tickets of a VIP customer.' + + new App.ControllerTable( + el: template.find('.overview') + model: App.PostmasterFilter + objects: data + bindRow: + events: + 'click': @edit + explanation: description + ) + @html template + + new: (e) => + e.preventDefault() + new App.ControllerGenericNew( + pageData: + object: 'Postmaster Filter' + genericObject: 'PostmasterFilter' + container: @el.closest('.content') + callback: @load + large: true + ) + + edit: (id, e) => + e.preventDefault() + new App.ControllerGenericEdit( + id: id, + pageData: + object: 'Postmaster Filter' + genericObject: 'PostmasterFilter' + container: @el.closest('.content') + callback: @load + large: true + ) diff --git a/app/assets/javascripts/app/controllers/_channel/_email_signature.coffee b/app/assets/javascripts/app/controllers/_channel/_email_signature.coffee new file mode 100644 index 000000000..5948003d8 --- /dev/null +++ b/app/assets/javascripts/app/controllers/_channel/_email_signature.coffee @@ -0,0 +1,94 @@ +class App.ChannelEmailSignature extends App.Controller + events: + 'click [data-type=new]': 'new' + + constructor: -> + super + App.Signature.subscribe(@render, initFetch: true) + + render: => + data = App.Signature.search(sortBy: 'name') + + template = $( '
' + App.i18n.translateContent('New') + '
' ) + + description = ''' +You can define different signatures for each group. So you can have different email signatures for different departments. + +Once you have created a signature here, you need also to edit the groups where you want to use it. +''' + + new App.ControllerTable( + el: template.find('.overview') + model: App.Signature + objects: data + bindRow: + events: + 'click': @edit + explanation: description + ) + @html template + + new: (e) => + e.preventDefault() + new ChannelEmailSignatureEdit( + container: @el.closest('.content') + ) + + edit: (id, e) => + e.preventDefault() + item = App.Signature.find(id) + new ChannelEmailSignatureEdit( + object: item + container: @el.closest('.content') + ) + +class ChannelEmailSignatureEdit extends App.ControllerModal + buttonClose: true + buttonCancel: true + buttonSubmit: true + head: 'Signature' + + content: => + if @object + @form = new App.ControllerForm( + model: App.Signature + params: @object + autofocus: true + ) + else + @form = new App.ControllerForm( + model: App.Signature + autofocus: true + ) + + @form.form + + onSubmit: (e) => + + # get params + params = @formParam(e.target) + + object = @object || new App.Signature + object.load(params) + + # validate form + errors = @form.validate(params) + + # show errors in form + if errors + @log 'error', errors + @formValidate(form: e.target, errors: errors) + return false + + # disable form + @formDisable(e) + + # save object + object.save( + done: => + @close() + fail: (settings, details) => + @log 'errors', details + @formEnable(e) + @form.showAlert(details.error_human || details.error || 'Unable to create object!') + ) diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 47462965b..6abbe8eb0 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -15,12 +15,12 @@ class ChannelEmail extends App.ControllerTabs { name: 'Filter', target: 'c-filter', - controller: ChannelEmailFilter, + controller: App.ChannelEmailFilter, }, { name: 'Signatures', target: 'c-signature', - controller: ChannelEmailSignature, + controller: App.ChannelEmailSignature, }, { name: 'Settings', @@ -32,150 +32,6 @@ class ChannelEmail extends App.ControllerTabs @render() -class ChannelEmailFilter extends App.Controller - events: - 'click [data-type=new]': 'new' - - constructor: -> - super - App.PostmasterFilter.subscribe(@render, initFetch: true) - - render: => - data = App.PostmasterFilter.search(sortBy: 'name') - - template = $( '
' + App.i18n.translateContent('New') + '
' ) - - description = 'With filters you can e. g. dispatch new tickets into certain groups or set a certain priority for tickets of a VIP customer.' - - new App.ControllerTable( - el: template.find('.overview') - model: App.PostmasterFilter - objects: data - bindRow: - events: - 'click': @edit - explanation: description - ) - @html template - - new: (e) => - e.preventDefault() - new App.ControllerGenericNew( - pageData: - object: 'Postmaster Filter' - genericObject: 'PostmasterFilter' - container: @el.closest('.content') - callback: @load - large: true - ) - - edit: (id, e) => - e.preventDefault() - new App.ControllerGenericEdit( - id: id, - pageData: - object: 'Postmaster Filter' - genericObject: 'PostmasterFilter' - container: @el.closest('.content') - callback: @load - large: true - ) - -class ChannelEmailSignature extends App.Controller - events: - 'click [data-type=new]': 'new' - - constructor: -> - super - App.Signature.subscribe(@render, initFetch: true) - - render: => - data = App.Signature.search(sortBy: 'name') - - template = $( '
' + App.i18n.translateContent('New') + '
' ) - - description = ''' -You can define different signatures for each group. So you can have different email signatures for different departments. - -Once you have created a signature here, you need also to edit the groups where you want to use it. -''' - - new App.ControllerTable( - el: template.find('.overview') - model: App.Signature - objects: data - bindRow: - events: - 'click': @edit - explanation: description - ) - @html template - - new: (e) => - e.preventDefault() - new ChannelEmailSignatureEdit( - container: @el.closest('.content') - ) - - edit: (id, e) => - e.preventDefault() - item = App.Signature.find(id) - new ChannelEmailSignatureEdit( - object: item - container: @el.closest('.content') - ) - -class ChannelEmailSignatureEdit extends App.ControllerModal - buttonClose: true - buttonCancel: true - buttonSubmit: true - head: 'Signature' - - content: => - if @object - @form = new App.ControllerForm( - model: App.Signature - params: @object - autofocus: true - ) - else - @form = new App.ControllerForm( - model: App.Signature - autofocus: true - ) - - @form.form - - onSubmit: (e) => - - # get params - params = @formParam(e.target) - - object = @object || new App.Signature - object.load(params) - - # validate form - errors = @form.validate(params) - - # show errors in form - if errors - @log 'error', errors - @formValidate(form: e.target, errors: errors) - return false - - # disable form - @formDisable(e) - - # save object - object.save( - done: => - @close() - fail: (settings, details) => - @log 'errors', details - @formEnable(e) - @form.showAlert(details.error_human || details.error || 'Unable to create object!') - ) - class ChannelEmailAccountOverview extends App.Controller events: 'click .js-channelNew': 'wizard'