Sha256: 1350355787d9093d31f867799b568ab9fed907a7995de9e0bd5c7f5b51ee0d1f

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

class <%= controller_name -%> < ApplicationController
  # NOTE: Remove this line if you don't mind restarting the server after modifying this class.
  include ActsAsDashboard

  acts_as_dashboard

  dashboard_number do |d|
    d.name            = :seconds
    d.title           = 'Seconds This Minute'
    d.update_interval = '5s'
    d.data            {Time.now.strftime '%S'}
  end

  dashboard_short_messages do |d|
    d.name            = :todays_full_date
    d.title           = 'Todays Full Date'
    d.update_interval = '10s'
    d.data            {Time.now.to_s}
  end

  dashboard_line_graph do |d|
    d.name            = :random_dates_and_numbers
    d.title           = 'Random Dates and Numbers'
    d.update_interval = '15s'
    d.line_colours    = %w(blue)
    d.x_axis          = :dates
    d.data do
      (0..10).map do
        year        = Time.now.year
        month       = sprintf '%02d', rand(12) + 1
        day         = sprintf '%02d', rand(31) + 1
        date        = "#{year}-#{month}-#{day}"
        data_point  = rand(20) + 1

        [date, data_point]
      end.to_json
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_dashboard-0.4.0 generators/dashboard/templates/controller.erb
acts_as_dashboard-0.3.3 generators/dashboard/templates/controller.erb
acts_as_dashboard-0.3.2 generators/dashboard/templates/controller.erb
acts_as_dashboard-0.3.0 generators/dashboard/templates/controller.erb
acts_as_dashboard-0.1.0 generators/dashboard/templates/controller.erb