Skip to content

Commit

Permalink
Stats on profile page (publiclab#2131)
Browse files Browse the repository at this point in the history
* Added links to the profile page

* Stats display
  • Loading branch information
SidharthBansal authored and jywarren committed Jan 26, 2018
1 parent 1cb390b commit b579966
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit b579966

Please sign in to comment.