From 0a838114797f3037ddab2fc9570860b8265e98f9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 27 Oct 2016 01:09:10 +0200 Subject: [PATCH] Fixed issue#313 - Admin -> Channels -> Email -> Filters not shown / no name shown. --- .../app/controllers/_channel/email.coffee | 12 +++++------- .../app/models/_application_model.coffee | 4 ++++ .../javascripts/app/views/generic/table.jst.eco | 4 ++-- test/browser/admin_channel_email_test.rb | 16 +++++++++++++++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 7f31cc3fc..01b475d75 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -34,15 +34,14 @@ class App.ChannelEmail extends App.ControllerTabs class App.ChannelEmailFilter extends App.Controller events: - 'click [data-type=new]': 'new' + 'click [data-type=new]': 'new' constructor: -> super - - App.PostmasterFilter.subscribe( @render, initFetch: true ) + App.PostmasterFilter.subscribe(@render, initFetch: true) render: => - data = App.PostmasterFilter.search( sortBy: 'name' ) + data = App.PostmasterFilter.search(sortBy: 'name') template = $( '
' + App.i18n.translateContent('New') + '
' ) @@ -131,11 +130,10 @@ class App.ChannelEmailSignature extends App.Controller constructor: -> super - - App.Signature.subscribe( @render, initFetch: true ) + App.Signature.subscribe(@render, initFetch: true) render: => - data = App.Signature.search( sortBy: 'name' ) + data = App.Signature.search(sortBy: 'name') template = $( '
' + App.i18n.translateContent('New') + '
' ) diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index 7f420daef..3651c6381 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -544,6 +544,10 @@ class App.Model extends Spine.Model if data.assets App.Collection.loadAssets(data.assets) + # in case of no record_ids are there, no inital render is fired + if _.isEmpty(data.record_ids) + App[@className].trigger('refresh') + # find / load object else App[@className].refresh(data) diff --git a/app/assets/javascripts/app/views/generic/table.jst.eco b/app/assets/javascripts/app/views/generic/table.jst.eco index 68bd27239..c7d611a9b 100644 --- a/app/assets/javascripts/app/views/generic/table.jst.eco +++ b/app/assets/javascripts/app/views/generic/table.jst.eco @@ -17,10 +17,10 @@ <% end %> <% for item, i in @header: %> - <%= " align-#{ item.align }" if item.align %>" style="width:<%= item.displayWidth %>px" data-column-key="<%= item.name %>"> + <%= " align-#{ item.align }" if item.align %>" style="<% if item.displayWidth: %>width:<%= item.displayWidth %>px<% end %>" data-column-key="<%= item.name %>">
- <%- @T( item.display ) %> + <%- @T(item.display) %>
<% if item.sortOrderIcon: %> diff --git a/test/browser/admin_channel_email_test.rb b/test/browser/admin_channel_email_test.rb index a8938f504..78acf93d2 100644 --- a/test/browser/admin_channel_email_test.rb +++ b/test/browser/admin_channel_email_test.rb @@ -23,10 +23,24 @@ class AdminChannelEmailTest < TestCase click(css: 'a[href="#manage"]') click(css: '.content.active a[href="#channels/email"]') + # check if postmaster filter are shown + click(css: '.content.active a[href="#c-filter"]') + match( + css: '.content.active #c-filter .overview', + value: 'No Entries', + ) + + # check if signatures are shown + click(css: '.content.active a[href="#c-signature"]') + match( + css: '.content.active #c-signature .overview', + value: 'default', + ) + + click(css: '.content.active a[href="#c-account"]') click(css: '.content.active .js-channelNew') modal_ready() - set( css: '.modal input[name="realname"]', value: 'My System',