From 533c49926d5587271b5bc745756590b9034e187d Mon Sep 17 00:00:00 2001 From: Lekhika Dugtal Date: Thu, 9 May 2019 17:02:10 +0530 Subject: [PATCH] add card for people section with bootstrap 4 upgrade --- app/views/map/_peopleLeaflet.html.erb | 2 +- app/views/users/list.html.erb | 157 ++++++++++++++++++-------- test/integration/I18n_test.rb | 10 -- test/integration/public_pages_test.rb | 8 ++ 4 files changed, 116 insertions(+), 61 deletions(-) diff --git a/app/views/map/_peopleLeaflet.html.erb b/app/views/map/_peopleLeaflet.html.erb index 1b730448e3..ea1b8d1442 100644 --- a/app/views/map/_peopleLeaflet.html.erb +++ b/app/views/map/_peopleLeaflet.html.erb @@ -2,7 +2,7 @@ <% unique_id = rand(1000) %>
diff --git a/app/views/users/list.html.erb b/app/views/users/list.html.erb index 0e565c81fd..9529b6c06b 100644 --- a/app/views/users/list.html.erb +++ b/app/views/users/list.html.erb @@ -1,56 +1,113 @@ +
+
+
+<% if current_user && (current_user.role == "admin" || current_user.role == "moderator")%> +

<%= t('users.list.user_moderation') %>

+

<%= t('users.list.admins_ban_spam') %>

+<% end %> +

<%= raw t('People') %>

+
<%= t('Recently active on Publiclab') =%>
+ +
-
-
-
-

This page shows a list of all Public Lab contributors and is sorted by those who have posted most recently. Click the profile link to view their posting activity.

-
-
- <% if logged_in_as(['admin', 'moderator']) %> -

<%= t('users.list.user_moderation') %>

-

<%= t('users.list.admins_ban_spam') %>

- <% end %> -
-
-

<%= raw t('users.list.members_last_activity') %>

- <%= render :partial => "map/peopleLeaflet" , locals: {people: true , lat:23 , lon: 4} %> - - - - - - - - - - <% if logged_in_as(['admin', 'moderator']) %> - - <% end %> - <% @users.each do |user| %> - - - - - - - <% if logged_in_as(['admin', 'moderator']) %> - <% end %> - - <% end %> -
<%= t('users.list.username') %> <%= t('users.list.last_activity') %> <%= t('users.list.history') %> <%= t('users.list.joined') %> <%= t('users.list.moderation') %>
- - -
- +
+
+
+
+ +
+
+
+ <%= user.username %> +
+
Last Activity : <%= t = user.revisions.order(timestamp: :desc).first.try(:created_at);time_ago_in_words(t) if (t) %>
+
History : <%= user.nodes.count %> <%= t('users.list.notes_and_edits') %>
+
Joined : <%= distance_of_time_in_words(user.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %>
+
+ <% if current_user && (current_user.role == "admin" || current_user.role == "moderator") %> +
+ <% if user.status == 0 %> + <%= t('users.list.banned') %> + <% elsif user.status == 1 %> + <%= t('users.list.ban') %> + <% end %> +
+ <% end %> +
+
+
- <%= user.username %> -
<%= t = user.revisions.order(timestamp: :desc).first.try(:created_at);time_ago_in_words(t) if (t) %><%= user.nodes.count %> <%= t('users.list.notes_and_edits') %><%= distance_of_time_in_words(user.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %> - <% if user.status == 0 %> - <%= t('users.list.banned') %> - <% elsif user.status == 1 %> - <%= t('users.list.ban') %> - <% end %> -
+
<%= will_paginate @users, renderer: WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated %>
+
+<%= render :partial => "map/peopleLeaflet" , locals: {people: true , lat:23 , lon: 4} %> +
+
+<%= render :partial => "map/peopleLeaflet" , locals: {people: true , lat:23 , lon: 4} %> +
+
+
+ diff --git a/test/integration/I18n_test.rb b/test/integration/I18n_test.rb index edd10ce8fc..ae9aae44ba 100644 --- a/test/integration/I18n_test.rb +++ b/test/integration/I18n_test.rb @@ -242,16 +242,6 @@ class I18nTest < ActionDispatch::IntegrationTest end end - test 'should choose i18n for user/list' do - available_testing_locales.each do |lang| - get '/change_locale/' + lang.to_s - follow_redirect! - - get '/people' - assert_select 'th', I18n.t('users.list.username') - end - end - test 'should choose i18n for user/map' do available_testing_locales.each do |lang| get '/change_locale/' + lang.to_s diff --git a/test/integration/public_pages_test.rb b/test/integration/public_pages_test.rb index b91eb7a088..8079248816 100644 --- a/test/integration/public_pages_test.rb +++ b/test/integration/public_pages_test.rb @@ -96,4 +96,12 @@ def setup get '/assets' assert_response :success end + + test 'browse people page' do + get '/people' + assert_response :success + end + end + +