Instantly share code, notes, and snippets.

@mordonez /Readme.md
Last active Mar 22, 2016

Embed
What would you like to do?
Trello Job for Dashing

#Preview# test

#Description#

Simple Dashing Job to display Trello info about your boards. Uses Trello API.

#Dependencies# ruby-trello

Add it to dashing's gemfile:

gem 'ruby-trello' and run bundle install. Everything should work now :)

#Usage# To use this widget, put the trello.rb file in your /jobs folder.

To include the widget in a dashboard, add the following snippet to the dashboard layout

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
  <div data-id="my-trello-board" data-view="List" data-title="Trello Board"></div>
  <i class="icon-trello icon-background"></i>
</li>
require 'trello'
include Trello
Trello.configure do |config|
config.developer_public_key = 'YOUR_DEVELOPER_KEY'
config.member_token = 'YOUR_MEMBER_TOKEN'
end
boards = {
"my-trello-board" => "YOUR_TRELLO_BOARD_ID",
}
class MyTrello
def initialize(widget_id, board_id)
@widget_id = widget_id
@board_id = board_id
end
def widget_id()
@widget_id
end
def board_id()
@board_id
end
def status_list()
status = Array.new
Board.find(@board_id).lists.each do |list|
status.push({label: list.name, value: list.cards.size})
end
status
end
end
@MyTrello = []
boards.each do |widget_id, board_id|
begin
@MyTrello.push(MyTrello.new(widget_id, board_id))
rescue Exception => e
puts e.to_s
end
end
SCHEDULER.every '5m', :first_in => 0 do |job|
@MyTrello.each do |board|
status = board.status_list()
send_event(board.widget_id, { :items => status })
end
end
@danharper83

This comment has been minimized.

danharper83 commented Oct 30, 2014

Having a few issues with this, I've done as above but nothing ever shows in the trello square. Having difficulty troubleshooting it.

@YSmetana

This comment has been minimized.

YSmetana commented Nov 27, 2014

Hey @danharper83. I just figured it out. You can get a developer_public_key here: https://trello.com/1/appKey/generate# .

Then get your member_token visiting https://trello.com/1/authorize?key=KEY&name=Dashing&expiration=never&response_type=token . Replace the KEY by your actual key from previous step.

You can see some debug messages running dashing start in the console. Dashing will update your Trello data once in 5 minutes by default.

It will display cards summary:

@mordonez thanks a lot!

@usamaaftab80

This comment has been minimized.

usamaaftab80 commented Feb 20, 2015

Is there any way we can get the card instead of the whole board summary?

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