Rename users to hidden users in admin

This commit is contained in:
Amaia Castro
2017-05-25 12:35:14 +02:00
parent 60842a548c
commit 29d994dd4a
14 changed files with 59 additions and 59 deletions

View File

@@ -1,4 +1,4 @@
class Admin::UsersController < Admin::BaseController class Admin::HiddenUsersController < Admin::BaseController
has_filters %w{without_confirmed_hide 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]
@@ -30,4 +30,4 @@ class Admin::UsersController < Admin::BaseController
@user = User.with_hidden.find(params[:id]) @user = User.with_hidden.find(params[:id])
end end
end end

View File

@@ -17,7 +17,7 @@ module AdminHelper
end end
def menu_moderated_content? def menu_moderated_content?
["proposals", "debates", "comments", "users"].include? controller_name ["proposals", "debates", "comments", "hidden_users"].include? controller_name
end end
def menu_budget? def menu_budget?

View File

@@ -33,8 +33,8 @@
<%= link_to t("admin.menu.hidden_comments"), admin_comments_path %> <%= link_to t("admin.menu.hidden_comments"), admin_comments_path %>
</li> </li>
<li <%= "class=active" if controller_name == "users" %>> <li <%= "class=active" if controller_name == "hidden_users" %>>
<%= link_to t("admin.menu.hidden_users"), admin_users_path %> <%= link_to t("admin.menu.hidden_users"), admin_hidden_users_path %>
</li> </li>
</ul> </ul>
</li> </li>

View File

@@ -16,7 +16,7 @@
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.budget_investments.show.by") %>:</strong> <strong><%= t("admin.budget_investments.show.by") %>:</strong>
<%= link_to @investment.author.name, admin_user_path(@investment.author) %> <%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %>
</p> </p>
</div> </div>

View File

@@ -1,6 +1,6 @@
<h2><%= t("admin.users.index.title") %></h2> <h2><%= t("admin.hidden_users.index.title") %></h2>
<%= render 'shared/filter_subnav', i18n_namespace: "admin.users.index" %> <%= render 'shared/filter_subnav', i18n_namespace: "admin.hidden_users.index" %>
<h3><%= page_entries_info @users %></h3> <h3><%= page_entries_info @users %></h3>
@@ -8,18 +8,18 @@
<% @users.each do |user| %> <% @users.each do |user| %>
<tr id="<%= dom_id(user) %>"> <tr id="<%= dom_id(user) %>">
<td> <td>
<p><%= link_to user.name, admin_user_path(user) %></p> <p><%= link_to user.name, admin_hidden_user_path(user) %></p>
</td> </td>
<td class="text-right"> <td class="text-right">
<%= link_to t("admin.actions.restore"), <%= link_to t("admin.actions.restore"),
restore_admin_user_path(user, request.query_parameters), restore_admin_hidden_user_path(user, request.query_parameters),
method: :put, method: :put,
data: { confirm: t("admin.actions.confirm") }, data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover" %> class: "button hollow on-hover" %>
<% unless user.confirmed_hide? %> <% 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_hidden_user_path(user, request.query_parameters),
method: :put, method: :put,
class: "button hollow warning on-hover" %> class: "button hollow warning on-hover" %>
<% end %> <% end %>

View File

@@ -1,11 +1,11 @@
<%= render 'shared/back_link' %> <%= render 'shared/back_link' %>
<h2><%= t("admin.users.show.title", user: @user.name) %></h2> <h2><%= t("admin.hidden_users.show.title", user: @user.name) %></h2>
<p> <p>
<strong><%= t("admin.users.show.email") %></strong> <%= @user.email %> | <strong><%= t("admin.hidden_users.show.email") %></strong> <%= @user.email %> |
<strong><%= t("admin.users.show.registered_at") %></strong> <%= @user.confirmed_at %> | <strong><%= t("admin.hidden_users.show.registered_at") %></strong> <%= @user.confirmed_at %> |
<strong><%= t("admin.users.show.hidden_at") %></strong> <%= @user.hidden_at %> <strong><%= t("admin.hidden_users.show.hidden_at") %></strong> <%= @user.hidden_at %>
</p> </p>
<% if @debates.present? %> <% if @debates.present? %>

View File

