-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add organization example and better organization support.
- Loading branch information
Showing
11 changed files
with
241 additions
and
19 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>GitHub for Dart - Demos</title> | ||
</head> | ||
|
||
<body> | ||
<h1>GitHub for Dart - Demos</h1> | ||
|
||
<a href="repos.html"><h3>Repositories</h3></a> | ||
<a href="organization.html"><h3>Organization</h3></a> | ||
<a href="users.html"><h3>Users</h3></a> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import "dart:html"; | ||
|
||
import "package:github/browser.dart"; | ||
import "common.dart"; | ||
|
||
GitHub github; | ||
DivElement $org; | ||
|
||
void main() { | ||
init("organization.dart", onReady: () { | ||
github = new GitHub(new BrowserFetcher(), auth: new Authentication.withToken("5fdec2b77527eae85f188b7b2bfeeda170f26883")); | ||
$org = querySelector("#org"); | ||
loadOrganization(); | ||
}); | ||
} | ||
|
||
void loadOrganization() { | ||
github.organization("DirectMyFile").then((Organization org) { | ||
return org.teams; | ||
}).then((List<Team> teams) { | ||
for (var team in teams) { | ||
var e = new DivElement()..id = "team-${team.name}"; | ||
e.classes.add("team"); | ||
$org.append(e); | ||
e.append(new HeadingElement.h3()..text = team.name); | ||
team.members.then((List<TeamMember> members) { | ||
var divs = members.map((member) { | ||
var h = new DivElement(); | ||
h.classes.add("box"); | ||
h.classes.add("user"); | ||
h.style.textAlign = "center"; | ||
h.append(new ImageElement(src: member.avatarUrl, width: 64, height: 64)..classes.add("avatar")); | ||
h.append(new AnchorElement(href: member.url)..append(new ParagraphElement()..text = "${member.login}")); | ||
return h; | ||
}); | ||
divs.forEach(e.append); | ||
}); | ||
} | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>GitHub Organization</title> | ||
|
||
<style> | ||
.line { | ||
border-top: 1px; | ||
border-style: solid; | ||
} | ||
|
||
.box { | ||
border: 2px solid; | ||
} | ||
|
||
.user { | ||
display: inline-block; | ||
margin-top: 5px; | ||
margin-left: 5px; | ||
width: 256px; | ||
} | ||
|
||
.avatar { | ||
margin-top: 5px; | ||
} | ||
|
||
.team { | ||
margin-bottom: 5px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="header"> | ||
<h1>GitHub Organization</h1> | ||
<button id="view-source">View the Source</button> | ||
<p></p> | ||
</div> | ||
|
||
<div id="org"> | ||
</div> | ||
|
||
<script type="application/dart" src="organization.dart"></script> | ||
<script src="packages/browser/dart.js"></script> | ||
</body> | ||
</html> |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
part of github.jparrowsec.cnmon; | ||
|
||
class Authentication { | ||
String token; | ||
final String token; | ||
|
||
Authentication.withToken(this.token); | ||
|
||
Authentication.anonymous(); | ||
Authentication.anonymous() : this.token = null; | ||
} |
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
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
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
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