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

contributors tables fixes #8021

Merged
merged 1 commit into from Jun 11, 2020
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
52 changes: 27 additions & 25 deletions app/views/tag/_contributors.html.erb
Expand Up @@ -34,33 +34,35 @@
<% elsif @note_count.nil? || @note_count == 0 %>
<p><%= raw translation('tag.contributors.no_contributors', :tag => params[:id]) %>:</p>
<% else %>
<div class="col-md-6" style="display: inline-block;">
<table class="table">
<tr>
<th style="width:75%;"><%= translation('tag.contributors.people_who\'ve_posted') %></th>
<th><%= translation('tag.contributors.notes') %></th>
</tr>
<% if @users %>
<% @users.each do |user| %>
<tr class="users-row">
<td><a href='/profile/<%= user.name %>'><i class="fa fa-user"></i> <%= user.name %></a></td>
<td><a href='/tag/<%= params[:id] %>/author/<%= user.name %>'><%= translation('tag.contributors.notes') %> &raquo;</a></td>
</tr>
<div class="row">
<div class="col-md-6">
<table class="table">
<tr>
<th style="width:75%;"><%= translation('tag.contributors.people_who\'ve_posted') %></th>
<th><%= translation('tag.contributors.notes') %></th>
</tr>
<% if @users %>
<% @users.each do |user| %>
<tr class="users-row">
<td><a href='/profile/<%= user.name %>'><i class="fa fa-user"></i> <%= user.name %></a></td>
<td><a href='/tag/<%= params[:id] %>/author/<%= user.name %>'><%= translation('tag.contributors.notes') %> &raquo;</a></td>
</tr>
<% end %>
<% end %>
<% end %>
</table>
</div>
<div class="col-md-6" style="display: inline-table; position:absolute">
<table class="table">
<tr>
<th> <%= translation('tag.contributors.people_who_are_following') %> </th>
</tr>
<% Tag.followers(params[:id]) && Tag.followers(params[:id]).each do |follower| %>
<tr class="followers-row">
<td><a href='/profile/<%= follower.name %>'><i class="fa fa-user-o"></i> <%= follower.name %></a></td>
</table>
</div>
<div class="col-md-6">
<table class="table">
<tr>
<th> <%= translation('tag.contributors.people_who_are_following') %> </th>
</tr>
<% end %>
</table>
<% Tag.followers(params[:id]) && Tag.followers(params[:id]).each do |follower| %>
<tr class="followers-row">
<td><a href='/profile/<%= follower.name %>'><i class="fa fa-user-o"></i> <%= follower.name %></a></td>
</tr>
<% end %>
</table>
</div>
</div>
<br />
<% end %>
121 changes: 60 additions & 61 deletions app/views/tag/contributors.html.erb
@@ -1,69 +1,68 @@
<div class="col-lg-9">
<% if @tag %>
<div id="note-graph" style="height:100px;"></div>
<div class="col-12">
<% if @tag %>
<div id="note-graph" style="height:100px;"></div>

<script src="https://cdn.jsdelivr.net/npm/frappe-charts@0.0.8/dist/frappe-charts.min.iife.js"></script>
<script type="text/javascript">
var notes = <%= @tag.contribution_graph_making.to_a.sort.to_json %>
let months = ["J", "F", "M", "A", "M", "J", "J", "A","S", "O", "N", "D"];
let i;
let labels = new Array();
for(i = 0; i < notes.length; i++)
labels[i] = "";
let count = 0;
let prev = 0;
for(i = 0; i < notes.length; i++){
if(notes[i][1][0] != prev){
if(count == 4){
let j;
labels[i - 2] = months[prev - 1];
}
else{
labels[i - 3] = months[prev - 1];
}
prev = notes[i][1][0];
count = 0;
}
count++;
}
if(count >= 3){
labels[notes.length - 3] = months[prev - 1];
}
let title = "note";
let values = new Array();
for (j = 0; j < notes.length; j++){
values[j] = notes[j][1][1];
}
let data = new Object();
data.labels = labels;
let datasets = new Array();
let obj = new Object();
obj.title = title;
obj.values = new Array();
obj.values = values;
datasets[0] = new Object();
datasets[0] = obj;
data.datasets = datasets;
let chart = new Chart({
parent: "#note-graph",
data: data,
type: "bar",
height: 115,
x_axis_mode: "tick",
y_axis_mode: "span",
is_series: 1,
colors: ['purple']
});
</script>
<script src="https://cdn.jsdelivr.net/npm/frappe-charts@0.0.8/dist/frappe-charts.min.iife.js"></script>
<script type="text/javascript">
var notes = <%= @tag.contribution_graph_making.to_a.sort.to_json %>
let months = ["J", "F", "M", "A", "M", "J", "J", "A","S", "O", "N", "D"];
let i;
let labels = new Array();
for(i = 0; i < notes.length; i++)
labels[i] = "";
let count = 0;
let prev = 0;
for(i = 0; i < notes.length; i++){
if(notes[i][1][0] != prev){
if(count == 4){
let j;
labels[i - 2] = months[prev - 1];
}
else{
labels[i - 3] = months[prev - 1];
}
prev = notes[i][1][0];
count = 0;
}
count++;
}
if(count >= 3){
labels[notes.length - 3] = months[prev - 1];
}
let title = "note";
let values = new Array();
for (j = 0; j < notes.length; j++){
values[j] = notes[j][1][1];
}
let data = new Object();
data.labels = labels;
let datasets = new Array();
let obj = new Object();
obj.title = title;
obj.values = new Array();
obj.values = values;
datasets[0] = new Object();
datasets[0] = obj;
data.datasets = datasets;
let chart = new Chart({
parent: "#note-graph",
data: data,
type: "bar",
height: 115,
x_axis_mode: "tick",
y_axis_mode: "span",
is_series: 1,
colors: ['purple']
});
</script>

<br />

<h3 style="margin-top:0;"><%= raw translation('tag.contributors.contributors_for', :tag_name => params[:id]) %></h3>
<p><%= translation('tag.contributors.contributions_over_past_year') %></p>
<h3 style="margin-top:0;"><%= raw translation('tag.contributors.contributors_for', :tag_name => params[:id]) %></h3>
<p><%= translation('tag.contributors.contributions_over_past_year') %></p>

<% end %>
<% end %>

<%= render :partial => "tag/contributors" %>
<%= render partial: "tag/contributors" %>

</div>
<%= render :partial => "sidebar/related" %>
2 changes: 1 addition & 1 deletion app/views/tag/show.html.erb
Expand Up @@ -49,7 +49,7 @@
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-9">
<div class="col-lg-9">

<%= render partial: 'tag/show/contributors' %>

Expand Down
6 changes: 1 addition & 5 deletions app/views/tag/show/_tab_content.html.erb
Expand Up @@ -53,11 +53,7 @@

<% if @node_type == "contributors" %>
<div class="tab-pane active" id="contributors">
<div class="row">
<div class="col-md-9" style="padding-left: 46px">
<%= render partial: "tag/contributors" %>
</div>
</div>
<%= render partial: "tag/contributors" %>
</div>
<% end %>
<br />
Expand Down