Created
October 14, 2015 11:51
-
-
Save robinwarren/a40652a9d8130e8a5470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>A Trello Dashboard</title> | |
<link rel="stylesheet" media="screen" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<h1>Trello Dashboard</h1> | |
<form class="form-horizontal" id="boards_form"> | |
<div class="form-group"> | |
<label class="control-label">Choose your board</label> | |
<select class="form-control" id="boards"></select> | |
</div> | |
</form> | |
</div> | |
</body> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script> | |
<script src="https://api.trello.com/1/client.js?key=[AppKey]"></script> | |
<script type="text/javascript"> | |
var loadedBoards = function(boards) { | |
$.each(boards, function(index, value) { | |
$('#boards') | |
.append($("<option></option>") | |
.attr("value",value.id) | |
.text(value.name)); | |
}); | |
}; | |
var loadBoards = function() { | |
//Get the users boards | |
Trello.get( | |
'/members/me/boards/', | |
loadedBoards, | |
function() { console.log("Failed to load boards"); } | |
); | |
}; | |
Trello.authorize({ | |
type: "popup", | |
name: "Trello dashboard", | |
scope: { | |
read: true, | |
write: false }, | |
expiration: "never", | |
success: loadBoards, | |
error: function() { console.log("Failed authentication"); } | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment