From d4df7c7f65da0ec6b56c88bc971a9376fee07a8c Mon Sep 17 00:00:00 2001 From: Lekhika Dugtal Date: Sat, 6 Jul 2019 18:00:46 +0530 Subject: [PATCH 1/4] Profile page : Chnage col spans and bring map to top-left --- app/views/map/_userLeaflet.html.erb | 6 +++--- app/views/users/profile.html.erb | 25 ++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/views/map/_userLeaflet.html.erb b/app/views/map/_userLeaflet.html.erb index 22e4203c33..f3129f5980 100644 --- a/app/views/map/_userLeaflet.html.erb +++ b/app/views/map/_userLeaflet.html.erb @@ -4,7 +4,7 @@ <% if haslocation == true %>
<% else %> -
- +
+

Learn about privacy

diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index 73bb00dcc8..6dc631dd46 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -1,8 +1,13 @@ -
-
+
-

<%= @profile_user.name %> <%= @profile_user.new_contributor %> + <% if !@map_lat.nil? && !@map_lon.nil? %> + <%= render :partial => "map/userLeaflet" , locals: { haslocation: true, user: @profile_user } %> + <% elsif !current_user.nil? && current_user.id == @profile_user.id %> + <%= render :partial => "map/userLeaflet" , locals: { haslocation: false, user: @profile_user } %> + <% end %> + +

<%= @profile_user.name %> <%= @profile_user.new_contributor %> <%= @profile_user.note_count %> research notes and <%= @profile_user.revisions.count %> wiki edits @@ -19,12 +24,7 @@

<%= Node.questions.where(status: 1, uid: @profile_user.id).length %> questions asked

<%= Comment.where(uid: @profile_user.id).count %> comments posted

-

<%= @count_activities_posted %> activities posted

<%= @count_activities_attempted %> activities attempted

- <% if !@map_lat.nil? && !@map_lon.nil? %> - <%= render :partial => "map/userLeaflet" , locals: { haslocation: true, user: @profile_user } %> - <% elsif !current_user.nil? && current_user.id == @profile_user.id %> - <%= render :partial => "map/userLeaflet" , locals: { haslocation: false, user: @profile_user } %> - <% end %> +

<%= @count_activities_posted %> activities posted

<%= @count_activities_attempted %> activities attempted


@@ -122,9 +122,12 @@

-
+
+
+ +
- +
From 45f24c620d84191e64ff66df4c15fc1ccbbde696 Mon Sep 17 00:00:00 2001 From: Lekhika Dugtal Date: Tue, 23 Jul 2019 11:42:19 +0530 Subject: [PATCH 2/4] Profile page : Add topic Cards for profile page --- app/views/tag/_profileCard.html.erb | 42 +++++++++++ app/views/users/profile.html.erb | 88 +----------------------- test/functional/users_controller_test.rb | 11 --- 3 files changed, 45 insertions(+), 96 deletions(-) create mode 100644 app/views/tag/_profileCard.html.erb diff --git a/app/views/tag/_profileCard.html.erb b/app/views/tag/_profileCard.html.erb new file mode 100644 index 0000000000..9edab12979 --- /dev/null +++ b/app/views/tag/_profileCard.html.erb @@ -0,0 +1,42 @@ + +
+<% @profile_user.tags.each do |tag| %> +
+
+

<%= tag.name %>

+

<%= Tag.follower_count(tag.name) %> people discussing

+
+
+
+ <% Tag.find_nodes_by_type(tag.name, type = 'note', limit = 3).each do |node| %> +
+ <% if node.author.name == @profile_user.name %> + <% if node.main_image %> + + <% elsif node.scraped_image %> + + <% end %> +

target="_blank"<% end %> href="<%= node.path %>"><%= (node.type == 'note') ? node.title : node.latest.title %>

+

by target="_blank"<% end %> href="/profile/<%= node.author.name %>">@<%= node.author.name %>

+ <% end %> +
+ <% end %> +
+
+ +
+<% end %> +
diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index 6dc631dd46..99156b40bd 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -28,98 +28,16 @@

-
- - -
-
- -
-
- -
- -
- -
-
- <%= render :partial => "notes/notes" %> -
- -
- <%= render :partial => "notes/coauthored_notes" %> -
- - <% if current_user && current_user.uid == @profile_user.uid %> -
- <%= render :partial => "notes/draft_notes" %> -
- <% end %> -
-
- -
- - -
-
- <%= render :partial => "questions/questions" %> -
- -
- <%= render :partial => "users/answered" %> -
-
-
- -
-

<%= raw t('users.profile.view_these_maps', :url1 => "//mapknitter.org/profile/"+@profile_user.name) %>

- - - - - - -
<%= t('users.profile.title') %><%= t('users.profile.creation_date') %><%= t('users.profile.image') %>
-
- -
- <%= render partial: 'comments/comments', locals: { comments: current_user &.can_moderate? ? @all_comments : @normal_comments } %> -
+ <%= render :partial => "tag/profileCard" %> -
- <%= render :partial => "users/likes" %> -
+
<%= will_paginate @tags, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer if @paginated %>
-
- <% @profile_user.barnstars.each do |tag| %> -

<%= raw t('users.profile.barnstar_awarded_to_by', :url1 => "/profile/"+tag.node.author.name, :author => tag.node.author.name, :url2 => "/wiki/barnstars#"+tag.name.split(':').last.split('-').each{|w| w.capitalize!}.join('+'), :barnstar => tag.name.split(':').last.split('-').each{|w| w.capitalize!}.join(' '), :url3 => "/profile/"+tag.author.username, :awarder => tag.author.username, :url4 => tag.node.path, :work => tag.node.title) %>

-
- <% end %> -
-

+
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index febafeae89..fb4739265b 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -147,17 +147,6 @@ def setup end end - test 'should list notes and questions in user profile' do - user = users(:jeff) - get :profile, params: { id: user.username } - assert_not_nil assigns(:notes) - assert_not_nil assigns(:questions) - selector = css_select '#asked .note-question' - assert_equal selector.size, 2 - selector = css_select '#answered .note-answer' - assert_equal selector.size, 1 - end - test 'should get comments and render comments/index template' do user = users(:jeff) get :comments, params: { id: user.id } From 77534829fe5c3de29128254f9d96b6a8f013797c Mon Sep 17 00:00:00 2001 From: Lekhika Dugtal Date: Thu, 25 Jul 2019 18:58:32 +0530 Subject: [PATCH 3/4] Add information of user --- app/views/users/profile.html.erb | 34 +++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index 99156b40bd..4928a0ce87 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -10,7 +10,6 @@

<%= @profile_user.name %> <%= @profile_user.new_contributor %> - <%= @profile_user.note_count %> research notes and <%= @profile_user.revisions.count %> wiki edits <% if logged_in_as(['admin']) %> | <%= @profile_user.email %><% end %> | <%= raw t('users.profile.joined_time_ago', :time_ago => distance_of_time_in_words(@profile_user.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' })) %> <% if @profile_user.role == "moderator" %> | <%= t('users.profile.moderator') %><% end %> @@ -21,11 +20,6 @@

<%= raw auto_link(RDiscount.new(@profile_user.bio || '').to_html, :sanitize => false) %>

-
-

@@ -45,13 +39,26 @@
- +
+ <%= render :partial => "tag/tagging", locals: { url: "/profile/tags/create/#{ @profile_user.id }", parent: :profile, user: @profile_user } %> +
+ +
+