mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-16 00:37:28 +08:00
Added statistics block in users profile [SCI-566]
This commit is contained in:
parent
24cdbedd05
commit
d28edfb488
4 changed files with 204 additions and 150 deletions
|
@ -744,6 +744,17 @@ a[data-toggle="tooltip"] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-statistics {
|
||||||
|
li {
|
||||||
|
height: 100px;
|
||||||
|
margin: 15px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Protocols management */
|
/** Protocols management */
|
||||||
.breadcrumb-protocols-manager {
|
.breadcrumb-protocols-manager {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
|
|
@ -263,6 +263,20 @@ class User < ActiveRecord::Base
|
||||||
organizations.pluck(:id)
|
organizations.pluck(:id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns a hash with user statistics
|
||||||
|
def statistics
|
||||||
|
statistics = {}
|
||||||
|
statistics[:number_of_teams] = organizations.count
|
||||||
|
statistics[:number_of_projects] = projects.count
|
||||||
|
number_of_experiments = 0
|
||||||
|
projects.find_each do |pr|
|
||||||
|
number_of_experiments += pr.experiments.count
|
||||||
|
end
|
||||||
|
statistics[:number_of_experiments] = number_of_experiments
|
||||||
|
statistics[:number_of_protocols] = added_protocols.count
|
||||||
|
statistics
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def time_zone_check
|
def time_zone_check
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<% provide(:head_title, t("users.registrations.edit.head_title")) %>
|
<% provide(:head_title, t("users.registrations.edit.head_title")) %>
|
||||||
|
|
||||||
<div class="center-block center-block-narrow">
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
<h2><%=t "users.registrations.edit.title" %></h2>
|
<h2><%=t "users.registrations.edit.title" %></h2>
|
||||||
|
|
||||||
<% if not resource.errors.empty? %>
|
<% if not resource.errors.empty? %>
|
||||||
|
@ -165,6 +166,28 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-7 col-md-offset-1">
|
||||||
|
<h2><%=t "users.statistics.title" %></h2>
|
||||||
|
<ul class="list-inline user-statistics">
|
||||||
|
<li class="label label-primary">
|
||||||
|
<h2><%= @user.statistics[:number_of_teams]%></h2>
|
||||||
|
<%= t("users.statistics.team").pluralize(@user.statistics[:number_of_teams]) %>
|
||||||
|
</li>
|
||||||
|
<li class="label label-primary">
|
||||||
|
<h2><%= @user.statistics[:number_of_projects] %></h2>
|
||||||
|
<%= t("users.statistics.project").pluralize(@user.statistics[:number_of_projects]) %>
|
||||||
|
</li>
|
||||||
|
<li class="label label-primary">
|
||||||
|
<h2><%= @user.statistics[:number_of_experiments] %></h2>
|
||||||
|
<%= t("users.statistics.experiment").pluralize(@user.statistics[:number_of_experiments]) %>
|
||||||
|
</li>
|
||||||
|
<li class="label label-primary">
|
||||||
|
<h2><%= @user.statistics[:number_of_protocols] %></h2>
|
||||||
|
<%= t("users.statistics.protocol").pluralize(@user.statistics[:number_of_protocols]) %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<%= javascript_include_tag("canvas-to-blob.min") %>
|
<%= javascript_include_tag("canvas-to-blob.min") %>
|
||||||
<%= javascript_include_tag("direct-upload") %>
|
<%= javascript_include_tag("direct-upload") %>
|
||||||
|
|
|
@ -1117,6 +1117,12 @@ en:
|
||||||
head_title: "Sign up"
|
head_title: "Sign up"
|
||||||
team_name_label: "Team name"
|
team_name_label: "Team name"
|
||||||
team_name_help: "Team name is required in order to create your own team."
|
team_name_help: "Team name is required in order to create your own team."
|
||||||
|
statistics:
|
||||||
|
title: "Statistics"
|
||||||
|
team: "Team"
|
||||||
|
project: "Project"
|
||||||
|
experiment: "Experiment"
|
||||||
|
protocol: "Protocol"
|
||||||
settings:
|
settings:
|
||||||
changed_org_flash: "You are working on %{team} now!"
|
changed_org_flash: "You are working on %{team} now!"
|
||||||
changed_org_error_flash: "Something went wrong! Try again later."
|
changed_org_error_flash: "Something went wrong! Try again later."
|
||||||
|
|
Loading…
Add table
Reference in a new issue