Shopify / dashing

The exceptionally handsome dashboard framework in Ruby and Coffeescript.
http://shopify.github.com/dashing/
MIT License
10.98k stars 1.18k forks source link

Pull list of widgets from erb file? #578

Open mapledyne opened 9 years ago

mapledyne commented 9 years ago

Is there a way to access the list of widgets that have had data sent to them via the erb file? We have an erb that does some dynamic creation so we can use one erb that can act as multiple dashboards. It's been working wonderfully for us, but I'd love to take it a bit further and have the erb look through the current widgets and pick the ones that are relevant.

Is there a variable or similar we can get into to see this list?

Thanks!

mapledyne commented 9 years ago

Found the answer to my problem and thought I'd post here if anyone else is curious.

This variable: widgets = Sinatra::Application.settings.history

has all the widget info (at least the info I was looking for). Looping through that: widgets.each do |key, value| ... end

let's you run through all the widgets and do any evaluations desired on them.