A simple dashboard of records created this week, this month, and all time, mountable as a Rails Engine.
Add gem to
Add initializer and route:
rails g stat_board:install
Configure models (in
.models = [User, Post, Comment]
Models can also be listed as strings if you encounter any loading order issues.
You can access StatBoard like this:
.title = "YourApp Stats"
.username = "user" .password = "pass"
Displaying Data Graphically (true by default)
.display_graph = true
You may provide your own reports, just place they into
lib/stat_board/reports. Name of report should be
*_report.rb. For example:
# lib/stat_board/reports/day_report.rb module module Reports class DayReport < Report def name(original_date = nil) "Last day" end def scope(model) super.where(["created_at > ?", 1.day.ago]) end end end end
- Models can be specified as strings rather than constants if you encounter loading order issues.
- If you're using the Asset Pipeline, you'll need to add
stat_board/bootstrap.cssto your precompile paths.
- If you have
false, then you will need to add
stat_board/highcharts.jsto your precompile paths.
Happily accepting contributions to improve StatBoard. To contribute, fork, add your thing, add some specs, and send a pleasantly worded pull request.
In order to setup the databases locally, you'll need to:
bundle exec rake db:migrate app:db:test:prepare
StatBoard is released under the MIT License. See MIT-LICENSE for further details.