Commit 9712adf1f8984cc53e5e84bc7756584a67391b5a

Authored by Rodrigo Souto
1 parent 40426a5a

manage-spam: show only tabs that has spam

Showing 1 changed file with 14 additions and 13 deletions   Show diff stats
app/views/spam/index.rhtml
... ... @@ -2,26 +2,27 @@
2 2  
3 3 <h1><%= _('Manage SPAM') %></h1>
4 4  
  5 +<% no_tabs = @comment_spam.blank? && @task_spam.blank? %>
  6 +
  7 +<%= _('There are no spams to review.') if no_tabs %>
  8 +
5 9 <% button_bar do %>
6 10 <%= button :back, _('Back to control panel'), :controller => :profile_editor %>
7 11 <% end %>
8 12  
9 13 <%# FIXME should not need to replicate the article structure like this to be able to use the same formatting as the comments listing %>
10 14  
11   -<% if @task_spam.length > 0 %>
12   - <% tabs = [] %>
13   - <% tabs << {:title => _('Comment Spam'), :id => 'comment-spam',
14   - :content => (render :partial => 'comment_spam')} %>
15   - <% tabs << {:title => _('Task Spam'), :id => 'task-spam',
16   - :content => (render :partial => 'task_spam') } %>
17   - <%= render_tabs(tabs) %>
18   -<% else %>
19   - <%= render :partial => 'comment_spam' %>
20   -<% end %>
21   -
  15 +<% tabs = [] %>
  16 +<% tabs << {:title => _('Comment Spam'), :id => 'comment-spam',
  17 + :content => (render :partial => 'comment_spam')} if @comment_spam.present? %>
  18 +<% tabs << {:title => _('Task Spam'), :id => 'task-spam',
  19 + :content => (render :partial => 'task_spam') } if @task_spam.present? %>
  20 +<%= render_tabs(tabs) %>
22 21  
23   -<% button_bar do %>
24   - <%= button :back, _('Back to control panel'), :controller => :profile_editor %>
  22 +<% unless no_tabs %>
  23 + <% button_bar do %>
  24 + <%= button :back, _('Back to control panel'), :controller => :profile_editor %>
  25 + <% end %>
25 26 <% end %>
26 27  
27 28 <%= javascript_include_tag 'spam' %>
... ...