Commit 785ad35d authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Switch to using #! URL fragments.

parent c1d3ffc9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ module JsDuck
      @categories_path = nil
      @inline_examples_dir = nil
      @pretty_json = false
      @link_tpl = '<a href="#/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>'
      @link_tpl = '<a href="#!/api/%c%-%m" rel="%c%-%m" class="docClass">%a</a>'
      # Note that we wrap image template inside <p> because {@img} often
      # appears inline within text, but that just looks ugly in HTML
      @img_tpl = '<p><img src="doc-resources/%u" alt="%a"></p>'
@@ -166,7 +166,7 @@ module JsDuck
          "%# - inserts '#' if member name present",
          "%- - inserts '-' if member name present",
          "%a - anchor text for link",
          "Default is: '<a href=\"#/api/%c%-%m\" rel=\"%c%-%m\" class=\"docClass\">%a</a>'", " ") do |tpl|
          "Default is: '<a href=\"#!/api/%c%-%m\" rel=\"%c%-%m\" class=\"docClass\">%a</a>'", " ") do |tpl|
          @link_tpl = tpl
        end

+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ Ext.define("Docs.History", {

    // Parses current URL and navigates to the page
    navigate: function(token) {
        token = token.replace(/^!/, "");
        var url = this.parseToken(token);
        if (url.url == "/api") {
            Docs.App.getController('Classes').loadIndex(true);
@@ -58,6 +59,9 @@ Ext.define("Docs.History", {
     * @param {String} token  the part of URL after #
     */
    push: function(token) {
        if (!/^#!?/.test(token)) {
          token = "#!"+token;
        }
        Ext.util.History.add(token);
    }
});
+3 −3
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ Ext.define('Docs.Renderer', {
    },

    renderLink: function(className) {
        return Ext.String.format('<a href="#/api/{0}" rel="{0}" class="docClass">{0}</a>', className);
        return Ext.String.format('<a href="#!/api/{0}" rel="{0}" class="docClass">{0}</a>', className);
    },

    renderMembers: function(cls) {
@@ -165,7 +165,7 @@ Ext.define('Docs.Renderer', {
                // member name and type + link to owner class and source
                '<div class="title">',
                    '<div class="meta">',
                        '<a href="#/api/{owner}" rel="{owner}" class="definedIn docClass">{owner}</a><br/>',
                        '<a href="#!/api/{owner}" rel="{owner}" class="definedIn docClass">{owner}</a><br/>',
                        '<a href="source/{href}" target="_blank" class="viewSource">view source</a>',
                    '</div>',
                    '{signature}',
@@ -208,7 +208,7 @@ Ext.define('Docs.Renderer', {

    renderSignature: function(member) {
        this.signatureTpl = this.signatureTpl || new Ext.XTemplate(
            '{before}<a href="#/api/{owner}-{tagname}-{name}" class="name {expandable}">{name}</a>{params}{after}'
            '{before}<a href="#!/api/{owner}-{tagname}-{name}" class="name {expandable}">{name}</a>{params}{after}'
        );

        var cfg = Ext.apply({}, member);
+5 −5
Original line number Diff line number Diff line
@@ -129,11 +129,11 @@ Ext.define('Docs.controller.Classes', {
    // We don't want to select the class that was opened in another window,
    // so restore the previous selection.
    handleUrlClick: function(url, event, view) {
        // Remove everything up to #
        url = url.replace(/.*#/, "");
        // Remove everything up to #!
        url = url.replace(/.*#!?/, "");

        if (this.opensNewWindow(event)) {
            window.open("#"+url);
            window.open("#!"+url);
            view && view.selectUrl(this.activeUrl ? this.activeUrl : "");
        }
        else {
@@ -149,10 +149,10 @@ Ext.define('Docs.controller.Classes', {
    loadIndex: function(noHistory) {
        this.activeUrl = "";
        if (!noHistory) {
            Docs.History.push("#/api");
            Docs.History.push("#!/api");
        }
        this.getViewport().setPageTitle("");
        Ext.getCmp('doctabs').activateTab('#/api');
        Ext.getCmp('doctabs').activateTab('#!/api');
        Ext.getCmp('treecontainer').showTree('classtree');
        Ext.getCmp('card-panel').layout.setActiveItem('classindex');
    },
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ Ext.define('Docs.controller.Examples', {
    },

    loadIndex: function() {
        Ext.getCmp('doctabs').activateTab('#/example');
        Ext.getCmp('doctabs').activateTab('#!/example');
        Ext.getCmp('card-panel').layout.setActiveItem('exampleindex');
        Ext.getCmp('treecontainer').showTree('exampletree');
    },
Loading