Disable links to the docs when the wiki is not available.

This commit is contained in:
Paulo Reis 2016-06-27 11:34:24 +01:00
parent f427ce88d9
commit 81b93ab5a9
3 changed files with 13 additions and 4 deletions

View file

@ -97,6 +97,7 @@ block content
window.csrfToken = "!{csrfToken}";
window.anonymous = #{anonymous};
window.maxDocLength = #{maxDocLength};
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
window.requirejs = {
"paths" : {
"mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML",

View file

@ -114,9 +114,11 @@ div.full-size.pdf(ng-controller="PdfController")
)
figure.card-hint-icon-container
i.fa.fa-lightbulb-o(aria-hidden="true")
p.card-hint-text(ng-show="entry.humanReadableHint", ng-bind-html="entry.humanReadableHint")
.card-hint-actions
.card-hint-ext-link
p.card-hint-text(
ng-show="entry.humanReadableHint",
ng-bind-html="wikiEnabled ? entry.humanReadableHint : stripHTMLFromString(entry.humanReadableHint)")
.card-hint-actions.clearfix
.card-hint-ext-link(ng-if="wikiEnabled")
a(ng-href="{{ entry.extraInfoURL }}", target="_blank")
i.fa.fa-external-link
| #{translate("log_hint_extra_info")}

View file

@ -13,6 +13,7 @@ define [
# pdf.view = uncompiled | pdf | errors
$scope.pdf.view = if $scope?.pdf?.url then 'pdf' else 'uncompiled'
$scope.shouldShowLogs = false
$scope.wikiEnabled = window.wikiEnabled;
if ace.require("ace/lib/useragent").isMac
$scope.modifierKey = "Cmd"
@ -24,6 +25,11 @@ define [
qs_args = ("#{k}=#{v}" for k, v of args)
if qs_args.length then "?" + qs_args.join("&") else ""
$scope.stripHTMLFromString = (htmlStr) ->
tmp = document.createElement("DIV")
tmp.innerHTML = htmlStr
return tmp.textContent || tmp.innerText || ""
$scope.$on "project:joined", () ->
return if !autoCompile
autoCompile = false
@ -173,7 +179,7 @@ define [
accumulateResults = (newEntries) ->
for key in ['all', 'errors', 'warnings']
logEntries[key] = logEntries[key].concat newEntries[key]
# use the parsers for each file type
processLog = (log) ->
$scope.pdf.rawLog = log