From 4ae6f72fff4512d63baec37aeec8e1aa620f4631 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 24 Sep 2015 11:26:50 +0200 Subject: [PATCH] refactors admin user search [#500] --- app/views/admin/officials/index.html.erb | 11 +---------- app/views/admin/officials/search.html.erb | 11 +---------- app/views/admin/shared/_user_search.html.erb | 10 ++++++++++ app/views/admin/verifications/index.html.erb | 11 +---------- config/locales/admin.en.yml | 8 ++++---- config/locales/admin.es.yml | 8 ++++---- 6 files changed, 21 insertions(+), 38 deletions(-) create mode 100644 app/views/admin/shared/_user_search.html.erb diff --git a/app/views/admin/officials/index.html.erb b/app/views/admin/officials/index.html.erb index 5e4e2e443..234ee7c21 100644 --- a/app/views/admin/officials/index.html.erb +++ b/app/views/admin/officials/index.html.erb @@ -1,15 +1,6 @@

<%= t("admin.officials.index.title") %>

-<%= form_for(User.new, url: search_admin_officials_path, as: :user, method: :get) do |f| %> -
-
- <%= text_field_tag :name_or_email, "", placeholder: t("admin.officials.index.search_placeholder") %> -
-
- <%= f.submit t("admin.officials.index.search"), class: "button radius success" %> -
-
-<% end %> +<%= render 'admin/shared/user_search', url: search_admin_officials_path %>

<%= page_entries_info @officials %>

diff --git a/app/views/admin/officials/search.html.erb b/app/views/admin/officials/search.html.erb index f2636a52e..b5ffcfcab 100644 --- a/app/views/admin/officials/search.html.erb +++ b/app/views/admin/officials/search.html.erb @@ -1,15 +1,6 @@

<%= t("admin.officials.search.title") %>

-<%= form_for(User.new, url: search_admin_officials_path, as: :user, method: :get) do |f| %> -
-
- <%= text_field_tag :name_or_email, "", placeholder: t("admin.officials.index.search_placeholder") %> -
-
- <%= f.submit t("admin.officials.search.search"), class: "button radius success" %> -
-
-<% end %> +<%= render 'admin/shared/user_search', url: search_admin_officials_path %>

<%= page_entries_info @users %>

diff --git a/app/views/admin/shared/_user_search.html.erb b/app/views/admin/shared/_user_search.html.erb new file mode 100644 index 000000000..978c33e8d --- /dev/null +++ b/app/views/admin/shared/_user_search.html.erb @@ -0,0 +1,10 @@ +<%= form_for(User.new, url: url, as: :user, method: :get) do |f| %> +
+
+ <%= text_field_tag :name_or_email, "", placeholder: t("admin.shared.user_search.placeholder") %> +
+
+ <%= f.submit t("admin.shared.user_search.button"), class: "button radius success" %> +
+
+<% end %> \ No newline at end of file diff --git a/app/views/admin/verifications/index.html.erb b/app/views/admin/verifications/index.html.erb index 4b1f56346..429972ba1 100644 --- a/app/views/admin/verifications/index.html.erb +++ b/app/views/admin/verifications/index.html.erb @@ -1,15 +1,6 @@

<%= t("admin.verifications.index.title") %>

-<%= form_for(User.new, url: search_admin_verifications_path, as: :user, method: :get) do |f| %> -
-
- <%= text_field_tag :name_or_email, "", placeholder: t("admin.verifications.index.search_placeholder") %> -
-
- <%= f.submit t("admin.verifications.index.search"), class: "button radius success" %> -
-
-<% end %> +<%= render 'admin/shared/user_search', url: search_admin_verifications_path %>

<%= page_entries_info @users %>

diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 4173e0f7e..39bf845b5 100644 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -22,6 +22,10 @@ en: moderators: Moderators stats: Statistics activity: Moderation Activity + shared: + user_search: + placeholder: 'Search user by name or email' + button: 'Search' organizations: index: title: Organizations @@ -101,8 +105,6 @@ en: verifications: index: title: Incomplete verifications - search_placeholder: 'Search user by name or email' - search: 'Search' phone_not_given: 'Phone not given' sms_code_not_confirmed: 'Has not confirmed the sms code' officials: @@ -114,8 +116,6 @@ en: level_5: Level 5 index: title: Officials - search_placeholder: 'Search user by name or email' - search: Search search: title: 'Officials: Search users' edit_official: Edit official diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 1c168c4f3..ced0e7af9 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -22,6 +22,10 @@ es: moderators: Moderadores stats: Estadísticas activity: Actividad de moderadores + shared: + user_search: + placeholder: 'Buscar usuario por nombre o email' + button: 'Buscar' organizations: index: title: Organizaciones @@ -101,8 +105,6 @@ es: verifications: index: title: Verificaciones incompletas - search_placeholder: 'Buscar usuario por nombre o email' - search: 'Buscar' phone_not_given: 'No ha dado su teléfono' sms_code_not_confirmed: 'No ha introducido su código de seguridad' officials: @@ -114,8 +116,6 @@ es: level_5: Nivel 5 index: title: Cargos Públicos - search_placeholder: 'Buscar usuario por nombre o email' - search: Buscar search: title: 'Cargos Públicos: Búsqueda de usuarios' edit_official: Editar cargo público