From 4a8d572cb1225e03848042a404b7f6227b3b8567 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Apr 2016 15:38:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E7=BB=9F=E8=AE=A1=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 14 +++-- app/views/projects/_rep_static.html.erb | 77 ++++++++++++++++++++----- public/stylesheets/project.css | 1 + 3 files changed, 70 insertions(+), 22 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index aeed8e081..7553acdbc 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -321,12 +321,14 @@ class ProjectsController < ApplicationController end # g = Gitlab.client unless @project.gpid.nil? || @project.project_score.changeset_num == 0 - rep_statics = @project.rep_statics - @a_uname = rep_statics.map {|s| s.uname } - @a_commits_num = rep_statics.map {|s| s.commits_num.to_i } - @a_commits_add = rep_statics.map {|s| s.add.to_i } - @a_commits_del = rep_statics.map {|s| s.del.to_i } - @a_commits_changeset = rep_statics.map {|s| s.changeset.to_i } + rep_statics_commit = @project.rep_statics + rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse + @a_uname = rep_statics_commit.map {|s| s.uname } + @a_uname_code = rep_statics_code.map {|s| s.uname } + @a_commits_num = rep_statics_commit.map {|s| s.commits_num.to_i } + @a_commits_add = rep_statics_code.map {|s| s.add.to_i } + @a_commits_del = rep_statics_code.map {|s| s.del.to_i } + @a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i } # @static_total_per_user = g.rep_stats(@project.gpid) end # 根据对应的请求,返回对应的数据 diff --git a/app/views/projects/_rep_static.html.erb b/app/views/projects/_rep_static.html.erb index 0ba1ffb5a..86d557f3a 100644 --- a/app/views/projects/_rep_static.html.erb +++ b/app/views/projects/_rep_static.html.erb @@ -21,7 +21,7 @@ }, xAxis: { // categories: ["Jan", "Jan", "Jan", 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - categories: <%= raw(@a_uname) %> + categories: <%= raw(@a_uname_code) %> }, yAxis: { title: { @@ -40,7 +40,7 @@ plotOptions: { series: { marker: { - radius: 3, //曲线点半径,默认是4 + radius: 3, //曲线点半径,默认是4 symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle" } }, @@ -51,23 +51,54 @@ enableMouseTracking: false } }, - series: [{ - name: '改动或增加', - color: '#fd9e04', - -// data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] + series: [ + { + name: '总变更', + color: '#d05d5a', + fontWeight: 'normal', + data: <%= @a_commits_changeset %>, + dataLabels: { + enabled: false, + style: { + fontSize: '13px', + color: '#aaa', + fontFamily: 'Arial', + textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)', + fontWeight: 'normal' + } + }, + lineWidth: 1.5 + }, + { + name: '改动或增加', + color: '#5b6b76', data: <%= @a_commits_add %>, + dataLabels: { + enabled: false, + style: { + fontSize: '13px', + color: '#aaa', + fontFamily: 'Arial', + textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)', + fontWeight: 'normal' + } + }, lineWidth: 1.5 }, { - name: '删除', - color: '#46baed ', + name: '删除', + color: '#84b5bb', data: <%= @a_commits_del %>, - lineWidth: 1.5 - },{ - name: '总变更', - color: '#d397d5', - data: <%= @a_commits_changeset %>, + dataLabels: { + enabled: false, + style: { + fontSize: '13px', + color: '#aaa', + fontFamily: 'Arial', + textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)', + fontWeight: 'normal' + } + }, lineWidth: 1.5 }] }); @@ -120,9 +151,22 @@ } }, series: [{ - name: '提交次数', + name: '提交次数', + fontWeight: 'normal', + color: '#d05d5a', // data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] data: <%= @a_commits_num %>, + dataLabels: { + enabled: false, + + style: { + fontSize: '13px', + color: '#aaa', + fontFamily: 'Arial', + textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)', + fontWeight: 'normal' + } + }, lineWidth: 1.5 } @@ -133,4 +177,5 @@ ] }); }); - \ No newline at end of file + +
当前分支:develop
\ No newline at end of file diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index f711c25e2..085fc64be 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1200,3 +1200,4 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;} .popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;} .subjectType {width:70px; text-align:center;} .subjectCount {width:65px; text-align:center;} +.button-rep { color: #888;display: inline-block;background: #eee;padding: 2px 5px;}