@@ -16,7 +16,7 @@
<div class="small-12 medium-4 column"> <div class="small-12 medium-4 column">
<p> <p>
<strong><%= t("admin.spending_proposals.show.by") %>:</strong> <strong><%= t("admin.spending_proposals.show.by") %>:</strong>
<%= link_to @spending_proposal.author.name, admin_user_path(@spending_proposal.author) %> <%= link_to @spending_proposal.author.name, admin_hidden_user_path(@spending_proposal.author) %>
</p> </p>
</div> </div>

View File

@@ -8,7 +8,7 @@
<% @users.each do |user| %> <% @users.each do |user| %>
<tr id="<%= dom_id(user) %>"> <tr id="<%= dom_id(user) %>">
<td> <td>
<%= link_to user.name, admin_user_path(user) %> <%= link_to user.name, admin_hidden_user_path(user) %>
</td> </td>
<td> <td>
<%= render "pending_step", user: user %> <%= render "pending_step", user: user %>
@@ -17,4 +17,4 @@
<% end %> <% end %>
</table> </table>
<%= paginate @users %> <%= paginate @users %>

View File

@@ -126,7 +126,7 @@ ignore_unused:
- 'admin.budget_investments.index.filter*' - 'admin.budget_investments.index.filter*'
- 'admin.spending_proposals.index.filter*' - 'admin.spending_proposals.index.filter*'
- 'admin.organizations.index.filter*' - 'admin.organizations.index.filter*'
- 'admin.users.index.filter*' - 'admin.hidden_users.index.filter*'
- 'admin.activity.show.filter*' - 'admin.activity.show.filter*'
- 'admin.legislation.processes.index.filter*' - 'admin.legislation.processes.index.filter*'
- 'admin.legislation.processes.*.submit_button' - 'admin.legislation.processes.*.submit_button'

View File

@@ -181,6 +181,19 @@ en:
with_confirmed_hide: Confirmed with_confirmed_hide: Confirmed
without_confirmed_hide: Pending without_confirmed_hide: Pending
title: Hidden debates title: Hidden debates
hidden_users:
index:
filter: Filter
filters:
all: All
with_confirmed_hide: Confirmed
without_confirmed_hide: Pending
title: Hidden users
show:
email: 'Email:'
hidden_at: 'Hidden at:'
registered_at: 'Registered at:'
title: Activity of user (%{user})
legislation: legislation:
processes: processes:
create: create:
@@ -803,19 +816,6 @@ en:
name: name:
placeholder: Type the name of the topic placeholder: Type the name of the topic
update: Update Topic update: Update Topic
users:
index:
filter: Filter
filters:
all: All
with_confirmed_hide: Confirmed
without_confirmed_hide: Pending
title: Hidden users
show:
email: 'Email:'
hidden_at: 'Hidden at:'
registered_at: 'Registered at:'
title: Activity of user (%{user})
verifications: verifications:
index: index:
phone_not_given: Phone not given phone_not_given: Phone not given

View File

@@ -181,6 +181,19 @@ es:
with_confirmed_hide: Confirmados with_confirmed_hide: Confirmados
without_confirmed_hide: Pendientes without_confirmed_hide: Pendientes
title: Debates ocultos title: Debates ocultos
hidden_users:
index:
filter: Filtro
filters:
all: Todos
with_confirmed_hide: Confirmados
without_confirmed_hide: Pendientes
title: Usuarios bloqueados
show:
email: 'Email:'
hidden_at: 'Bloqueado:'
registered_at: 'Fecha de alta:'
title: Actividad del usuario (%{user})
legislation: legislation:
processes: processes:
create: create:
@@ -803,19 +816,6 @@ es:
name: name:
placeholder: Escribe el nombre del tema placeholder: Escribe el nombre del tema
update: Actualizar Tema update: Actualizar Tema
users:
index:
filter: Filtro
filters:
all: Todos
with_confirmed_hide: Confirmados
without_confirmed_hide: Pendientes
title: Usuarios bloqueados
show:
email: 'Email:'
hidden_at: 'Bloqueado:'
registered_at: 'Fecha de alta:'
title: Actividad del usuario (%{user})
verifications: verifications:
index: index:
phone_not_given: No ha dado su teléfono phone_not_given: No ha dado su teléfono

View File

@@ -161,7 +161,7 @@ Rails.application.routes.draw do
end end
end end
resources :users, only: [:index, :show] do resources :hidden_users, only: [:index, :show] do
member do member do
put :restore put :restore
put :confirm_hide put :confirm_hide

