diff --git a/app/models/drupal_user.rb b/app/models/drupal_user.rb index e1e171ceb5..a20bc4d556 100644 --- a/app/models/drupal_user.rb +++ b/app/models/drupal_user.rb @@ -141,6 +141,10 @@ def note_count Node.where(status: 1, uid: uid, type: 'note').count end + def revision_count + Revision.where(uid: uid).count + end + def node_count Node.where(status: 1, uid: uid).count + Revision.where(uid: uid).count end diff --git a/app/views/notes/index.html.erb b/app/views/notes/index.html.erb index 811b9c7d3b..f924b4794d 100644 --- a/app/views/notes/index.html.erb +++ b/app/views/notes/index.html.erb @@ -11,7 +11,7 @@ <% elsif params[:action] == "author_topic" %>

<%= raw t('notes.index.research_on', :tags => @tagnames.join(', '), :url1 => "/people/"+@user.name, :user_name => @user.name) %>
<%= raw t('notes.index.research_notes_and_wiki_edits_with_time', :count => @user.node_count, :time => time_ago_in_words(@user.created_at)) %>

<% elsif params[:action] == "author" %> -

<%= raw t('notes.index.research_by', :url1 => "/people/"+@user.name, :user_name => @user.name) %> <%= raw t('notes.index.research_notes_and_wiki_edits', :count => @user.node_count) %> <% if @user.notes.length > 0 %><%= raw t('notes.index.starting_time', :time => time_ago_in_words(@user.created_at)) %><% end %>

+

<%= raw t('notes.index.research_by', :url1 => "/people/"+@user.name, :user_name => @user.name) %> <%= raw t('notes.index.research_notes_and_wiki_edits', :count1 => @user.note_count, :count2 => @user.revision_count) %> <% if @user.notes.length > 0 %><%= raw t('notes.index.starting_time', :time => time_ago_in_words(@user.created_at)) %><% end %>

<% else %>

<%= raw t('notes.index.research_notes_ideas_and_documentation') %>

<% end %> diff --git a/app/views/users/profile.html.erb b/app/views/users/profile.html.erb index c37090e745..d42b23c376 100644 --- a/app/views/users/profile.html.erb +++ b/app/views/users/profile.html.erb @@ -4,7 +4,7 @@

<%= @user.name %> <%= @user.new_contributor %> - <%= @user.node_count %> <%= raw t('users.profile.notes_and_edits', :url1 => "/notes/author/"+@user.name) %> + <%= @user.note_count %> research notes and <%= @user.revision_count %> wiki edits <% if current_user && current_user.role == "admin" %> | <%= @user.email %><% end %> <% if @user.role == "moderator" %> | <%= t('users.profile.moderator') %><% end %> <% if @user.role == "admin" %> | <%= t('users.profile.admin') %><% end %> @@ -18,10 +18,10 @@

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

<%= Answer.where(uid: @profile_user.id).count %> answers posted

<%= @count_activities_posted %> activities posted

<%= @count_activities_attempted %> activities attempted

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

@@ -39,7 +39,7 @@
-
+
@@ -60,29 +60,29 @@
<% if current_user && current_user.uid == @profile_user.uid %> -
- <%= render :partial => "notes/draft_notes" %> -
+
+ <%= render :partial => "notes/draft_notes" %> +
<% end %>
-
-
- Asked - Answered -
+
+
+ Asked + Answered +
-
-
- <%= render :partial => "questions/questions" %> -
+
+
+ <%= render :partial => "questions/questions" %> +
-
- <%= render :partial => "users/answered" %> -
-
-
+
+ <%= render :partial => "users/answered" %> +
+
+

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

@@ -105,10 +105,10 @@
<% if @user.user %> - <% @user.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 %> + <% @user.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 %> <% end %>
@@ -127,25 +127,25 @@ <%= render :partial => "tag/tagging", locals: { url: "/profile/tags/create/#{ @user.id }", parent: :profile } %>
- <% if @twitter.nil? == false %> + <% if @twitter.nil? == false %> - + <% end %> <% if @facebook.nil? == false %> - - - + + + <% end %> <% if @github.nil? == false %> - - - + + + <% end %> <% if @instagram.nil? == false %> - - - + + + <% end %>

@@ -153,11 +153,11 @@ <% unless current_user == @profile_user %>
- <% if current_user.following?(@profile_user) %> - <%= render 'unfollow' %> - <% else %> - <%= render 'follow' %> - <% end %> + <% if current_user.following?(@profile_user) %> + <%= render 'unfollow' %> + <% else %> + <%= render 'follow' %> + <% end %>

<% end %> @@ -225,7 +225,7 @@
<% if params[:preview] %> -
+
@@ -243,23 +243,23 @@
<%= link_to @profile_user.following_users.count, following_path(id: @profile_user.username) %>
-
+
<% end %> @@ -269,39 +269,39 @@