diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-03 22:33:34 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-03 22:33:34 +0300 |
commit | 6d07a97462eed7a61316871b47f1e214e8553c7a (patch) | |
tree | ef2e3e46fc20288300e56465aac886c175f431b5 /app | |
parent | 3fba2114260531977b5fecfc17941f5b851005ee (diff) | |
download | gitlab-ce-6d07a97462eed7a61316871b47f1e214e8553c7a.tar.gz |
move js code related to repo barchart to chart.js.coffee
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/chart.js.coffee | 12 | ||||
-rw-r--r-- | app/views/repositories/stats.html.haml | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/chart.js.coffee b/app/assets/javascripts/chart.js.coffee new file mode 100644 index 00000000000..7040ebc6c65 --- /dev/null +++ b/app/assets/javascripts/chart.js.coffee @@ -0,0 +1,12 @@ +@Chart = + labels: [] + values: [] + + init: (labels, values, title) -> + r = Raphael('activity-chart') + r.text(160, 10, title).attr font: "13px sans-serif" + r.barchart( + 10, 10, 400, 160, + [values], + {colors:["#456"]} + ).label(labels, true) diff --git a/app/views/repositories/stats.html.haml b/app/views/repositories/stats.html.haml index dde35ea38aa..e8cf5eb908d 100644 --- a/app/views/repositories/stats.html.haml +++ b/app/views/repositories/stats.html.haml @@ -31,11 +31,6 @@ $(function(){ var labels = [#{@graph.labels.to_json}]; var commits = [#{@graph.commits.join(', ')}]; - var r = Raphael('activity-chart'); - r.text(160, 10, "Commit activity for last #{@graph.weeks} weeks").attr({ font: "13px sans-serif" }); - r.barchart( - 10, 10, 400, 160, - [commits], - {colors:["#456"]} - ).label(labels, true); + var title = "Commit activity for last #{@graph.weeks} weeks"; + Chart.init(labels, commits, title); }) |