GithubHelp home page GithubHelp logo

backstopmedia / hubbub Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 111.0 1.56 MB

Sample project for the book Developing a Backbone.js Edge

Home Page: http://backstopmedia.github.com/hubbub/

JavaScript 100.00%

hubbub's People

Contributors

afeld avatar caseywebdev avatar davidgtonge avatar philfreo avatar tbranyen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hubbub's Issues

optimization techniques

I'll work on this bit once the app is the complete. We can use targethtml and grunt to produce a standalone production-ready build.

plugin version

I'm interested in creating a plugin version of this project using backbone-boilerplate and layoutmanager. Should this be a fork or in a branch? TodoMVC route where different options are included?

Pagination

looks like we're only showing the first few repos per organization. pagination?

balsamiq wireframes

I'm interested in working on this, but anyone else who wants to contribute.

Remove the "done" category?

Wouldn't they just close the issue on Github instead? Not sure about the best way to handle this, UI-wise. Thoughts?

JSON2 can be removed

We should remove json2 not really relevant. We can make a comment on it in the book.

Small logging view at bottom of screen

As this is an example app, perhaps we could have a view which would be position at the bottom of the screen which would be an event log. We could listen to all events on all the views / models / collections and log it to this view. This could perhaps help people new to Backbone understand a bit more about when different events are fired. The view could be hidden by the user if needed.

What pages / views are required for the app

Here are some suggestions for starters:

  1. Welcome
  2. Main Dashboard - to view, filter and manage issues
  3. Manage Repos - to add / remove repos to track
  4. Edit Issue (should this be a modal dialog like trello?)

Remove `app.User`

It's confusing with a mix of app.User objects and anonymous user objects under the issues and repos. I think we should go all the way (with some relation plugin), or just take out this model. The only place it's used

var user = new app.User({login: match[1]});
this.findReposFor(user);

can be refactored to

app.Repo.Collection.findByUsername(match[1]);

Comment consistency

I tend towards brevity/laziness in my inline comments and often use lowercase phrases - seems others use proper capitalized sentences. We should make this consistent throughout the repo. I'm fine either way. Votes?

Setup base project

We want a boilerplate project that readers can fork, clone and start work from. This can either be a separate repo, or a specific branch in this repo (master, probably?). For the latter, we can move our development to a branch called completed. Any thoughts?

determine basic features

Here's what I'm thinking:

  • On first visit, ask for Github username to pull in their repos (see #5)
  • Provide a way to view the issues (or at least issue titles) from each of their repos
    • This will be a lot less interesting for new-er programmers with few repos.
  • Provide way to organize the issues from the various repos
    • Separate "To Do", "In Progress" and "Done" lists, Kanban-style?
    • Single long re-orderable list?
    • How do issues get moved around? Draggable is my first instinct, but that could introduce some complexity with jQuery UI or whatever.
  • Minimum issue display:
    • Show issue title, repo name and issue number
    • Link to open it on Github

Global model cache?

We use this technique in our framework at @Jux: create a special Collection that contains all instantiated Models, so that if you try to create a new Model with the same 'id' as an existing one, it just gives back that same instance. Has saved a lot of headaches, but I know this isn't necessarily a common Backbone pattern.

app.ListView()

I use this in a project I'm working on

(function () {
  'use strict';

  var $ = window.jQuery;
  var app = window.app;
  var Backbone = window.Backbone;

  app.ListView = Backbone.View.extend({
    initialize: function () {
      this.views = {};
      this.listenTo(this.collection, {
        add: this.addModel,
        sort: this.sortModels,
        remove: this.removeModel
      });
    },

    addModel: function (model) {
      this.$el.append((this.views[model.cid] = new this.options.ModelView({
        collection: this.collection,
        model: model
      })).el);
    },

    sortModels: function () {
      var views = this.views;
      var $el = this.$el;
      var $models = $el.children();
      this.collection.each(function (model, i) {
        var el = views[model.cid].el;
        if (!$models[i]) {
          $el.append(el);
        } else if ($models[i] !== el) {
          $models.eq(i).before(el);
          $models = $($models.get().splice(i, 0, el));
        }
      });
    },

    removeModel: function (model) {
      delete this.views[model.cid];
    }
  });
})();

Make `plugins` branch

We don't have to spend time explaining it in the book, but would be cool to have a branch where we fully leverage community-built plugins and to show how much of the cruft could be cut out. We can link to the branch/compare view from the book/README, just as a demonstration.

Plugins to be included, for starters:

Cache where we can

GitHub's API request rate limit is only 60 per hour. In light of this, I think we need to cache vigorously. Fortunately, all of the CRUD operations are set up for localStorage so we can save/fetch/destroy for free (basically), synchronously. I've set up the app so far to save repos and the repo's issues when they are added to app.board in the side panel view. This way, when we load up the page again all the data is pulled locally. I think we should make all GitHub API requests explicit opt-ins from UI interactions (i.e. "click to fetch new data"). If we start doing automatic remote fetches, however convenient it might be for certain parts of the app, we're going to hit that limit very quickly.

childViews?

Not to totally re-create a myriad of plugins, but what if we had an addChildView() method in our app.View class, and overrode the remove() method there to clean them up? Or is this over-engineering for this app we want to show the basics?

Roto-Rooter the Router

Route methods shouldn't be calling one another. I would go so far as to say that the Router should barely have any code in it: just call methods on the app to set up the appropriate state.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.