Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats on profile page #2131

Merged
merged 3 commits into from Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Expand Up @@ -131,8 +131,8 @@ def profile
@twitter = @profile_user.social_link("twitter")
@facebook = @profile_user.social_link("facebook")
@instagram = @profile_user.social_link("instagram")


@count_activities_posted = Tag.tagged_nodes_by_author("activity:*", @user).count
@count_activities_attempted = Tag.tagged_nodes_by_author("replication:*", @user).count
@map_lat = nil
@map_lon = nil
@map_blurred = nil
Expand Down
8 changes: 4 additions & 4 deletions app/views/users/profile.html.erb
Expand Up @@ -5,7 +5,7 @@
<img class="img-circle" id="profile-photo" style="width:50%;margin-bottom:20px;" src="<%= @user.user.profile_image %>" />
</div>
<% end %>

<div style="text-align: -webkit-center;">
<% if @twitter.nil? == false %>
<a href="<%= @twitter %>" >
Expand Down Expand Up @@ -95,7 +95,7 @@
<% if @profile_user && current_user && @profile_user == current_user %>
<button id="link_social_media" class="btn btn-default btn-block">Link Social media</button>
<% end %>

<hr />

<% if params[:preview] %>
Expand Down Expand Up @@ -158,8 +158,8 @@

<hr />
<div class="row" id="highlight" style=" text-align: center;">
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= Node.questions.where(status: 1, uid: @user.id).length %> questions asked <br><br> <%= Answer.where(uid: @profile_user.id).count %> answers posted</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><%= Comment.where(uid: @profile_user.id).count %> comments posted</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><a href = "/tag/question:*/author/<%= params[:id] %>"><%= Node.questions.where(status: 1, uid: @user.id).length %> questions asked </a><br><br> <%= Answer.where(uid: @profile_user.id).count %> answers posted</h3>
<h3 class="col-md-4 col-xs-12 col-sm-4"><a href = "/tag/activity:*/author/<%= params[:id] %>"><%= @count_activities_posted %> activities posted </a><br><br> <a href = "/tag/replication:*/author/<%= params[:id] %>"><%= @count_activities_attempted %> activities attempted</a></h3>
<% if !@map_lat.nil? && !@map_lon.nil? %>
<%= render :partial => "map/userLeaflet" , locals: {haslocation: true} %>
<% elsif !current_user.nil? && current_user.id == @user.id %>
Expand Down