Skip to content

Commit 43164c4

Browse files
authored
Merge pull request #56 from tuanle03/develop
Release v01.01.2024
2 parents df6f218 + de506ae commit 43164c4

File tree

7 files changed

+54
-0
lines changed

7 files changed

+54
-0
lines changed

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ gem 'jquery-rails'
7272

7373
gem 'rubocop'
7474

75+
gem 'chartkick'
76+
77+
gem 'groupdate'
78+
7579
# Use Sass to process CSS
7680
# gem "sassc-rails"
7781

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ GEM
154154
grape_logging (1.8.4)
155155
grape
156156
rack
157+
groupdate (6.4.0)
158+
activesupport (>= 6.1)
157159
haml (6.3.0)
158160
temple (>= 0.8.2)
159161
thor
@@ -381,6 +383,7 @@ DEPENDENCIES
381383
bootsnap
382384
byebug
383385
capybara
386+
chartkick
384387
debug
385388
devise
386389
devise-jwt
@@ -390,6 +393,7 @@ DEPENDENCIES
390393
grape
391394
grape-swagger
392395
grape_logging
396+
groupdate
393397
haml-rails
394398
html2haml
395399
importmap-rails

app/javascript/application.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
22
import "@hotwired/turbo-rails"
33
import "controllers"
4+
import "chartkick"
5+
import "Chart.bundle"
46
//= require jquery3
57
//= require popper
68
//= require bootstrap

app/views/posts/index.html.haml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.container.mt-5
22
%h1 Posts
3+
= pie_chart Post.group(:status).count, library: { title: { text: 'Posts by status' } }
4+
= line_chart Post.group(:id).sum(:total_view), library: { title: { text: 'Posts by total view' } }
35
= link_to 'New Post', new_post_path, class: 'btn btn-primary col-md-1 offset-md-11 mb-3'
46

57
%form.form-inline.mb-3.justify-content-end.offset-md-9

config/importmap.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
66
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
77
pin_all_from "app/javascript/controllers", under: "controllers"
8+
pin "chartkick", to: "chartkick.js"
9+
pin "Chart.bundle", to: "Chart.bundle.js"

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"chart.js": "^4.4.1",
4+
"chartkick": "^5.0.1"
5+
}
6+
}

yarn.lock

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
"@kurkle/color@^0.3.0":
6+
version "0.3.2"
7+
resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.2.tgz#5acd38242e8bde4f9986e7913c8fdf49d3aa199f"
8+
integrity sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==
9+
10+
chart.js@4, chart.js@^4.4.1:
11+
version "4.4.1"
12+
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.4.1.tgz#ac5dc0e69a7758909158a96fe80ce43b3bb96a9f"
13+
integrity sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==
14+
dependencies:
15+
"@kurkle/color" "^0.3.0"
16+
17+
chartjs-adapter-date-fns@>=3:
18+
version "3.0.0"
19+
resolved "https://registry.yarnpkg.com/chartjs-adapter-date-fns/-/chartjs-adapter-date-fns-3.0.0.tgz#c25f63c7f317c1f96f9a7c44bd45eeedb8a478e5"
20+
integrity sha512-Rs3iEB3Q5pJ973J93OBTpnP7qoGwvq3nUnoMdtxO+9aoJof7UFcRbWcIDteXuYd1fgAvct/32T9qaLyLuZVwCg==
21+
22+
chartkick@^5.0.1:
23+
version "5.0.1"
24+
resolved "https://registry.yarnpkg.com/chartkick/-/chartkick-5.0.1.tgz#f557ff8560f974343dc65c7fc34ce1e8326d8ee7"
25+
integrity sha512-4F3tWI3eBQgnjCYZIZ+fHOaJuNyxeyhDE2Tm+voOWB19hDjSJceys/spzN52DOn8bWepNESGXvPVTGU1jeFsbA==
26+
optionalDependencies:
27+
chart.js "4"
28+
chartjs-adapter-date-fns ">=3"
29+
date-fns ">=2"
30+
31+
date-fns@>=2:
32+
version "3.0.6"
33+
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.0.6.tgz#fe3aeb7592d359f075ffc41cb16139828810ca83"
34+
integrity sha512-W+G99rycpKMMF2/YD064b2lE7jJGUe+EjOES7Q8BIGY8sbNdbgcs9XFTZwvzc9Jx1f3k7LB7gZaZa7f8Agzljg==

0 commit comments

Comments
 (0)