adds pending filter to admin/users

This commit is contained in:
Juanjo Bazán
2015-09-06 21:58:34 +02:00
parent e618c12344
commit 9104242eed
5 changed files with 17 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
class Admin::UsersController < Admin::BaseController
has_filters %w{all with_confirmed_hide}, only: :index
has_filters %w{without_confirmed_hide all with_confirmed_hide}, only: :index
before_action :load_user, only: [:confirm_hide, :restore]

View File

@@ -14,11 +14,12 @@
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button radius tiny success right" %>
<% unless user.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_user_path(user, request.query_parameters),
method: :put,
class: "button radius tiny warning right" %>
<% end %>
</li>
<% end %>
</ul>

View File

@@ -75,6 +75,7 @@ en:
filters:
all: All
with_confirmed_hide: Confirmed
without_confirmed_hide: Pending
show:
title: "User activity from %{user}"
back: Back

View File

@@ -75,6 +75,7 @@ es:
filters:
all: Todos
with_confirmed_hide: Confirmados
without_confirmed_hide: Pendientes
show:
title: "Actividad del usuario %{user}"
back: Volver

View File

@@ -40,23 +40,32 @@ feature 'Admin users' do
click_link 'Confirm'
expect(page).to_not have_content(user.username)
click_link('Confirmed')
expect(page).to have_content(user.username)
expect(page).to have_content('Confirmed')
expect(user.reload).to be_confirmed_hide
end
scenario "Current filter is properly highlighted" do
visit admin_users_path
expect(page).to_not have_link('All')
expect(page).to_not have_link('Pending')
expect(page).to have_link('All')
expect(page).to have_link('Confirmed')
visit admin_users_path(filter: 'Pending')
expect(page).to_not have_link('Pending')
expect(page).to have_link('All')
expect(page).to have_link('Confirmed')
visit admin_users_path(filter: 'all')
expect(page).to have_link('Pending')
expect(page).to_not have_link('All')
expect(page).to have_link('Confirmed')
visit admin_users_path(filter: 'with_confirmed_hide')
expect(page).to have_link('All')
expect(page).to have_link('Pending')
expect(page).to_not have_link('Confirmed')
end