diff --git a/hc/front/management/commands/pygmentize.py b/hc/front/management/commands/pygmentize.py index 29835a45..0972692e 100644 --- a/hc/front/management/commands/pygmentize.py +++ b/hc/front/management/commands/pygmentize.py @@ -27,10 +27,12 @@ class Command(BaseCommand): return # Invocation examples - _process("bash", lexers.BashLexer()) + _process("bash_curl", lexers.BashLexer()) + _process("bash_wget", lexers.BashLexer()) _process("browser", lexers.JavascriptLexer()) _process("crontab", lexers.BashLexer()) - _process("python", lexers.PythonLexer()) + _process("python_urllib2", lexers.PythonLexer()) + _process("python_requests", lexers.PythonLexer()) _process("php", lexers.PhpLexer()) _process("powershell", lexers.shell.PowerShellLexer()) _process("node", lexers.JavascriptLexer()) @@ -38,7 +40,8 @@ class Command(BaseCommand): # API examples _process("list_checks_request", lexers.BashLexer()) _process("list_checks_response", lexers.JsonLexer()) - _process("create_check_request", lexers.BashLexer()) + _process("create_check_request_a", lexers.BashLexer()) + _process("create_check_request_b", lexers.BashLexer()) _process("create_check_response", lexers.JsonLexer()) _process("pause_check_request", lexers.BashLexer()) _process("pause_check_response", lexers.JsonLexer()) diff --git a/static/css/base.css b/static/css/base.css index 825e77f5..2fa9f07e 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -74,4 +74,8 @@ body { .dialog-body { margin: 24px 0; +} + +pre { + border: 0; } \ No newline at end of file diff --git a/static/css/docs.css b/static/css/docs.css index 4455b211..ff2188e0 100644 --- a/static/css/docs.css +++ b/static/css/docs.css @@ -55,7 +55,8 @@ a.section:hover { .page-docs code { padding: 2px 4px; font-size: 90%; - color: #427d5e; - background-color: #f2f9f6; + color: #333; + background-color: #f5f5f5; border-radius: 4px; -} \ No newline at end of file +} + diff --git a/static/css/icomoon.css b/static/css/icomoon.css index a62470b5..287b9c92 100644 --- a/static/css/icomoon.css +++ b/static/css/icomoon.css @@ -1,10 +1,10 @@ @font-face { font-family: 'icomoon'; - src: url('../fonts/icomoon.eot?j2asdo'); - src: url('../fonts/icomoon.eot?j2asdo#iefix') format('embedded-opentype'), - url('../fonts/icomoon.ttf?j2asdo') format('truetype'), - url('../fonts/icomoon.woff?j2asdo') format('woff'), - url('../fonts/icomoon.svg?j2asdo#icomoon') format('svg'); + src: url('../fonts/icomoon.eot?cxijqz'); + src: url('../fonts/icomoon.eot?cxijqz#iefix') format('embedded-opentype'), + url('../fonts/icomoon.ttf?cxijqz') format('truetype'), + url('../fonts/icomoon.woff?cxijqz') format('woff'), + url('../fonts/icomoon.svg?cxijqz#icomoon') format('svg'); font-weight: normal; font-style: normal; } @@ -24,6 +24,9 @@ -moz-osx-font-smoothing: grayscale; } +.icon-clippy:before { + content: "\e900"; +} .icon-cancel:before { content: "\e5c9"; } diff --git a/static/css/my_checks.css b/static/css/my_checks.css index 6a1a9254..89344664 100644 --- a/static/css/my_checks.css +++ b/static/css/my_checks.css @@ -63,11 +63,20 @@ font-style: normal; } - #show-usage-modal .modal-dialog { width: 1100px; - } +} + +#show-usage-modal .modal-body { + padding: 0; +} + +#show-usage-modal pre { + margin: 0; + padding: 15px; +} + +#show-usage-modal .highlight:nth-child(n+2) { + border-top: 1px solid #ddd; +} - #show-usage-modal .tab-content { - margin-top: 15px; - } diff --git a/static/css/snippet-copy.css b/static/css/snippet-copy.css new file mode 100644 index 00000000..315aa3fb --- /dev/null +++ b/static/css/snippet-copy.css @@ -0,0 +1,15 @@ +.highlight { + position: relative; +} + +.highlight button { + position: absolute; + top: 4px; + right: 4px; + opacity: 0; + transition: opacity 0.1s linear; +} + +.highlight:hover button { + opacity: 1 +} diff --git a/static/css/welcome.css b/static/css/welcome.css index 9aca0590..625483e3 100644 --- a/static/css/welcome.css +++ b/static/css/welcome.css @@ -50,26 +50,6 @@ margin-bottom: 0; } -.page-welcome .highlight pre { - background: #FFF; - border-top: 0; - border-radius: 0; - border-color: #dddddd; -} - -#email .instructions { - background: #FFF; - border: 1px solid #dddddd; - border-top: 0; - padding: 10px; -} - -#email .email-address { - font-size: 18px; - padding-top: 10px; -} - - #get-started { margin-top: 4em; } @@ -86,4 +66,28 @@ .welcome-integrations img { width: 22px; height: 22px; -} \ No newline at end of file +} + +.page-welcome .tab-content { + border: 1px solid #ddd; + border-top: 0; +} + +.tab-pane p { + padding: 15px; + margin: 0; +} + +.page-welcome .highlight:nth-child(n+2) { + border-top: 1px solid #ddd; +} + +.page-welcome .tab-pane pre { + margin-bottom: 0; + background: transparent; + padding: 15px; +} + +.tab-pane.tab-pane-email { + border: none; +} diff --git a/static/fonts/icomoon.eot b/static/fonts/icomoon.eot index 2d318da4..87082976 100644 Binary files a/static/fonts/icomoon.eot and b/static/fonts/icomoon.eot differ diff --git a/static/fonts/icomoon.svg b/static/fonts/icomoon.svg index 2aa4f133..7b548958 100644 --- a/static/fonts/icomoon.svg +++ b/static/fonts/icomoon.svg @@ -19,4 +19,5 @@ + \ No newline at end of file diff --git a/static/fonts/icomoon.ttf b/static/fonts/icomoon.ttf index 21cc60cc..cea03cff 100644 Binary files a/static/fonts/icomoon.ttf and b/static/fonts/icomoon.ttf differ diff --git a/static/fonts/icomoon.woff b/static/fonts/icomoon.woff index 642be6a5..8c57375e 100644 Binary files a/static/fonts/icomoon.woff and b/static/fonts/icomoon.woff differ diff --git a/static/js/snippet-copy.js b/static/js/snippet-copy.js new file mode 100644 index 00000000..7f5efb9c --- /dev/null +++ b/static/js/snippet-copy.js @@ -0,0 +1,41 @@ +$(function() { + if (/Mac/i.test(navigator.userAgent)) { + // No support for Safari :( + return; + } + + var markup = ''; + + + + $(".highlight").append(markup); + + + var reBlankLines = new RegExp("^\\s*[\\r\\n]", "gm"); + var reTrailingWhitespace = new RegExp("\\s+$"); + + var clipboard = new Clipboard(".highlight button", { + text: function (trigger) { + var snippetElement = $(trigger).parent().children().clone(); + /* remove pygmentize comment elements */ + snippetElement.find(".c, .cm, .cp, .c1, .cs").remove(); + /* remove blank lines and trailing whitespace */ + return snippetElement.text().replace(reBlankLines, '').replace(reTrailingWhitespace, ''); + } + }); + + clipboard.on("success", function(e) { + $(e.trigger) + .tooltip({title: "Copied!", trigger: "hover"}) + .tooltip("show") + .on("hidden.bs.tooltip", function(){ + $(this).tooltip("destroy"); + }) + }); + + clipboard.on("error", function(e) { + prompt("Press Ctrl+C to select:", e.text) + }); +}); diff --git a/templates/base.html b/templates/base.html index 1d53c866..5f150e34 100644 --- a/templates/base.html +++ b/templates/base.html @@ -17,6 +17,7 @@ + diff --git a/templates/front/docs.html b/templates/front/docs.html index 676864ed..02e17114 100644 --- a/templates/front/docs.html +++ b/templates/front/docs.html @@ -1,5 +1,5 @@ {% extends "front/base_docs.html" %} -{% load staticfiles hc_extras %} +{% load compress staticfiles hc_extras %} {% block title %}Documentation - {% site_name %}{% endblock %} @@ -110,17 +110,18 @@ thing: they fire off a HTTP GET method.

Ubuntu, for example, does not have curl installed out of the box.

-{% include "front/snippets/bash.html" %} +{% include "front/snippets/bash_curl.html" %} +{% include "front/snippets/bash_wget.html" %}

Python

-{% include "front/snippets/python.html" %} +{% include "front/snippets/python_urllib2.html" %} +{% include "front/snippets/python_requests.html" %}

Node

{% include "front/snippets/node.html" %} -

PHP

{% include "front/snippets/php.html" %} @@ -152,9 +153,9 @@ do more things.

the following command in a Scheduled Task to run the script:

-
-powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1
-
+
+
powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1
+

Email

@@ -247,3 +248,12 @@ powershell.exe -ExecutionPolicy bypass -File C:\Scripts\healthchecks.ps1 {% endblock %} + +{% block scripts %} +{% compress js %} + + + + +{% endcompress %} +{% endblock %} diff --git a/templates/front/docs_api.html b/templates/front/docs_api.html index 21998e56..4c823814 100644 --- a/templates/front/docs_api.html +++ b/templates/front/docs_api.html @@ -1,5 +1,5 @@ {% extends "front/base_docs.html" %} -{% load staticfiles hc_extras %} +{% load compress staticfiles hc_extras %} {% block title %}REST API - {% site_name %}{% endblock %} @@ -167,7 +167,11 @@ The response may contain a JSON document with additional data.

Example Request

-{% include "front/snippets/create_check_request.html" %} +{% include "front/snippets/create_check_request_a.html" %} +
+

Or, alternatively:

+{% include "front/snippets/create_check_request_b.html" %} +

Example Response

{% include "front/snippets/create_check_response.html" %} @@ -194,6 +198,7 @@ The response may contain a JSON document with additional data.

Example Request

+ {% include "front/snippets/pause_check_request.html" %}

Example Response

@@ -201,3 +206,12 @@ The response may contain a JSON document with additional data. {% endblock %} + +{% block scripts %} +{% compress js %} + + + + +{% endcompress %} +{% endblock %} diff --git a/templates/front/my_checks.html b/templates/front/my_checks.html index 75a86ad8..072f6c2e 100644 --- a/templates/front/my_checks.html +++ b/templates/front/my_checks.html @@ -230,18 +230,18 @@