mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
更改:项目排行榜使用数据存储以及数据导出的功能
This commit is contained in:
@@ -5,28 +5,34 @@
|
||||
|
||||
<div class="box search-form-container user-list-form">
|
||||
<%= form_tag(admins_projects_rank_index_path, method: :get, class: 'form-inline search-form flex-1', id: 'project-rank-date-form') do %>
|
||||
<div class="form-group mr-2">
|
||||
<label for="status">开始日期:</label>
|
||||
<% dates_array = (0..30).to_a.map { |item| [(Date.today-item.days).to_s, (Date.today-item.days).to_s] } %>
|
||||
<%= select_tag(:begin_date, options_for_select(dates_array, params[:begin_date]), class:"form-control",id: "project-rank-begin-date-select")%>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">开始日期</span>
|
||||
<input class="form-control datetimepicker" type="text" name="begin_date" value="<%= params[:begin_date] || Date.today.to_s%>" aria-label="选择日期">
|
||||
</div>
|
||||
<div class="form-group mr-2">
|
||||
<label for="status">截止日期:</label>
|
||||
<% dates_array = (0..30).to_a.map { |item| [(Date.today-item.days).to_s, (Date.today-item.days).to_s] } %>
|
||||
<%= select_tag(:end_date, options_for_select(dates_array, params[:end_date]), class:"form-control",id: "project-rank-end-date-select")%>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">结束日期</span>
|
||||
<input class="form-control datetimepicker" type="text" name="end_date" value="<%= params[:end_date] || Date.today.to_s%>" aria-label="选择日期">
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= link_to '导出', "/项目活跃度排行.xls", class: 'btn btn-primary mr-3' %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container project-rank-list-container">
|
||||
<%= render partial: 'admins/projects_rank/shared/data_list', locals: { date_rank: @date_rank } %>
|
||||
<%= render partial: 'admins/projects_rank/shared/data_list', locals: { statistics: @statistics } %>
|
||||
</div>
|
||||
<script>
|
||||
$("#project-rank-begin-date-select").on('change', function() {
|
||||
$(".datetimepicker").on('change', function() {
|
||||
$("#project-rank-date-form").submit()
|
||||
});
|
||||
$("#project-rank-end-date-select").on('change', function() {
|
||||
$(".datetimepicker").on('change', function() {
|
||||
$("#project-rank-date-form").submit()
|
||||
});
|
||||
$('.datetimepicker').datetimepicker({
|
||||
language: 'zh-CN', // 中文语言包
|
||||
autoclose: 1, // 选中日期后自动关闭
|
||||
format: 'yyyy-mm-dd', // 日期格式
|
||||
minView: "month", // 最小日期显示单元,这里最小显示月份界面,即可以选择到日
|
||||
todayBtn: 1, // 显示今天按钮
|
||||
todayHighlight: 1, // 显示今天高亮
|
||||
});
|
||||
</script>
|
||||
@@ -1 +1 @@
|
||||
$('.project-rank-list-container').html("<%= j( render partial: 'admins/projects_rank/shared/data_list', locals: { date_rank: @date_rank } ) %>");
|
||||
$('.project-rank-list-container').html("<%= j( render partial: 'admins/projects_rank/shared/data_list', locals: { statistics: @statistics } ) %>");
|
||||
@@ -14,25 +14,23 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% date_rank.each_with_index do |item, index| %>
|
||||
<% statistics.each_with_index do |item, index| %>
|
||||
<tr class="">
|
||||
<td><%= index + 1%></td>
|
||||
<% project_common = $redis_cache.hgetall("v2-project-common:#{item[0]}") %>
|
||||
<% owner_common = $redis_cache.hgetall("v2-owner-common:#{project_common["owner_id"]}")%>
|
||||
<td>
|
||||
<a href="/<%= owner_common["login"] %>/<%= project_common["identifier"]%>">
|
||||
<%= "#{owner_common["name"]}/#{project_common["name"]}" %>
|
||||
<a href="<%= "/#{item&.project&.owner&.login}/#{item&.project&.identifier}"%>">
|
||||
<%= "#{item&.project&.owner&.nickname}/#{item&.project&.name}" %>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td><%= item[1] %></td>
|
||||
<td><%= item[2] %></td>
|
||||
<td><%= item[3] %></td>
|
||||
<td><%= item[4] %></td>
|
||||
<td><%= item[5] %></td>
|
||||
<td><%= item[6] %></td>
|
||||
<td><%= item[7] %></td>
|
||||
<td><%= item[8] %></td>
|
||||
<td><%= item&.score %></td>
|
||||
<td><%= item&.visits %></td>
|
||||
<td><%= item&.watchers %></td>
|
||||
<td><%= item&.praises %></td>
|
||||
<td><%= item&.forks %></td>
|
||||
<td><%= item&.issues %></td>
|
||||
<td><%= item&.pullrequests %></td>
|
||||
<td><%= item&.commits %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user