Download:
child 247:b9d50d59eddc
parent 245:19950999005a
246:f31fc5c409e1
Anton Shestakov <av6@dwimlabs.net>, Wed, 26 Oct 2016 18:42:45 +0800
viewer: add <link type="alternate"> element for atom feed

3 файлов изменено, 9 вставок(+), 0 удалений(-) [+]
templates/base.html file | annotate | diff | comparison | revisions
templates/project.html file | annotate | diff | comparison | revisions
tests/test_viewer.py file | annotate | diff | comparison | revisions
--- a/templates/base.html Wed Oct 26 07:38:07 2016 +0800
+++ b/templates/base.html Wed Oct 26 18:42:45 2016 +0800
@@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% end %}{% block extra-title %} - Cat and Owl's online linter{% end %}</title>
+ {% block alternate %}{% end %}
<link rel="shortcut icon" href="/static/favicon-cat.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.4/css/uikit.almost-flat.min.css" integrity="sha384-48XAELI+4suEKjYIXCNBu24eiwixJZ07IZznit90wBrOErxxeIKkEs1pJuwTUD/m" crossorigin="anonymous">
<link rel="stylesheet" href="/static/main.css">
--- a/templates/project.html Wed Oct 26 07:38:07 2016 +0800
+++ b/templates/project.html Wed Oct 26 18:42:45 2016 +0800
@@ -2,6 +2,10 @@
{% block title %}{{ project.name }}{% end %}
+{% block alternate %}
+ <link rel="alternate" href="{{ project.get_url() }}/atom" type="application/atom+xml" title="{{ project.name }} feed">
+{% end %}
+
{% block content %}
<div class="uk-container uk-container-center uk-margin-large-top">
<h2>{% module Template('ui/project-link.html', project=project) %}</h2>
--- a/tests/test_viewer.py Wed Oct 26 07:38:07 2016 +0800
+++ b/tests/test_viewer.py Wed Oct 26 18:42:45 2016 +0800
@@ -107,6 +107,10 @@
assert '1 error' in response.body
assert '1 warning' in response.body
assert '<a href="#">default</a>' in response.body
+ assert ('<link rel="alternate"'
+ ' href="/example.com/alice/test-viewer/atom"'
+ ' type="application/atom+xml"'
+ ' title="test-viewer feed">') in response.body
def test_atom(self):
response = self.fetch('/example.com/alice/test-viewer/atom')