Browse Source

Make "API Reference" more prominent in Docs

pull/211/head
Pēteris Caune 6 years ago
parent
commit
c78ed91335
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 44 additions and 29 deletions
  1. +8
    -0
      static/css/docs.css
  2. +6
    -16
      templates/front/base_docs.html
  3. +30
    -13
      templates/front/docs.html

+ 8
- 0
static/css/docs.css View File

@ -26,6 +26,10 @@
font-family: monospace; font-family: monospace;
} }
.docs-heading {
margin-top: 40px;
}
h2.rule { h2.rule {
border-top: 3px solid #eee; border-top: 3px solid #eee;
margin-top: 30px; margin-top: 30px;
@ -38,6 +42,10 @@ h3.api-section {
margin: 20px 0; margin: 20px 0;
} }
h3.docs-example {
margin-top: 40px;
}
.api-path { .api-path {
font-family: monospace; font-family: monospace;
font-weight: bold; font-weight: bold;


+ 6
- 16
templates/front/base_docs.html View File

@ -1,4 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load hc_extras %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -6,26 +8,14 @@
<ul class="docs-nav"> <ul class="docs-nav">
<li {% if section == "home" %} class="active" {% endif %}> <li {% if section == "home" %} class="active" {% endif %}>
<a href="{% url 'hc-docs' %}">Executing a Ping</a>
<ul>
<li><a href="{% url 'hc-docs' %}#crontab">Crontab</a></li>
<li><a href="{% url 'hc-docs' %}#bash">Bash</a></li>
<li><a href="{% url 'hc-docs' %}#python">Python</a></li>
<li><a href="{% url 'hc-docs' %}#ruby">Ruby</a></li>
<li><a href="{% url 'hc-docs' %}#node">Node</a></li>
<li><a href="{% url 'hc-docs' %}#php">PHP</a></li>
<li><a href="{% url 'hc-docs' %}#cs">C#</a></li>
<li><a href="{% url 'hc-docs' %}#browser">Browser</a></li>
<li><a href="{% url 'hc-docs' %}#powershell">PowerShell</a></li>
<li><a href="{% url 'hc-docs' %}#email">Email</a></li>
</ul>
</li>
<li {% if section == "cron" %} class="active" {% endif %}>
<a href="{% url 'hc-docs-cron' %}">Cron Syntax</a>
<a href="{% url 'hc-docs' %}">How {% site_name %} Works</a>
</li> </li>
<li {% if section == "api" %} class="active" {% endif %}> <li {% if section == "api" %} class="active" {% endif %}>
<a href="{% url 'hc-docs-api' %}">API Reference</a> <a href="{% url 'hc-docs-api' %}">API Reference</a>
</li> </li>
<li {% if section == "cron" %} class="active" {% endif %}>
<a href="{% url 'hc-docs-cron' %}">Cron Syntax</a>
</li>
<li {% if section == "resources" %} class="active" {% endif %}> <li {% if section == "resources" %} class="active" {% endif %}>
<a href="{% url 'hc-docs-resources' %}">Third-Party Resources</a> <a href="{% url 'hc-docs-resources' %}">Third-Party Resources</a>
</li> </li>


+ 30
- 13
templates/front/docs.html View File

@ -12,7 +12,7 @@
{% block docs_content %} {% block docs_content %}
<h2>Summary</h2>
<h2>How {% site_name %} Works</h2>
<p> <p>
Each check in <a href="{% url 'hc-index' %}">My Checks</a> Each check in <a href="{% url 'hc-index' %}">My Checks</a>
page has a unique "ping" URL. Whenever you make a HTTP request to this URL, page has a unique "ping" URL. Whenever you make a HTTP request to this URL,
@ -29,7 +29,8 @@ if still no ping, sends you an alert.</p>
alerts. As soon as it fails to check in on time, you get notified. alerts. As soon as it fails to check in on time, you get notified.
It is a simple idea.</p> It is a simple idea.</p>
<h2>Executing a Ping</h2>
<h2 class="rule">Executing a Ping</h2>
<p> <p>
At the end of your batch job, add a bit of code to request At the end of your batch job, add a bit of code to request
your ping URL. your ping URL.
@ -50,7 +51,7 @@ It is a simple idea.</p>
<p>The response will have status code "200 OK" and response body will be a <p>The response will have status code "200 OK" and response body will be a
short and simple string "OK".</p> short and simple string "OK".</p>
<h2>Signalling a Failure</h2>
<h2 class="rule">Signalling a Failure</h2>
<p> <p>
Append <code>/fail</code> to a ping URL and use it to actively signal a Append <code>/fail</code> to a ping URL and use it to actively signal a
failure. Requesting the <code>/fail</code> URL will immediately mark the failure. Requesting the <code>/fail</code> URL will immediately mark the
@ -62,8 +63,24 @@ work function returns an unexpected value or throws an exception:</p>
{% include "front/snippets/python_requests_fail.html" %} {% include "front/snippets/python_requests_fail.html" %}
<h2 class="rule">Examples</h2>
<p>
Jump to example:
<a href="#crontab">Crontab</a>,
<a href="#bash">Bash</a>,
<a href="#python">Python</a>,
<a href="#ruby">Ruby</a>,
<a href="#node">Node</a>,
<a href="#php">PHP</a>,
<a href="#cs">C#</a>,
<a href="#browser">Browser</a>,
<a href="#powershell">PowerShell</a>,
<a href="#email">Email</a>.
</p>
<a name="crontab"></a> <a name="crontab"></a>
<h3>Crontab</h3>
<h3 class="docs-example">Crontab</h3>
<p> <p>
When using cron, probably the easiest is to append a curl When using cron, probably the easiest is to append a curl
@ -128,7 +145,7 @@ task runs. Feel free to adjust the curl options to your liking.
</table> </table>
<a name="bash"></a> <a name="bash"></a>
<h3>Bash or a shell script</h3>
<h3 class="docs-example">Bash or a shell script</h3>
<p>Both <code>curl</code> and <code>wget</code> examples accomplish the same <p>Both <code>curl</code> and <code>wget</code> examples accomplish the same
thing: they fire off a HTTP GET method.</p> thing: they fire off a HTTP GET method.</p>
@ -142,7 +159,7 @@ thing: they fire off a HTTP GET method.</p>
{% include "front/snippets/bash_wget.html" %} {% include "front/snippets/bash_wget.html" %}
<a name="python"></a> <a name="python"></a>
<h3>Python</h3>
<h3 class="docs-example">Python</h3>
<p> <p>
If you are already using the If you are already using the
@ -158,19 +175,19 @@ thing: they fire off a HTTP GET method.</p>
{% include "front/snippets/python_urllib2.html" %} {% include "front/snippets/python_urllib2.html" %}
<a name="ruby"></a> <a name="ruby"></a>
<h3>Ruby</h3>
<h3 class="docs-example">Ruby</h3>
{% include "front/snippets/ruby.html" %} {% include "front/snippets/ruby.html" %}
<a name="node"></a> <a name="node"></a>
<h3>Node</h3>
<h3 class="docs-example">Node</h3>
{% include "front/snippets/node.html" %} {% include "front/snippets/node.html" %}
<a name="php"></a> <a name="php"></a>
<h3>PHP</h3>
<h3 class="docs-example">PHP</h3>
{% include "front/snippets/php.html" %} {% include "front/snippets/php.html" %}
<a name="cs"></a> <a name="cs"></a>
<h3>C#</h3>
<h3 class="docs-example">C#</h3>
{% include "front/snippets/cs.html" %} {% include "front/snippets/cs.html" %}
<a name="browser"></a> <a name="browser"></a>
@ -183,7 +200,7 @@ thing: they fire off a HTTP GET method.</p>
{% include "front/snippets/browser.html" %} {% include "front/snippets/browser.html" %}
<a name="powershell"></a> <a name="powershell"></a>
<h3>PowerShell</h3>
<h3 class="docs-example">PowerShell</h3>
<p> <p>
You can use <a href="https://msdn.microsoft.com/en-us/powershell/mt173057.aspx">PowerShell</a> You can use <a href="https://msdn.microsoft.com/en-us/powershell/mt173057.aspx">PowerShell</a>
and Windows Task Scheduler to automate various tasks on a Windows system. and Windows Task Scheduler to automate various tasks on a Windows system.
@ -210,7 +227,7 @@ using the "-command" argument:</p>
{% include "front/snippets/powershell_inline.html" %} {% include "front/snippets/powershell_inline.html" %}
<a name="email"></a> <a name="email"></a>
<h3>Email</h3>
<h3 class="docs-example">Email</h3>
<p> <p>
As an alternative to HTTP/HTTPS requests, As an alternative to HTTP/HTTPS requests,
you can "ping" this check by sending an you can "ping" this check by sending an
@ -234,7 +251,7 @@ using the "-command" argument:</p>
</p> </p>
<h2>When Alerts Are Sent</h2>
<h2 class="rule">When Alerts Are Sent</h2>
<p> <p>
Each check has a configurable <strong>Period</strong> parameter, with the default value of one day. Each check has a configurable <strong>Period</strong> parameter, with the default value of one day.
For periodic tasks, this is the expected time gap between two runs. For periodic tasks, this is the expected time gap between two runs.


Loading…
Cancel
Save