Permalink
Browse files

Massive construction work going on.

  • Loading branch information...
0 parents commit aa0c25711ef6e12ae13b31680d6fe5a31b134e0b Michael Aufreiter committed Mar 8, 2012
@@ -0,0 +1,2 @@
+_site/*
+.DS_Store
@@ -0,0 +1,42 @@
+
+window.github = new Github({
+ username: "github-api-test",
+ password: "api-test-12"
+});
+
+// Load everything that's needed for the app + header
+
+function loadApplication(username, password, cb) {
+ var user = github.getUser('github-api-test');
+ user.repos(function(err, repos) {
+ // TODO: filter and just show Jekyll repositories
+ cb(null, {
+ "username": "github-api-test",
+ "password": "api-test-12",
+ "site": "github-api-test.github.com",
+ "available_sites": repos
+ });
+ });
+}
+
+// List all postings for a given repository
+// Looks into _posts/blog
+
+function loadPosts(repo, cb) {
+ var repo = github.getRepo('github-api-test');
+ repo.list(function(err, tree) {
+ var posts = _.map(tree, function(file) {
+ // TODO: change to -> _posts/blog
+ return file.path.match(/^path\/to\/\w*.md/) ? {name: file.path, title: file.path} : null;
+ });
+ cb(null, {"posts": _.compact(posts)});
+ });
+}
+
+function loadPost(repo, path, cb) {
+ var repo = github.getRepo('github-api-test');
+ console.log(path);
+ repo.read(path, function(err, data) {
+ console.log('DOONE');
+ });
+}
@@ -0,0 +1,21 @@
+(function(config, models, views, routers, utils) {
+
+// The Router
+// ---------------
+
+routers.Application = Backbone.Router.extend({
+ initialize: function() {
+
+ // Using this.route, because order matters
+ this.route(/(.*\/.*)/, 'post', this.post);
+ this.route(":repo/posts", "posts", app.posts);
+ },
+ post: function(url) {
+ url = url.split('/');
+ var repo = url.slice(0, 1).join('/');
+ var path = (url.slice(1) || []).join('/');
+ app.post(repo, path);
+ }
+});
+
+}).apply(this, window.args);
@@ -0,0 +1,9 @@
+<script name='header' type='text/html'>{% include templates/header._ %}</script>
+<script name='posts' type='text/html'>{% include templates/posts._ %}</script>
+
+<script name='repo' type='text/html'>{% include templates/repo._ %}</script>
+<script name='repos' type='text/html'>{% include templates/repos._ %}</script>
+<script name='start' type='text/html'>{% include templates/start._ %}</script>
+<script name='error' type='text/html'>{% include templates/error._ %}</script>
+<script name='editor' type='text/html'>{% include templates/editor._ %}</script>
+<script name='user' type='text/html'>{% include templates/user._ %}</script>
@@ -0,0 +1,19 @@
+<div class="navigation">
+ <div class="title">Columnist</div>
+ <div class="sites">
+ <select name="site">
+ <% _.each(available_sites, function(site, index) { %>
+ <option value="<%= site.name %>"><%= site.name %></option>
+ <% }) %>
+
+ </select>
+ </div>
+ <div class="post"><a href="#">Posts</a></div>
+ <div class="post">Bar</div>
+</div>
+
+<div class="user-status">
+ <div class="user">michael</div>
+ <div class="logout"><a href="#">Logout</div>
+ <div class="new-post"><a href="#">New Post</a></div>
+</div>
@@ -0,0 +1,3 @@
+<div>
+ This is a post. Incredible. Isn't it?! :)
+</div>
@@ -0,0 +1,19 @@
+<% if (posts.length > 0) { %>
+ <% _.each(posts, function(post) { %>
+ <div class="post">
+ <a class="link load-post toggle-view" href="#">
+ <div class="image">
+ </div>
+
+ <div class="title">
+ <%= post.title || 'Untitled' %>
+ </div>
+ </a>
+
+ <div class="author"><a href="#">an author</a></div>
+ <div class="updated-at"><span>updated </span><%= "adsf" %></div>
+ </div>
+ <% }); %>
+<% } else { %>
+ <h2>No Posts yet ...</h2>
+<% } %>
@@ -0,0 +1,14 @@
+<div class='start dialog'>
+ <div id='hint'></div>
+ <form><ul class='form'>
+ <li>
+ <label>GitHub user</label>
+ <input type='text' name='user' placeholder='username' size='24' />
+ </li>
+ <li>
+ <label>Password</label>
+ <input type='password' name='password' placeholder='password' size='24' />
+ <input type='submit' value='Log in' />
+ </li>
+ </ul></form>
+</div>
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit aa0c257

Please sign in to comment.