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 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] before_action :load_user, only: [:confirm_hide, :restore]

View File

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

View File

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

View File

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

View File

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