;(function(Backbone, storybase) {
  var hasAnalytics = storybase.utils.hasAnalytics;

  if (_.isUndefined(storybase.builder.routers)) {
    storybase.builder.routers = {};
  }
  var Routers = storybase.builder.routers;

  Routers.Router = Backbone.Router.extend({
    initialize: function(options) {
      this.dispatcher = options.dispatcher;
      this.hasStory = options.hasStory;
      this.hasTemplate = options.hasTemplate;
      // Define the routes dynamically instead of a declaring
      // a rotues property because the routing changes
      // depending on whether we're creating a new story
      // or editing an existing story
      if (this.hasStory) {
        // Editing an existing story
        this.route("", "build");
        this.route(":step/", "selectStep");
        this.route(":step/:substep/", "selectStep");
      }
      else {
        // Creating a new story
        if (this.hasTemplate) {
          this.route("", "build");
        }
        else {
          this.route("", "selectTemplate");
        }
        this.route(":id/", "build");
        this.route(":id/:step/", "selectIdStep");
        this.route(":id/:step/:substep/", "selectIdStep");
      }
      this.dispatcher.on("navigate", this.navigate, this);
      this.dispatcher.on("save:story", this.setHasStory, this);
    },

    /**
     * Handle hashed story IDs in the URL, reloading the page if neccessary 
     *
     * @param {Boolean} reload Should the page be reloaded in the browser?
     *
     * Backbone's router will use hashed URL paths in browsers that don't
     * support the History API. This causes problems if a user accesses one
     * of these URLs directly, such as from a bookmark, because the Django
     * view doesn't know to bootstrap the backbone views.  To work around
     * this, we force a page reload.
     */
    handleHashedId: function(reload) {
      if (hasAnalytics()) {
        _gaq.push(['_trackEvent', 'Routes', 'Page load with hashed story ID']);
      }
      if (window.location.hash) {
        // Remove the hash from the URL. The server will generate the 
        // correct content for the workflow step when requested directly
        url = window.location.href.replace('#', '');
      }
      else {
        // No hash, likely because the browser supports the History API and
        // Backbone has already updated the location to be hash-less
        url = window.location.href;
      }
      if (reload) {
        // If we're attempting to load an existing story, reload the page
        // in the browser with an un-hashed story ID to force the bootstrapping
        // of the views. If this is the initial save of a new story, don't
        // reload. 
        window.location.replace(url);
      }
    },

    selectStep: function(step, subStep) {
      if (!this.hasStory && step != 'build' && step != 'selecttemplate') {
        this.handleHashedId(!this.hasStory);
      }
      this.dispatcher.trigger('select:workflowstep', step, subStep);
    },

    build: function(id) {
      var url;
      if (id) {
        this.handleHashedId(!this.hasStory);
      }

      this.selectStep('build');
    },

    selectTemplate: function() {
      this.selectStep('selecttemplate');
    },

    selectIdStep: function(id, step, subStep) {
      this.selectStep(step, subStep);
    },

    /**
     * Signal handler for the save:story signal.
     *
     * Toggles the this.hasStory flag to true.
     */
    setHasStory: function(story) {
      this.hasStory = true;
    }
  });
})(Backbone, storybase);

@@ -502,10 +502,10 @@
 a ro
-t
 u
+t
 es p
@@ -630,24 +630,128 @@
 isting story
+.%0A      //%0A      // Remember that routes added later take precedence over%0A      // routes added earlier.
 %0A      if (t
@@ -986,24 +986,25 @@
 w story%0A
+%0A
         
 if (this
@@ -999,34 +999,105 @@
     
-if (this.hasTemplate) %7B%0A  
+// Create routes for the workflow steps once the story is%0A        // saved and an Id is assigned%0A
     
@@ -1104,32 +1104,36 @@
     this.route(%22
+:id/
 %22, %22build%22);%0A   
@@ -1141,65 +1141,138 @@
     
-%7D%0A        else %7B%0A          this.route(%22%22, %22select
+this.route(%22:id/:step/%22, %22selectIdStep%22);%0A        this.route(%22:id/:step/:substep/%22, %22selectIdStep%22);%0A%0A        if (this.has
 Template
 %22);%0A
@@ -1267,19 +1267,19 @@
 Template
-%22);
+) %7B
 %0A       
@@ -1275,26 +1275,119 @@
 ) %7B%0A        
-%7D%0A
+  // Template is already selected.  Default route points to%0A          // build workflow step%0A  
         this
@@ -1386,36 +1386,32 @@
     this.route(%22
-:id/
 %22, %22build%22);%0A   
@@ -1419,108 +1419,330 @@
     
-this.route(%22:id/:step/%22, %22selectIdStep%22);%0A        this.route(%22:id/:step/:substep/%22, %22selectIdStep%22);
+%7D%0A        else %7B%0A          // A template hasn't been selected.  Default route points%0A          // to template selection workflow step%0A          this.route(%22%22, %22selectTemplate%22);%0A          // The info workflow step should be accessible before the%0A          // story is saved%0A          this.route(%22info/%22, %22info%22);%0A        %7D
 %0A   
@@ -3427,16 +3427,34 @@
 emplate'
+ && step != 'info'
 ) %7B%0A    
@@ -3722,32 +3722,94 @@
 uild');%0A    %7D,%0A%0A
+    info: function() %7B%0A      this.selectStep('info');%0A    %7D,%0A%0A
     selectTempla

Make "Story Info" workflow step of builder accessible for new stories