Skip to content

Instantly share code, notes, and snippets.

@tonyedwardspz
Forked from camillebaldock/README.md
Last active December 22, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tonyedwardspz/655a228ddf8743e9ba00 to your computer and use it in GitHub Desktop.
Save tonyedwardspz/655a228ddf8743e9ba00 to your computer and use it in GitHub Desktop.
Dashing Trello widget

Description

A Dashing widget for displaying the number of items of lists on a Trello board.

screen shot

See a live demo here.

Usage

Setup the following environment variables:

  • TRELLO_DEVELOPER_KEY
  • TRELLO_MEMBER_TOKEN
  • TRELLO_BOARD_NAME: name of the Trello board you wish to monitor
  • TRELLO_LIST_NAMES: comma-separated list of the names of the Trello lists on the board that you wish to monitor

Get your TRELLO_DEVELOPER_KEY from here.

Visit this URL, with the following GET parameters:

  • key: the TRELLO_DEVELOPER_KEY you got in step 1.
  • response_type: "token"
  • expiration: "never" if you don't want your token to ever expire. If you leave this blank, your generated token will expire after 30 days

You should see a page asking you to authorize your Trello application. Click "allow" and you should see a second page with a long alphanumeric string. This is your TRELLO_MEMBER_TOKEN.

Dependencies

ruby-trello

Add it to your Dashing application's Gemfile:

gem 'ruby-trello'

and run bundle install.

<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="email" data-view="Number" data-title="Email"></div>
</li>
require 'trello'
include Trello
Trello.configure do |config|
config.developer_public_key = ENV["TRELLO_DEVELOPER_KEY"]
config.member_token = ENV["TRELLO_MEMBER_TOKEN"]
end
SCHEDULER.every "30m" do
board = Board.all.find { |board| board.name == ENV["TRELLO_BOARD_NAME"] }
lists = board.lists
ENV["TRELLO_LIST_NAMES"].split(",").each do |list_name|
list = lists.find { |list| list.name == list_name }
send_event("trello-#{list_name.downcase}", { current: list.cards.size })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment