From 536c48096938ef141fdf4351739f8362e80641da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Sun, 6 Apr 2014 17:06:01 -0700 Subject: [PATCH] Fix loading of search index in sub directories --- theme/assets/app.js | 6 +++--- theme/javascript/core/search.js | 2 +- theme/javascript/core/sidebar.js | 1 - theme/javascript/core/state.js | 3 ++- theme/templates/site.html | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/theme/assets/app.js b/theme/assets/app.js index 6efa9c0d7..ec6285ff5 100644 --- a/theme/assets/app.js +++ b/theme/assets/app.js @@ -18088,7 +18088,8 @@ define('core/state',[ '$book': $book, 'githubId': $book.data("github"), - 'level': $book.data("level") + 'level': $book.data("level"), + 'basePath': $book.data("basepath") }; }); /*global define:false */ @@ -19107,7 +19108,6 @@ define('core/sidebar',[ // Filter summary with a list of path var filterSummary = function(paths) { - console.log("filter with", paths); $summary.find("li").each(function() { var path = $(this).data("path"); var st = paths == null || _.contains(paths, path); @@ -21018,7 +21018,7 @@ define('core/search',[ // Load complete index var loadIndex = function() { - return $.getJSON("search_index.json") + return $.getJSON(state.basePath+"/search_index.json") .then(function(data) { index = lunr.Index.load(data); }); diff --git a/theme/javascript/core/search.js b/theme/javascript/core/search.js index 0aca9978a..a5399d996 100644 --- a/theme/javascript/core/search.js +++ b/theme/javascript/core/search.js @@ -11,7 +11,7 @@ define([ // Load complete index var loadIndex = function() { - return $.getJSON("search_index.json") + return $.getJSON(state.basePath+"/search_index.json") .then(function(data) { index = lunr.Index.load(data); }); diff --git a/theme/javascript/core/sidebar.js b/theme/javascript/core/sidebar.js index ab5b19af1..d31867650 100644 --- a/theme/javascript/core/sidebar.js +++ b/theme/javascript/core/sidebar.js @@ -38,7 +38,6 @@ define([ // Filter summary with a list of path var filterSummary = function(paths) { - console.log("filter with", paths); $summary.find("li").each(function() { var path = $(this).data("path"); var st = paths == null || _.contains(paths, path); diff --git a/theme/javascript/core/state.js b/theme/javascript/core/state.js index b219f5d17..5ed11e8a9 100644 --- a/theme/javascript/core/state.js +++ b/theme/javascript/core/state.js @@ -7,6 +7,7 @@ define([ '$book': $book, 'githubId': $book.data("github"), - 'level': $book.data("level") + 'level': $book.data("level"), + 'basePath': $book.data("basepath") }; }); \ No newline at end of file diff --git a/theme/templates/site.html b/theme/templates/site.html index 42fa6671b..5bb3c8b67 100644 --- a/theme/templates/site.html +++ b/theme/templates/site.html @@ -2,7 +2,7 @@ {% block title %}{{ progress.current.title }}{% parent %}{% endblock %} {% block content %} -
+
{% include "includes/book/header.html" %} {% include "includes/book/summary.html" %}