From 2131c651f6b8f0febb22145dc34a01176d612701 Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 25 Oct 2017 18:47:26 +0200 Subject: [PATCH] improves admin valuators views --- app/views/admin/valuators/index.html.erb | 70 ++++++++++++----------- app/views/admin/valuators/search.html.erb | 55 +++++++++++------- spec/features/admin/valuators_spec.rb | 2 +- 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/app/views/admin/valuators/index.html.erb b/app/views/admin/valuators/index.html.erb index bcb723029..622d01307 100644 --- a/app/views/admin/valuators/index.html.erb +++ b/app/views/admin/valuators/index.html.erb @@ -2,39 +2,41 @@ <%= render 'admin/shared/user_search', url: search_admin_valuators_path %> -<% if @valuators.any? %> -

<%= page_entries_info @valuators %>

+
+ <% if @valuators.any? %> +

<%= page_entries_info @valuators %>

- - - - - - - - <% @valuators.each do |valuator| %> - - - - - - <% end %> - -
<%= t("admin.valuators.index.name") %><%= t("admin.valuators.index.email") %><%= t("admin.valuators.index.description") %>
- <%= valuator.name %> - - <%= valuator.email %> - - <% if valuator.description.present? %> - <%= valuator.description %> - <% else %> - <%= t("admin.valuators.index.no_description") %> - <% end %> -
+ + + + + + + + <% @valuators.each do |valuator| %> + + + + + + <% end %> + +
<%= t("admin.valuators.index.name") %><%= t("admin.valuators.index.email") %><%= t("admin.valuators.index.description") %>
+ <%= valuator.name %> + + <%= valuator.email %> + + <% if valuator.description.present? %> + <%= valuator.description %> + <% else %> + <%= t("admin.valuators.index.no_description") %> + <% end %> +
- <%= paginate @valuators %> -<% else %> -
- <%= t("admin.valuators.index.no_valuators") %> -
-<% end %> + <%= paginate @valuators %> + <% else %> +
+ <%= t("admin.valuators.index.no_valuators") %> +
+ <% end %> +
diff --git a/app/views/admin/valuators/search.html.erb b/app/views/admin/valuators/search.html.erb index 4663a944b..9f5448c43 100644 --- a/app/views/admin/valuators/search.html.erb +++ b/app/views/admin/valuators/search.html.erb @@ -2,26 +2,41 @@ <%= render 'admin/shared/user_search', url: search_admin_valuators_path %> -

<%= page_entries_info @users %>

+
+ <% if @users.any? %> +

<%= page_entries_info @users %>

- - <% @users.each do |user| %> - - - -
<%= user.name %><%= user.email %> - <% if user.valuator? && user.valuator.description.present? %> - <%= user.valuator.description %> - <% else %> - <%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %> - <%= f.text_field :description, - label: false, - placeholder: t("admin.valuators.valuator.description_placeholder") %> - <%= f.hidden_field :user_id %> - <%= f.submit t("admin.valuators.valuator.add"), class: "button success float-left" %> - <% end %> + + + + + + + + <% @users.each do |user| %> + + + + + <% end %> - - + +
<%= t("admin.valuators.index.name") %><%= t("admin.valuators.index.email") %><%= t("admin.valuators.index.description") %>
<%= user.name %><%= user.email %> + <% if user.valuator? && user.valuator.description.present? %> + <%= user.valuator.description %> + <% else %> + <%= form_for Valuator.new(user: user), url: admin_valuators_path do |f| %> + <%= f.text_field :description, + label: false, + placeholder: t("admin.valuators.valuator.description_placeholder") %> + <%= f.hidden_field :user_id %> + <%= f.submit t("admin.valuators.valuator.add"), class: "button success float-left" %> + <% end %> + <% end %> +
+ <% else %> +
+ <%= t("admin.shared.no_search_results") %> +
<% end %> -
+
diff --git a/spec/features/admin/valuators_spec.rb b/spec/features/admin/valuators_spec.rb index 86f2c89e9..bb631cbc3 100644 --- a/spec/features/admin/valuators_spec.rb +++ b/spec/features/admin/valuators_spec.rb @@ -47,7 +47,7 @@ feature 'Admin valuators' do click_button 'Search' expect(page).to have_content('Valuators: User search') - expect(page).to have_content('users cannot be found') + expect(page).to have_content('No results found') expect(page).to_not have_content(@valuator1.name) expect(page).to_not have_content(@valuator2.name) end