~ubuntu-branches/ubuntu/trusty/couchdb/trusty-proposed

« back to all changes in this revision

Viewing changes to src/fauxton/app/main.js

  • Committer: Package Import Robot
  • Author(s): Jason Gerard DeRose
  • Date: 2013-12-01 16:55:05 UTC
  • mfrom: (1.3.5)
  • Revision ID: package-import@ubuntu.com-20131201165505-for2toyl58mhzwj2
Tags: 1.5.0-0ubuntu1
* New upstream release (LP: #1254371)
* Don't include `couchdb` info page in `couchdb-bin` binary package as it
  provides no meaningful benefit over the `couchdb` man page (note this change
  means we don't need to add a Build-Depends on `install-info` for Trusty)
* Remove Build-Depends: texlive-latex-base, texlive-latex-recommended,
  texlive-latex-extra, texlive-fonts-recommended, texinfo (as documentation
  thus produced doesn't get included in the binary packages anyway)
* debian/rules: don't call ./configure with --enable-strictness as we dropped
  Build-Depends on `texlive-*`, `texinfo`, plus didn't add `install-info` 
* Add Build-Depends: lsb-release (used for [vendor] info in default.ini)
* debian/rules: insert proper [vendor] info in default.ini (note this should
  be improved once there is a better mechanism upstream)
* debian/couchdb.upstart: start on filesystem and static-network-up,
  stop on deconfiguring-networking, plus add "author" line

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require([
 
2
        // Application.
 
3
        "app",
 
4
 
 
5
        // Main Router.
 
6
        "router"
 
7
],
 
8
 
 
9
function(app, Router) {
 
10
 
 
11
  // Define your master router on the application namespace and trigger all
 
12
  // navigation from this instance.
 
13
  app.router = new Router();
 
14
  // Trigger the initial route and enable HTML5 History API support, set the
 
15
  // root folder to '/' by default.  Change in app.js.
 
16
  Backbone.history.start({ pushState: false, root: app.root });
 
17
  // All navigation that is relative should be passed through the navigate
 
18
  // method, to be processed by the router. If the link has a `data-bypass`
 
19
  // attribute, bypass the delegation completely.
 
20
  $(document).on("click", "a:not([data-bypass])", function(evt) {
 
21
    // Get the absolute anchor href.
 
22
    var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
 
23
    // Get the absolute root.
 
24
    var root = location.protocol + "//" + location.host + app.root;
 
25
    // Ensure the root is part of the anchor href, meaning it's relative.
 
26
    if (href.prop && href.prop.slice(0, root.length) === root) {
 
27
      // Stop the default event to ensure the link will not cause a page
 
28
      // refresh.
 
29
      evt.preventDefault();
 
30
 
 
31
      // `Backbone.history.navigate` is sufficient for all Routers and will
 
32
      // trigger the correct events. The Router's internal `navigate` method
 
33
      // calls this anyways.  The fragment is sliced from the root.
 
34
      Backbone.history.navigate(href.attr, true);
 
35
    }
 
36
 
 
37
  });
 
38
});