From c41269161bfaf1cf600cef187cf594e56ce2ae00 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Thu, 23 Oct 2014 10:50:57 -0700 Subject: [PATCH] Fixed links on full docs --- docs/.meteor/packages | 1 + docs/.meteor/versions | 3 +++ docs/client/api-box.js | 4 +-- docs/client/basic/toc.js | 6 ++--- docs/client/{ => full-api}/api/accounts.md | 0 docs/client/{ => full-api}/api/assets.md | 0 docs/client/{ => full-api}/api/blaze.md | 0 docs/client/{ => full-api}/api/check.md | 0 docs/client/{ => full-api}/api/collections.md | 0 docs/client/{ => full-api}/api/connections.md | 0 docs/client/{ => full-api}/api/core.md | 0 docs/client/{ => full-api}/api/ejson.md | 0 docs/client/{ => full-api}/api/email.md | 0 docs/client/{ => full-api}/api/http.md | 0 docs/client/{ => full-api}/api/methods.md | 0 .../{ => full-api}/api/mobile-config.md | 0 docs/client/{ => full-api}/api/packagejs.md | 0 docs/client/{ => full-api}/api/passwords.md | 0 docs/client/{ => full-api}/api/pubsub.md | 0 .../client/{ => full-api}/api/reactive-var.md | 0 docs/client/{ => full-api}/api/session.md | 0 docs/client/{ => full-api}/api/templates.md | 0 docs/client/{ => full-api}/api/timers.md | 0 docs/client/{ => full-api}/api/tracker.md | 0 docs/client/full-api/docs.html | 1 + docs/client/full-api/docs.js | 13 --------- docs/client/full-api/tableOfContents.html | 7 ----- docs/client/full-api/tableOfContents.js | 15 ----------- docs/client/layout.html | 7 +++++ docs/client/layout.js | 16 +++++++++++ docs/client/links.js | 27 +++++++++++++++++++ 31 files changed, 60 insertions(+), 40 deletions(-) rename docs/client/{ => full-api}/api/accounts.md (100%) rename docs/client/{ => full-api}/api/assets.md (100%) rename docs/client/{ => full-api}/api/blaze.md (100%) rename docs/client/{ => full-api}/api/check.md (100%) rename docs/client/{ => full-api}/api/collections.md (100%) rename docs/client/{ => full-api}/api/connections.md (100%) rename docs/client/{ => full-api}/api/core.md (100%) rename docs/client/{ => full-api}/api/ejson.md (100%) rename docs/client/{ => full-api}/api/email.md (100%) rename docs/client/{ => full-api}/api/http.md (100%) rename docs/client/{ => full-api}/api/methods.md (100%) rename docs/client/{ => full-api}/api/mobile-config.md (100%) rename docs/client/{ => full-api}/api/packagejs.md (100%) rename docs/client/{ => full-api}/api/passwords.md (100%) rename docs/client/{ => full-api}/api/pubsub.md (100%) rename docs/client/{ => full-api}/api/reactive-var.md (100%) rename docs/client/{ => full-api}/api/session.md (100%) rename docs/client/{ => full-api}/api/templates.md (100%) rename docs/client/{ => full-api}/api/timers.md (100%) rename docs/client/{ => full-api}/api/tracker.md (100%) create mode 100644 docs/client/links.js diff --git a/docs/.meteor/packages b/docs/.meteor/packages index 36c0e92005..93db884cd6 100644 --- a/docs/.meteor/packages +++ b/docs/.meteor/packages @@ -15,4 +15,5 @@ simple:markdown-templating simple:highlight.js less chrismbeckett:fontawesome4 +iron:location diff --git a/docs/.meteor/versions b/docs/.meteor/versions index af6aedf158..669e47c46e 100644 --- a/docs/.meteor/versions +++ b/docs/.meteor/versions @@ -22,6 +22,9 @@ html-tools@1.0.2 htmljs@1.0.2 http@1.0.7 id-map@1.0.1 +iron:core@1.0.0-pre4 +iron:location@1.0.0-pre4 +iron:url@1.0.0-pre4 jquery-waypoints@1.0.1 jquery@1.0.1 json@1.0.1 diff --git a/docs/client/api-box.js b/docs/client/api-box.js index 8617c4db20..33b5fc9617 100644 --- a/docs/client/api-box.js +++ b/docs/client/api-box.js @@ -142,12 +142,12 @@ Template.autoApiBox.helpers({ return signature; }, link: function () { - if (nameToId[this.longname]) { + if (Session.get("fullApi") && nameToId[this.longname]) { return nameToId[this.longname]; } // fallback - return this.longname.replace(".", "-"); + return this.longname.replace(/[.#]/g, "-"); }, paramsNoOptions: function () { return _.reject(this.params, function (param) { diff --git a/docs/client/basic/toc.js b/docs/client/basic/toc.js index aa9420c2e4..f12d4c2d43 100644 --- a/docs/client/basic/toc.js +++ b/docs/client/basic/toc.js @@ -120,12 +120,12 @@ Template.basicTableOfContents.helpers({ var self = this; if (self.id) { - return "#b-" + self.id; + return "#" + self.id; } else if (self.longname) { - return "#b-" + self.longname.replace(/[#.]/g, "-"); + return "#" + self.longname.replace(/[#.]/g, "-"); } }, linkForSection: function () { - return "#b-" + this.id; + return "#" + this.id; } }); \ No newline at end of file diff --git a/docs/client/api/accounts.md b/docs/client/full-api/api/accounts.md similarity index 100% rename from docs/client/api/accounts.md rename to docs/client/full-api/api/accounts.md diff --git a/docs/client/api/assets.md b/docs/client/full-api/api/assets.md similarity index 100% rename from docs/client/api/assets.md rename to docs/client/full-api/api/assets.md diff --git a/docs/client/api/blaze.md b/docs/client/full-api/api/blaze.md similarity index 100% rename from docs/client/api/blaze.md rename to docs/client/full-api/api/blaze.md diff --git a/docs/client/api/check.md b/docs/client/full-api/api/check.md similarity index 100% rename from docs/client/api/check.md rename to docs/client/full-api/api/check.md diff --git a/docs/client/api/collections.md b/docs/client/full-api/api/collections.md similarity index 100% rename from docs/client/api/collections.md rename to docs/client/full-api/api/collections.md diff --git a/docs/client/api/connections.md b/docs/client/full-api/api/connections.md similarity index 100% rename from docs/client/api/connections.md rename to docs/client/full-api/api/connections.md diff --git a/docs/client/api/core.md b/docs/client/full-api/api/core.md similarity index 100% rename from docs/client/api/core.md rename to docs/client/full-api/api/core.md diff --git a/docs/client/api/ejson.md b/docs/client/full-api/api/ejson.md similarity index 100% rename from docs/client/api/ejson.md rename to docs/client/full-api/api/ejson.md diff --git a/docs/client/api/email.md b/docs/client/full-api/api/email.md similarity index 100% rename from docs/client/api/email.md rename to docs/client/full-api/api/email.md diff --git a/docs/client/api/http.md b/docs/client/full-api/api/http.md similarity index 100% rename from docs/client/api/http.md rename to docs/client/full-api/api/http.md diff --git a/docs/client/api/methods.md b/docs/client/full-api/api/methods.md similarity index 100% rename from docs/client/api/methods.md rename to docs/client/full-api/api/methods.md diff --git a/docs/client/api/mobile-config.md b/docs/client/full-api/api/mobile-config.md similarity index 100% rename from docs/client/api/mobile-config.md rename to docs/client/full-api/api/mobile-config.md diff --git a/docs/client/api/packagejs.md b/docs/client/full-api/api/packagejs.md similarity index 100% rename from docs/client/api/packagejs.md rename to docs/client/full-api/api/packagejs.md diff --git a/docs/client/api/passwords.md b/docs/client/full-api/api/passwords.md similarity index 100% rename from docs/client/api/passwords.md rename to docs/client/full-api/api/passwords.md diff --git a/docs/client/api/pubsub.md b/docs/client/full-api/api/pubsub.md similarity index 100% rename from docs/client/api/pubsub.md rename to docs/client/full-api/api/pubsub.md diff --git a/docs/client/api/reactive-var.md b/docs/client/full-api/api/reactive-var.md similarity index 100% rename from docs/client/api/reactive-var.md rename to docs/client/full-api/api/reactive-var.md diff --git a/docs/client/api/session.md b/docs/client/full-api/api/session.md similarity index 100% rename from docs/client/api/session.md rename to docs/client/full-api/api/session.md diff --git a/docs/client/api/templates.md b/docs/client/full-api/api/templates.md similarity index 100% rename from docs/client/api/templates.md rename to docs/client/full-api/api/templates.md diff --git a/docs/client/api/timers.md b/docs/client/full-api/api/timers.md similarity index 100% rename from docs/client/api/timers.md rename to docs/client/full-api/api/timers.md diff --git a/docs/client/api/tracker.md b/docs/client/full-api/api/tracker.md similarity index 100% rename from docs/client/api/tracker.md rename to docs/client/full-api/api/tracker.md diff --git a/docs/client/full-api/docs.html b/docs/client/full-api/docs.html index 257d6260d1..822ca5ebef 100644 --- a/docs/client/full-api/docs.html +++ b/docs/client/full-api/docs.html @@ -1,5 +1,6 @@ diff --git a/docs/client/full-api/docs.js b/docs/client/full-api/docs.js index be6463c58c..c245ed2715 100644 --- a/docs/client/full-api/docs.js +++ b/docs/client/full-api/docs.js @@ -70,21 +70,8 @@ Meteor.startup(function () { }); }; - $('#main, #nav').delegate("a[href^='#']", 'click', function (evt) { - evt.preventDefault(); - var sel = $(this).attr('href'); - scrollToSection(sel); - - mixpanel.track('docs_navigate_' + sel); - }); - // Make external links open in a new tab. $('a:not([href^="#"])').attr('target', '_blank'); - - // Hide menu by tapping on background - $('#main').on('click', function () { - hideMenu(); - }); }); var hideMenu = function () { diff --git a/docs/client/full-api/tableOfContents.html b/docs/client/full-api/tableOfContents.html index 6e54c467f2..c6af298e2d 100644 --- a/docs/client/full-api/tableOfContents.html +++ b/docs/client/full-api/tableOfContents.html @@ -40,10 +40,3 @@
{{> UI.contentBlock}}
{{/if}} - - diff --git a/docs/client/full-api/tableOfContents.js b/docs/client/full-api/tableOfContents.js index 7fea5640ec..969e4459d7 100644 --- a/docs/client/full-api/tableOfContents.js +++ b/docs/client/full-api/tableOfContents.js @@ -389,19 +389,4 @@ Template.nav_section.helpers({ depthIs: function (n) { return this.depth === n; } -}); - -Template.basicOrFullSelect.events({ - "change .basic-or-full": function (event) { - Session.set("fullApi", event.target.value === "full"); - } -}); - -Template.basicOrFullSelect.helpers({ - isBasic: function () { - return ! Session.get("fullApi"); - }, - isFull: function () { - return Session.get("fullApi"); - } }); \ No newline at end of file diff --git a/docs/client/layout.html b/docs/client/layout.html index 41fb408d2c..5fb47c37c1 100644 --- a/docs/client/layout.html +++ b/docs/client/layout.html @@ -49,4 +49,11 @@

Meteor 1.0 Docs

+ + + \ No newline at end of file diff --git a/docs/client/layout.js b/docs/client/layout.js index 76755b4e5d..72c159f086 100644 --- a/docs/client/layout.js +++ b/docs/client/layout.js @@ -1,3 +1,19 @@ Template.registerHelper("fullApi", function () { return Session.get("fullApi"); +}); + +Template.basicOrFullSelect.events({ + "change .basic-or-full": function (event) { + Session.set("fullApi", event.target.value === "full"); + Iron.Location.go(Session.equals("fullApi", true) ? "/full" : "/basic"); + } +}); + +Template.basicOrFullSelect.helpers({ + isBasic: function () { + return ! Session.get("fullApi"); + }, + isFull: function () { + return Session.get("fullApi"); + } }); \ No newline at end of file diff --git a/docs/client/links.js b/docs/client/links.js new file mode 100644 index 0000000000..f80ce42c43 --- /dev/null +++ b/docs/client/links.js @@ -0,0 +1,27 @@ +Tracker.autorun(function () { + // returns a "location" like object with all of the url parts + var current = Iron.Location.get(); + + console.log(current); + if (current.path === "/basic") { + Session.set("fullApi", false); + } else if (current.path === "/full") { + Session.set("fullApi", true); + } else { + if (current.hash) { + // XXX COMPAT WITH old docs + Iron.Location.go("/full"); + } else { + Iron.Location.go("/basic"); + } + } + + Tracker.afterFlush(function () { + setTimeout(function () { + console.log($(".main-content").offset(), $(current.hash).offset()); + $(".main-content").animate({ + scrollTop: $(".main-content").scrollTop() + $(current.hash).offset().top + }, 1000); + }, 0); + }); +}); \ No newline at end of file