From cc71bcc39fcc53d5390839455fc8c6d99e8374ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20de=20Villamil?= Date: Thu, 29 Aug 2013 18:58:57 +0200 Subject: [PATCH] We don't need multiple helpers to do one thing --- app/helpers/admin/base_helper.rb | 8 ++------ app/views/admin/content/_article_list.html.erb | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/helpers/admin/base_helper.rb b/app/helpers/admin/base_helper.rb index 5bc7520a32..6bc1a472f3 100644 --- a/app/helpers/admin/base_helper.rb +++ b/app/helpers/admin/base_helper.rb @@ -80,17 +80,13 @@ def task_overview content_tag :li, link_to(_('Back to list'), :action => 'index') end - def render_empty_table(cols) + def render_void_table(size, cols) + return unless size == 0 content_tag(:tr) do content_tag(:td, _("There are no %s yet. Why don't you start and create one?", _(controller.controller_name)), { colspan: cols}) end end - def render_void_table(size, cols) - return unless size == 0 - render_empty_table(cols) - end - def cancel_or_save(message=_("Save")) "#{cancel} #{_("or")} #{save(message)}" end diff --git a/app/views/admin/content/_article_list.html.erb b/app/views/admin/content/_article_list.html.erb index c000700472..ec219e4a30 100644 --- a/app/views/admin/content/_article_list.html.erb +++ b/app/views/admin/content/_article_list.html.erb @@ -1,4 +1,4 @@ -<%= render_empty_table(7) if @articles.empty? %> +<%= render_void_table(@articles.size, 7) %> <% for article in @articles %>