From 9712adf1f8984cc53e5e84bc7756584a67391b5a Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Thu, 24 Oct 2013 22:43:44 +0000 Subject: [PATCH] manage-spam: show only tabs that has spam --- app/views/spam/index.rhtml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/views/spam/index.rhtml b/app/views/spam/index.rhtml index 38431a4..36af68e 100644 --- a/app/views/spam/index.rhtml +++ b/app/views/spam/index.rhtml @@ -2,26 +2,27 @@

<%= _('Manage SPAM') %>

+<% no_tabs = @comment_spam.blank? && @task_spam.blank? %> + +<%= _('There are no spams to review.') if no_tabs %> + <% button_bar do %> <%= button :back, _('Back to control panel'), :controller => :profile_editor %> <% end %> <%# FIXME should not need to replicate the article structure like this to be able to use the same formatting as the comments listing %> -<% if @task_spam.length > 0 %> - <% tabs = [] %> - <% tabs << {:title => _('Comment Spam'), :id => 'comment-spam', - :content => (render :partial => 'comment_spam')} %> - <% tabs << {:title => _('Task Spam'), :id => 'task-spam', - :content => (render :partial => 'task_spam') } %> - <%= render_tabs(tabs) %> -<% else %> - <%= render :partial => 'comment_spam' %> -<% end %> - +<% tabs = [] %> +<% tabs << {:title => _('Comment Spam'), :id => 'comment-spam', + :content => (render :partial => 'comment_spam')} if @comment_spam.present? %> +<% tabs << {:title => _('Task Spam'), :id => 'task-spam', + :content => (render :partial => 'task_spam') } if @task_spam.present? %> +<%= render_tabs(tabs) %> -<% button_bar do %> - <%= button :back, _('Back to control panel'), :controller => :profile_editor %> +<% unless no_tabs %> + <% button_bar do %> + <%= button :back, _('Back to control panel'), :controller => :profile_editor %> + <% end %> <% end %> <%= javascript_include_tag 'spam' %> -- libgit2 0.21.2