Skip to content

Commit

Permalink
Merge pull request #110 from OpenDataServices/96-about
Browse files Browse the repository at this point in the history
templates: Add text to the about page, including git revision
  • Loading branch information
michaelwood committed Mar 23, 2021
2 parents 8c02562 + a686067 commit 3e31e51
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 15 deletions.
23 changes: 23 additions & 0 deletions standards_lab/ui/templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block title %}About |{% endblock %}
{% block content %}
<div class="container mt-3">
<h1 class="mb-3 text-right">Open Standards Lab</h1>

{% include "about_top.html" %}

<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">Who?</h5>
<p>Built by <a href="http://opendataservices.coop/">Open Data Services Co-operative</a> with funding from the <a href="https://theodi.org/">ODI (Open Data Institute)</a>.</p>
</div>
</div>

<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">Technical</h5>
<p>Git revision: <a href="https://github.com/OpenDataServices/standards-lab/tree/{{ git_rev }}">{{ git_rev }}</a></p>
</div>
</div>
</div>
{% endblock %}
11 changes: 11 additions & 0 deletions standards_lab/ui/templates/about_top.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="card mb-4">
<div class="card-body">
<p>Open Standards Lab is a tool to help you to develop JSON schema and improve the quality of open data. You can:</p>
<ul>
<li>Upload and edit JSON schema files</li>
<li>Upload and edit data in multiple formats</li>
<li>Test data using your schema</li>
</ul>
<p>Note: All projects, data and schema is visible to all users.</p>
</div>
</div>
15 changes: 2 additions & 13 deletions standards_lab/ui/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@
<div class="container mt-3">
<h1 class="mb-3 text-right">Open Standards Lab</h1>

<div class="card mb-4">
<div class="card-body">
<p>Open Standards Lab is a tool to help you to develop JSON schema and improve the quality of open data. You can:</p>
<ul>
<li>Upload and edit JSON schema files</li>
<li>Upload and edit data in multiple formats</li>
<li>Test data using your schema</li>
</ul>
<p>Note: All projects, data and schema is visible to all users.</p>
</div>
</div>

{% include "about_top.html" %}

{% if projects %}
<div class="card mb-4">
Expand Down Expand Up @@ -79,4 +68,4 @@ <h5 class="card-title">Create A New Project</h5>
});
</script>
{% endif %}
{% endblock %}
{% endblock %}
3 changes: 1 addition & 2 deletions standards_lab/ui/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.urls import path
from django.views.generic.base import TemplateView

import ui.views
from ui.apps import UiConfig
Expand All @@ -14,5 +13,5 @@
ui.views.CoveResults.as_view(),
name="cove-results",
),
path("about", TemplateView.as_view(template_name="about.html"), name="about"),
path("about", ui.views.About.as_view(template_name="about.html"), name="about"),
]
18 changes: 18 additions & 0 deletions standards_lab/ui/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
import processor.cove
from django.conf import settings
from django.http import Http404
Expand All @@ -16,6 +17,23 @@ def get_context_data(self, **kwargs):
return context


class About(TemplateView):
template_name = "about.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

# Not critical if this fails e.g. git not installed
try:
context["git_rev"] = subprocess.check_output(
["git show --format=format:%h --no-patch"], shell=True
).decode()
except Exception:
pass

return context


class ProjectView(TemplateView):
template_name = "project.html"

Expand Down

0 comments on commit 3e31e51

Please sign in to comment.