From a009cb0935958ad52a121c76f0d29244e8a1525c Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 30 Aug 2015 01:31:11 +0200 Subject: [PATCH] Some small improvements to email channel management. --- .../app/controllers/_channel/email.js.coffee | 11 +- .../channel/email_account_overview.jst.eco | 123 ++++++++++-------- app/controllers/channels_controller.rb | 14 +- 3 files changed, 85 insertions(+), 63 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_channel/email.js.coffee b/app/assets/javascripts/app/controllers/_channel/email.js.coffee index 339cce9b4..703beef20 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.js.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.js.coffee @@ -236,12 +236,12 @@ class App.ChannelEmailAccountOverview extends App.Controller success: (data, status, xhr) => # load assets - App.Collection.loadAssets( data.assets ) + App.Collection.loadAssets(data.assets) - @render() + @render(accounts_fixed: data.accounts_fixed) ) - render: => + render: (params = {}) => # get channels channels = App.Channel.search( filter: { area: 'Email::Account' } ) @@ -260,9 +260,10 @@ class App.ChannelEmailAccountOverview extends App.Controller channel = App.Channel.search( filter: { area: 'Email::Notification', active: true } )[0] @html App.view('channel/email_account_overview')( - channels: channels + channels: channels email_addresses_not_used: email_addresses_not_used - channel: channel + channel: channel + accounts_fixed: params.accounts_fixed ) wizard: (e) => 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 a5836e926..7af1f5c68 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 @@ -1,5 +1,14 @@

<%- @T('Email Accounts') %>

+<% if @accounts_fixed: %> +

<%- @T('Fixed email addresses') %>

+ +<% end %> + <% if !_.isEmpty(@email_addresses_not_used): %>

<%- @T('Not linked email addresses') %>

<% end %> - - - - - - - - - - - <% for channel in @channels: %> - - - - -
<%- @T('Inbound') %><%- @T('Outbound') %><%- @T('Email Adresses') %><%- @T('Action') %>
- <%- @T('State') %>: <%- @T(channel.status_in || 'unknown') %>
- - <%= channel.options.inbound.options.user %>
- <%= channel.options.inbound.options.host %> (<%= channel.options.inbound.adapter %>) -
-
- <%- @T('State') %>: <%- @T(channel.status_out || 'unknown') %>
- - <% if channel.options.outbound && channel.options.outbound.options: %> - <%= channel.options.outbound.options.user %>
- <%= channel.options.outbound.options.host %> - <% end %> - (<%= channel.options.outbound.adapter %>)
-
-
<%- @T('New') %> diff --git a/app/controllers/channels_controller.rb b/app/controllers/channels_controller.rb index c7bde6c30..a9bec86ee 100644 --- a/app/controllers/channels_controller.rb +++ b/app/controllers/channels_controller.rb @@ -217,17 +217,25 @@ curl http://localhost/api/v1/channels.json -v -u #{login}:#{password} -H "Conten def email_index return if deny_if_not_role(Z_ROLENAME_ADMIN) system_online_service = Setting.get('system_online_service') + accounts_fixed = [] assets = {} Channel.all.each {|channel| - next if system_online_service && channel.preferences && channel.preferences[:online_service_disable] + if system_online_service && channel.preferences && channel.preferences['online_service_disable'] + email_addresses = EmailAddress.where(channel_id: channel.id) + email_addresses.each {|email_address| + accounts_fixed.push email_address + } + next + end assets = channel.assets(assets) } EmailAddress.all.each {|email_address| - next if system_online_service && email_address.preferences && email_address.preferences[:online_service_disable] + next if system_online_service && email_address.preferences && email_address.preferences['online_service_disable'] assets = email_address.assets(assets) } render json: { - assets: assets + accounts_fixed: accounts_fixed, + assets: assets, } end