diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 1a4f950c2..6b6660ddd 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -38,7 +38,7 @@ class App.ControllerForm extends App.Controller @form showAlert: (message) => - @form.find('.alert').removeClass('hide').html( App.i18n.translateContent(message) ) + @form.find('.alert').removeClass('hide').html(App.i18n.translateContent(message)) hideAlert: => @form.find('.alert').addClass('hide').html() @@ -356,7 +356,7 @@ class App.ControllerForm extends App.Controller hit = false for refAttribute, refValue of attribute.shown_if if params[refAttribute] - if _.isArray( refValue ) + if _.isArray(refValue) for item in refValue if params[refAttribute].toString() is item.toString() hit = true diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee index 6aee2251e..b2ce9cb68 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee @@ -702,10 +702,10 @@ class App.WizardModal extends App.Controller @$(".setup.wizard.#{name} input, .setup.wizard.#{name} select").first().focus() showAlert: (screen, message) => - @$(".#{screen}").find('.alert').removeClass('hide').text( App.i18n.translateInline( message ) ) + @$(".#{screen}").find('.alert').first().removeClass('hide').text(App.i18n.translatePlain(message)) hideAlert: (screen) => - @$(".#{screen}").find('.alert').addClass('hide') + @$(".#{screen}").find('.alert').first().addClass('hide') disable: (e) => @formDisable(e) diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 81d605303..738865326 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -499,6 +499,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 120, null: false, placeholder: 'support@example.com', autocapitalize: false, autocomplete: 'off' }, { name: 'password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, { name: 'group_id', display: 'Destination Group', tag: 'select', null: false, relation: 'Group', nulloption: true }, + { name: 'folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false }, ] new App.ControllerForm( el: @$('.base-settings'), @@ -528,13 +529,25 @@ class App.ChannelEmailAccountWizard extends App.WizardModal { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', }, { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false }, ] + + showHideFolder = (params, attribute, attributes, classname, form, ui) -> + return if !params + if params.adapter is 'imap' + ui.show('options::folder') + return + ui.hide('options::folder') + new App.ControllerForm( el: @$('.base-inbound-settings'), model: configure_attributes: configureAttributesInbound className: '' params: @account.inbound + handlers: [ + showHideFolder + ] ) toggleOutboundAdapter: => @@ -544,6 +557,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal if @account['meta'] channel_used['options']['user'] = @account['meta']['email'] channel_used['options']['password'] = @account['meta']['password'] + channel_used['options']['folder'] = @account['meta']['folder'] # show used backend @$('.base-outbound-settings').html('') @@ -574,14 +588,14 @@ class App.ChannelEmailAccountWizard extends App.WizardModal params.channel_id = @channel.id @disable(e) - @$('.js-probe .js-email').text( params.email ) + @$('.js-probe .js-email').text(params.email) @showSlide('js-probe') @ajax( id: 'email_probe' type: 'POST' url: @apiPath + '/channels/email_probe' - data: JSON.stringify( params ) + data: JSON.stringify(params) processData: true success: (data, status, xhr) => if data.result is 'ok' @@ -589,8 +603,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal for key, value of data.setting @account[key] = value - if !@channel && data.content_messages && data.content_messages > 0 - message = App.i18n.translateContent('We have already found %s emails in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) + if data.content_messages && data.content_messages > 0 + message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @$('.js-inbound-acknowledge .js-next').attr('data-slide', '') @@ -604,12 +618,12 @@ class App.ChannelEmailAccountWizard extends App.WizardModal else if data.result is 'duplicate' @showSlide('js-intro') - @showAlert('js-intro', 'Account already exists!' ) + @showAlert('js-intro', 'Account already exists!') else @showSlide('js-inbound') - @showAlert('js-inbound', 'Unable to detect your server settings. Manual configuration needed.' ) - @$('.js-inbound [name="options::user"]').val( @account['meta']['email'] ) - @$('.js-inbound [name="options::password"]').val( @account['meta']['password'] ) + @showAlert('js-inbound', 'Unable to detect your server settings. Manual configuration needed.') + @$('.js-inbound [name="options::user"]').val(@account['meta']['email']) + @$('.js-inbound [name="options::password"]').val(@account['meta']['password']) @enable(e) fail: => @@ -635,7 +649,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal id: 'email_inbound' type: 'POST' url: @apiPath + '/channels/email_inbound' - data: JSON.stringify( params ) + data: JSON.stringify(params) processData: true success: (data, status, xhr) => if data.result is 'ok' @@ -643,8 +657,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal # remember account settings @account.inbound = params - if !@channel && data.content_messages && data.content_messages > 0 - message = App.i18n.translateContent('We have already found %s emails in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) + if data.content_messages && data.content_messages > 0 + message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound') @$('.js-inbound-acknowledge .js-next').unbind('click.verify') @@ -655,21 +669,21 @@ class App.ChannelEmailAccountWizard extends App.WizardModal # fill user / password based on inbound settings if !@channel if @account['inbound']['options'] - @$('.js-outbound [name="options::host"]').val( @account['inbound']['options']['host'] ) - @$('.js-outbound [name="options::user"]').val( @account['inbound']['options']['user'] ) - @$('.js-outbound [name="options::password"]').val( @account['inbound']['options']['password'] ) + @$('.js-outbound [name="options::host"]').val(@account['inbound']['options']['host']) + @$('.js-outbound [name="options::user"]').val(@account['inbound']['options']['user']) + @$('.js-outbound [name="options::password"]').val(@account['inbound']['options']['password']) else - @$('.js-outbound [name="options::user"]').val( @account['meta']['email'] ) - @$('.js-outbound [name="options::password"]').val( @account['meta']['password'] ) + @$('.js-outbound [name="options::user"]').val(@account['meta']['email']) + @$('.js-outbound [name="options::password"]').val(@account['meta']['password']) else @showSlide('js-inbound') - @showAlert('js-inbound', data.message_human || data.message ) + @showAlert('js-inbound', data.message_human || data.message) @showInvalidField('js-inbound', data.invalid_field) @enable(e) fail: => @showSlide('js-inbound') - @showAlert('js-inbound', data.message_human || data.message ) + @showAlert('js-inbound', data.message_human || data.message) @showInvalidField('js-inbound', data.invalid_field) @enable(e) ) @@ -682,7 +696,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal params['email'] = @account['meta']['email'] if !params['email'] && @channel - email_addresses = App.EmailAddress.search( filter: { channel_id: @channel.id } ) + email_addresses = App.EmailAddress.search(filter: { channel_id: @channel.id }) if email_addresses && email_addresses[0] params['email'] = email_addresses[0].email @@ -709,12 +723,12 @@ class App.ChannelEmailAccountWizard extends App.WizardModal @verify(@account) else @showSlide('js-outbound') - @showAlert('js-outbound', data.message_human || data.message ) + @showAlert('js-outbound', data.message_human || data.message) @showInvalidField('js-outbound', data.invalid_field) @enable(e) fail: => @showSlide('js-outbound') - @showAlert('js-outbound', data.message_human || data.message ) + @showAlert('js-outbound', data.message_human || data.message) @showInvalidField('js-outbound', data.invalid_field) @enable(e) ) @@ -732,7 +746,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal account.group_id = @channel.group_id if !account.email && @channel - email_addresses = App.EmailAddress.search( filter: { channel_id: @channel.id } ) + email_addresses = App.EmailAddress.search(filter: { channel_id: @channel.id }) if email_addresses && email_addresses[0] account.email = email_addresses[0].email @@ -740,7 +754,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal id: 'email_verify' type: 'POST' url: @apiPath + '/channels/email_verify' - data: JSON.stringify( account ) + data: JSON.stringify(account) processData: true success: (data, status, xhr) => if data.result is 'ok' @@ -748,11 +762,11 @@ class App.ChannelEmailAccountWizard extends App.WizardModal else if data.source is 'inbound' || data.source is 'outbound' @showSlide("js-#{data.source}") - @showAlert("js-#{data.source}", data.message_human || data.message ) + @showAlert("js-#{data.source}", data.message_human || data.message) @showInvalidField("js-#{data.source}", data.invalid_field) else if count is 2 - @showAlert('js-verify', data.message_human || data.message ) + @showAlert('js-verify', data.message_human || data.message) @delay( => @showSlide('js-intro') @@ -882,12 +896,12 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal @el.remove() else @showSlide('js-outbound') - @showAlert('js-outbound', data.message_human || data.message ) + @showAlert('js-outbound', data.message_human || data.message) @showInvalidField('js-outbound', data.invalid_field) @enable(e) fail: => @showSlide('js-outbound') - @showAlert('js-outbound', data.message_human || data.message ) + @showAlert('js-outbound', data.message_human || data.message) @showInvalidField('js-outbound', data.invalid_field) @enable(e) ) diff --git a/app/assets/javascripts/app/controllers/getting_started.coffee b/app/assets/javascripts/app/controllers/getting_started.coffee index 8b698523a..f9541a037 100644 --- a/app/assets/javascripts/app/controllers/getting_started.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.coffee @@ -731,7 +731,7 @@ class ChannelEmail extends App.WizardFullScreen @account[key] = value if data.content_messages && data.content_messages > 0 - message = App.i18n.translateContent('We have already found %s emails in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) + message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @$('.js-inbound-acknowledge .js-next').attr('data-slide', '') diff --git a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco index 9cecb874b..b962bd953 100644 --- a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco +++ b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco @@ -52,6 +52,9 @@