View File

@@ -314,7 +314,7 @@ feature 'Admin activity' do
scenario "Shows admin restores" do scenario "Shows admin restores" do
user = create(:user, :hidden) user = create(:user, :hidden)
visit admin_users_path visit admin_hidden_users_path
within("#user_#{user.id}") do within("#user_#{user.id}") do
click_on "Restore" click_on "Restore"
@@ -331,4 +331,4 @@ feature 'Admin activity' do
end end
end end
end end

View File

@@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
feature 'Admin users' do feature 'Admin hidden users' do
background do background do
admin = create(:administrator) admin = create(:administrator)
@@ -15,7 +15,7 @@ feature 'Admin users' do
comment1 = create(:comment, :hidden, user: user, commentable: debate2, body: "You have the manners of a beggar") comment1 = create(:comment, :hidden, user: user, commentable: debate2, body: "You have the manners of a beggar")
comment2 = create(:comment, user: user, commentable: debate2, body: 'Not Spam') comment2 = create(:comment, user: user, commentable: debate2, body: 'Not Spam')
visit admin_user_path(user) visit admin_hidden_user_path(user)
expect(page).to have_content(debate1.title) expect(page).to have_content(debate1.title)
expect(page).to have_content(debate2.title) expect(page).to have_content(debate2.title)
@@ -25,7 +25,7 @@ feature 'Admin users' do
scenario 'Restore' do scenario 'Restore' do
user = create(:user, :hidden) user = create(:user, :hidden)
visit admin_users_path visit admin_hidden_users_path
click_link 'Restore' click_link 'Restore'
@@ -36,7 +36,7 @@ feature 'Admin users' do
scenario 'Confirm hide' do scenario 'Confirm hide' do
user = create(:user, :hidden) user = create(:user, :hidden)
visit admin_users_path visit admin_hidden_users_path
click_link 'Confirm' click_link 'Confirm'
@@ -48,22 +48,22 @@ feature 'Admin users' do
end end
scenario "Current filter is properly highlighted" do scenario "Current filter is properly highlighted" do
visit admin_users_path visit admin_hidden_users_path
expect(page).to_not have_link('Pending') expect(page).to_not have_link('Pending')
expect(page).to have_link('All') expect(page).to have_link('All')
expect(page).to have_link('Confirmed') expect(page).to have_link('Confirmed')
visit admin_users_path(filter: 'Pending') visit admin_hidden_users_path(filter: 'Pending')
expect(page).to_not have_link('Pending') expect(page).to_not have_link('Pending')
expect(page).to have_link('All') 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_hidden_users_path(filter: 'all')
expect(page).to have_link('Pending') 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_hidden_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 have_link('Pending')
expect(page).to_not have_link('Confirmed') expect(page).to_not have_link('Confirmed')
@@ -73,11 +73,11 @@ feature 'Admin users' do
create(:user, :hidden, username: "Unconfirmed") create(:user, :hidden, username: "Unconfirmed")
create(:user, :hidden, :with_confirmed_hide, username: "Confirmed user") create(:user, :hidden, :with_confirmed_hide, username: "Confirmed user")
visit admin_users_path(filter: 'all') visit admin_hidden_users_path(filter: 'all')
expect(page).to have_content('Unconfirmed') expect(page).to have_content('Unconfirmed')
expect(page).to have_content('Confirmed user') expect(page).to have_content('Confirmed user')
visit admin_users_path(filter: 'with_confirmed_hide') visit admin_hidden_users_path(filter: 'with_confirmed_hide')
expect(page).to_not have_content('Unconfirmed') expect(page).to_not have_content('Unconfirmed')
expect(page).to have_content('Confirmed user') expect(page).to have_content('Confirmed user')
end end
@@ -86,7 +86,7 @@ feature 'Admin users' do
per_page = Kaminari.config.default_per_page per_page = Kaminari.config.default_per_page
(per_page + 2).times { create(:user, :hidden, :with_confirmed_hide) } (per_page + 2).times { create(:user, :hidden, :with_confirmed_hide) }
visit admin_users_path(filter: 'with_confirmed_hide', page: 2) visit admin_hidden_users_path(filter: 'with_confirmed_hide', page: 2)
click_on('Restore', match: :first, exact: true) click_on('Restore', match: :first, exact: true)