diff options
-rw-r--r-- | theme/javascript/app.js | 22 | ||||
-rw-r--r-- | theme/templates/includes/book/exercise.html | 2 |
2 files changed, 14 insertions, 10 deletions
diff --git a/theme/javascript/app.js b/theme/javascript/app.js index 34247ca..392d45b 100644 --- a/theme/javascript/app.js +++ b/theme/javascript/app.js @@ -14,9 +14,6 @@ require([ $(document).ready(function() { var $book = state.$book; - // Initialize storage - storage.setBaseKey(state.githubId); - // Init sidebar sidebar.init(); @@ -26,12 +23,17 @@ require([ // Init keyboard keyboard.init(); - // Star and watch count - $.getJSON("https://api.github.com/repos/"+state.githubId) - .done(function(repo) { - $book.find(".count-star span").text(repo.stargazers_count); - $book.find(".count-watch span").text(repo.subscribers_count); - }); + if (state.githubId) { + // Initialize storage + storage.setBaseKey(state.githubId); + + // Star and watch count + $.getJSON("https://api.github.com/repos/"+state.githubId) + .done(function(repo) { + $book.find(".count-star span").text(repo.stargazers_count); + $book.find(".count-watch span").text(repo.subscribers_count); + }); + } // Bind exercise exercise.init(); @@ -45,4 +47,4 @@ require([ // Focus on content $(".book-body").focus(); }); -});
\ No newline at end of file +}); diff --git a/theme/templates/includes/book/exercise.html b/theme/templates/includes/book/exercise.html index 1acbe79..fbf8505 100644 --- a/theme/templates/includes/book/exercise.html +++ b/theme/templates/includes/book/exercise.html @@ -20,5 +20,7 @@ <div class="btn-group btn-group-justified"> <a href="#" class="btn btn-default action-submit">Submit</a> <a href="#" class="btn btn-default action-solution">Solution</a> + {% if githubId %} <a href="{{ githubHost }}{{ githubId }}/issues/new" target="_blank" class="btn btn-default">Have a Question?</a> + {% endif %} </div> |