help page functional

This commit is contained in:
bigeagle 2016-02-06 18:23:30 +08:00
parent 0e33d8f118
commit b8da01fb9b
3 changed files with 11 additions and 39 deletions

View File

@ -4,12 +4,13 @@
<body>
{% include nav.html %}
{% assign help_pages = (site.categories["help"] | sort: 'mirrorid') %}
<div id="help-page">
<div class="container">
<div class="row">
<div class="col-sm-2 hidden-xs">
<ul class="nav nav-pills nav-stacked" id="help-nav">
{% for h in site.categories["help"] reversed %}
{% for h in help_pages %}
<li{% if h.mirrorid == page.mirrorid%} class="active"{%endif%}><a href="{{h.url}}">{{h.mirrorid}}</a></li>
{% endfor %}
</ul>
@ -20,8 +21,8 @@
<div class="form-group">
<label>选择帮助条目: </label>
<select class="form-control" id="help-select">
{% for h in site.categories["help"]%}
<option>{{h.mirrorid}}</option>
{% for h in help_pages %}
<option data-help-url="{{h.url}}">{{h.mirrorid}}</option>
{% endfor %}
</select>
</div>

View File

@ -3,41 +3,12 @@ permalink: /help/
---
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include nav.html %}
<script>
{% assign first_help = (site.categories["help"] | sort: 'mirrorid' | first ) %}
var redirect_to = window.location.protocol + "//" + window.location.host + "{{first_help.url}}";
window.location = redirect_to;
</script>
<div id="help-page">
<div class="container">
<div class="row">
<div class="col-sm-2 hidden-xs">
<ul class="nav nav-pills nav-stacked" id="help-nav">
{% for h in site.categories["help"]%}
<li><a href="{{h.url}}">{{h.mirrorid}}</a></li>
{% endfor %}
</ul>
</div><!-- sidenave -->
<div class="col-sm-10">
<div class="visible-xs">
<form class="form-inline">
<div class="form-group">
<label>选择帮助条目: </label>
<select class="form-control" id="help-select"></select>
</div>
</form>
</div>
<div id="spinner">
<i class="fa fa-spinner fa-spin"></i>
<div>载入中</div>
</div>
<div id="help-content"></div>
</div><!-- help content -->
</div>
</div><!--/container -->
</div><!--/mirrors -->
{% include footer.html %}
</body>
</html>
<!--
vim: ts=2 sts=2 sw=2 noexpandtab

View File

@ -28,8 +28,8 @@ $(document).ready(() => {
});
$('#help-select').on('change', (ev) => {
let help_item = $(ev.target).find("option:selected").attr('data-help-item');
showHelp(help_item);
let help_url = $(ev.target).find("option:selected").attr('data-help-url');
window.location = `${window.location.protocol}//${window.location.host}${help_url}`;
});
});