Some small improvements to email channel management.

This commit is contained in:
Martin Edenhofer 2015-08-28 16:50:40 +02:00
parent 6904c89668
commit 64da02366c
6 changed files with 140 additions and 57 deletions

View file

@ -11,16 +11,16 @@ class App.ChannelEmail extends App.ControllerTabs
target: 'c-account', target: 'c-account',
controller: App.ChannelEmailAccountOverview, controller: App.ChannelEmailAccountOverview,
}, },
{
name: 'Signatures',
target: 'c-signature',
controller: App.ChannelEmailSignature,
},
{ {
name: 'Filter', name: 'Filter',
target: 'c-filter', target: 'c-filter',
controller: App.ChannelEmailFilter, controller: App.ChannelEmailFilter,
}, },
{
name: 'Signatures',
target: 'c-signature',
controller: App.ChannelEmailSignature,
},
{ {
name: 'Settings', name: 'Settings',
target: 'c-setting', target: 'c-setting',
@ -354,6 +354,7 @@ class App.ChannelEmailAccountWizard extends App.Controller
'change .js-outbound [name=adapter]': 'toggleOutboundAdapter' 'change .js-outbound [name=adapter]': 'toggleOutboundAdapter'
'submit .js-outbound': 'probleOutbound' 'submit .js-outbound': 'probleOutbound'
'click .js-back': 'goToSlide' 'click .js-back': 'goToSlide'
'click .js-close': 'hide'
constructor: -> constructor: ->
super super
@ -385,12 +386,10 @@ class App.ChannelEmailAccountWizard extends App.Controller
backdrop: true backdrop: true
container: @container container: @container
.on .on
'show.bs.modal': @onShow
'shown.bs.modal': @onComplete
'hidden.bs.modal': => 'hidden.bs.modal': =>
if @callback if @callback
@callback() @callback()
$('.modal').remove() @el.remove()
if @slide if @slide
@showSlide(@slide) @showSlide(@slide)
@ -418,7 +417,7 @@ class App.ChannelEmailAccountWizard extends App.Controller
# inbound # inbound
configureAttributesInbound = [ configureAttributesInbound = [
{ name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: { imap: 'IMAP', pop3: 'POP3' } }, { name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: { imap: 'imap', pop3: 'pop3' } },
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, { 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 }, { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, single: true }, { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, single: true },
@ -645,6 +644,10 @@ class App.ChannelEmailAccountWizard extends App.Controller
@formEnable(e) @formEnable(e)
@$('.wizard-controls .btn').attr('disabled', false) @$('.wizard-controls .btn').attr('disabled', false)
hide: (e) =>
e.preventDefault()
@el.modal('hide')
class App.ChannelEmailNotificationWizard extends App.Controller class App.ChannelEmailNotificationWizard extends App.Controller
elements: elements:
'.modal-body': 'body' '.modal-body': 'body'
@ -654,6 +657,7 @@ class App.ChannelEmailNotificationWizard extends App.Controller
events: events:
'change .js-outbound [name=adapter]': 'toggleOutboundAdapter' 'change .js-outbound [name=adapter]': 'toggleOutboundAdapter'
'submit .js-outbound': 'probleOutbound' 'submit .js-outbound': 'probleOutbound'
'click .js-close': 'hide'
constructor: -> constructor: ->
super super
@ -689,7 +693,7 @@ class App.ChannelEmailNotificationWizard extends App.Controller
'hidden.bs.modal': => 'hidden.bs.modal': =>
if @callback if @callback
@callback() @callback()
$('.modal').remove() @el.remove()
if @slide if @slide
@showSlide(@slide) @showSlide(@slide)
@ -784,4 +788,8 @@ class App.ChannelEmailNotificationWizard extends App.Controller
enable: (e) => enable: (e) =>
@formEnable(e) @formEnable(e)
@$('.wizard-controls .btn').attr('disabled', false) @$('.wizard-controls .btn').attr('disabled', false)
hide: (e) =>
e.preventDefault()
@el.modal('hide')

View file

@ -17,7 +17,7 @@ class App.EmailAddress extends App.Model
{ name: 'channel_id', display: 'Channel', tag: 'select', multiple: false, null: true, relation: 'Channel', nulloption: true, filter: @filterChannel }, { name: 'channel_id', display: 'Channel', tag: 'select', multiple: false, null: true, relation: 'Channel', nulloption: true, filter: @filterChannel },
{ name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true }, { name: 'note', display: 'Note', tag: 'textarea', note: 'Notes are visible to agents only, never to customers.', limit: 250, null: true },
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'active', default: true }, { name: 'active', display: 'Active', tag: 'active', readonly: 1 },
] ]
@configure_overview = [ @configure_overview = [
'realname', 'email' 'realname', 'email'

View file

@ -1,8 +1,13 @@
<div class="modal-dialog"> <div class="modal-dialog wizard">
<form class="setup wizard js-intro"> <form class="modal-content setup wizard js-intro">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Account') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<div class="alert alert--danger hide" role="alert"></div> <div class="alert alert--danger hide" role="alert"></div>
<fieldset> <fieldset>
@ -20,37 +25,56 @@
</div> </div>
</fieldset> </fieldset>
</div> </div>
<div class="wizard-controls center"> </div>
<button class="btn btn--primary align-right"><%- @T('Connect') %></button> <div class="modal-footer">
</div> <div class="modal-centerFooter">
<button class="btn btn--primary align-center"><%- @T('Connect') %></button>
</div>
</div> </div>
</form> </form>
<form class="setup wizard hide js-probe"> <form class="modal-content setup wizard hide js-probe">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Account') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<p class="wizard-loadingText"> <p class="wizard-loadingText">
<span class="loading icon"></span> <%- @T('Testing') %> <span class="js-email"></span> <span class="loading icon"></span> <%- @T('Testing') %> <span class="js-email"></span>
</p> </p>
</div> </div>
</div> </div>
<div class="modal-footer"></div>
</form> </form>
<form class="setup wizard hide js-test"> <form class="modal-content setup wizard hide js-test">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Account') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<p class="wizard-loadingText"> <p class="wizard-loadingText">
<span class="loading icon"></span> <%- @T('Verifying...') %> <span class="loading icon"></span> <%- @T('Verifying...') %>
</p> </p>
</div> </div>
</div> </div>
<div class="modal-footer"></div>
</form> </form>
<form class="setup wizard hide js-verify"> <form class="modal-content setup wizard hide js-verify">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Account') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<div class="alert alert--danger hide" role="alert"></div> <div class="alert alert--danger hide" role="alert"></div>
<p class="wizard-loadingText"> <p class="wizard-loadingText">
@ -58,33 +82,52 @@
</p> </p>
</div> </div>
</div> </div>
<div class="modal-footer"></div>
</form> </form>
<form class="setup wizard hide js-inbound"> <form class="modal-content setup wizard hide js-inbound">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Inbound') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Inbound') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<div class="alert alert--danger hide" role="alert"></div> <div class="alert alert--danger hide" role="alert"></div>
<div class="base-inbound-settings"></div> <div class="base-inbound-settings"></div>
</div> </div>
<div class="wizard-controls center"> </div>
<a class="btn btn--text btn--secondary js-back" data-slide="js-intro"><%- @T('Go Back') %></a> <div class="modal-footer">
<button class="btn btn--primary align-right"><%- @T( 'Continue' ) %></button> <div class="modal-rightFooter">
<a class="btn btn--text btn--secondary js-back align-left" data-slide="js-intro"><%- @T('Go Back') %></a>
</div>
<div class="modal-rightFooter">
<button class="btn btn--primary align-right"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>
<form class="setup wizard hide js-outbound"> <form class="modal-content setup wizard hide js-outbound">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Outbound') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Outbound') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<div class="alert alert--danger hide" role="alert"></div> <div class="alert alert--danger hide" role="alert"></div>
<div class="base-outbound-type"></div> <div class="base-outbound-type"></div>
<div class="base-outbound-settings"></div> <div class="base-outbound-settings"></div>
</div> </div>
<div class="wizard-controls center"> </div>
<a class="btn btn--text btn--secondary js-back" data-slide="js-inbound"><%- @T('Go Back') %></a> <div class="modal-footer">
<button class="btn btn--primary align-right"><%- @T( 'Continue' ) %></button> <div class="modal-rightFooter">
<a class="btn btn--text btn--secondary js-back align-left" data-slide="js-inbound"><%- @T('Go Back') %></a>
</div>
<div class="modal-rightFooter">
<button class="btn btn--primary align-right"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>

View file

@ -1,37 +1,56 @@
<div class="modal-dialog"> <div class="modal-dialog wizard">
<form class="setup wizard hide js-probe"> <form class="modal-content setup wizard hide js-probe">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Notification') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<p class="wizard-loadingText"> <p class="wizard-loadingText">
<span class="loading icon"></span> <%- @T('Testing') %> <span class="js-email"></span> <span class="loading icon"></span> <%- @T('Testing') %> <span class="js-email"></span>
</p> </p>
</div> </div>
</div> </div>
<div class="modal-footer"></div>
</form> </form>
<form class="setup wizard hide js-test"> <form class="modal-content setup wizard hide js-test">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Account') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Notification') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<p class="wizard-loadingText"> <p class="wizard-loadingText">
<span class="loading icon"></span> <%- @T('Verifying...') %> <span class="loading icon"></span> <%- @T('Verifying...') %>
</p> </p>
</div> </div>
</div> </div>
<div class="modal-footer"></div>
</form> </form>
<form class="setup wizard js-outbound"> <form class="modal-content setup wizard js-outbound">
<div class="wizard-slide"> <div class="modal-header">
<h2><%- @T('Email Outbound') %></h2> <div class="modal-close js-close">
<svg class="icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
</div>
<h1 class="modal-title"><%- @T('Email Notification') %></h1>
</div>
<div class="modal-body">
<div class="wizard-body vertical justified"> <div class="wizard-body vertical justified">
<div class="alert alert--danger hide" role="alert"></div> <div class="alert alert--danger hide" role="alert"></div>
<div class="base-outbound-type"></div> <div class="base-outbound-type"></div>
<div class="base-outbound-settings"></div> <div class="base-outbound-settings"></div>
</div> </div>
<div class="wizard-controls center"> </div>
<button class="btn btn--primary align-right"><%- @T( 'Continue' ) %></button> <div class="modal-footer">
<div class="modal-rightFooter">
<button class="btn btn--primary align-right"><%- @T('Continue') %></button>
</div> </div>
</div> </div>
</form> </form>

View file

@ -4429,6 +4429,9 @@ footer {
margin-top: 35px; margin-top: 35px;
margin-bottom: 35px; margin-bottom: 35px;
} }
.modal-dialog.wizard {
max-width: 460px;
}
.modal-backdrop { .modal-backdrop {
position: fixed; position: fixed;

View file

@ -21,18 +21,28 @@ check and if channel not exists reset configured channels for email addresses
def self.channel_cleanup def self.channel_cleanup
EmailAddress.all.each {|email_address| EmailAddress.all.each {|email_address|
next if !email_address.channel_id if email_address.channel_id && Channel.find_by(id: email_address.channel_id)
next if Channel.find_by(id: email_address.channel_id) if !email_address.active
email_address.channel_id = nil email_address.save
email_address.save end
next
end
if email_address.channel_id || email_address.active
email_address.save
end
} }
end end
private private
def channel_check def channel_check
return if Channel.find_by(id: channel_id) if channel_id && Channel.find_by(id: channel_id)
self.active = true
return true
end
self.channel_id = nil self.channel_id = nil
self.active = false
true
end end
end end