Skip to content

Instantly share code, notes, and snippets.

@camillebaldock
Last active May 19, 2018 07:52
Show Gist options
  • Save camillebaldock/cda910d857f4c6225f75 to your computer and use it in GitHub Desktop.
Save camillebaldock/cda910d857f4c6225f75 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
@karlashi
Copy link

Hi, I'm new to ruby and coding in general. Is there a way to show random card titles from a board? Txs!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment