Skip to content

Commit

Permalink
Better base template selection and added the admin domain.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdutton committed May 10, 2012
1 parent 6b45883 commit 58c2f69
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 77 deletions.
5 changes: 5 additions & 0 deletions voyager/core/context_processors.py
@@ -0,0 +1,5 @@
def base_template_chooser(request):
hosts = {'admin': 'hosts/admin.html',
'data': 'hosts/data.html'}

return {'base_template_name': hosts.get(request.host.name, hosts['data'])}
78 changes: 1 addition & 77 deletions voyager/templates/base.html
@@ -1,77 +1 @@
{% load hosts %}<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title>{% block title %}Data from the CLAROS Project{% endblock %} | data.clarosnet.org | CLAROS Data</title>

{% with "http://explore.clarosnet.org/XDB/ASP/clarosHome/styles/" as EXPLORER_STYLE %}
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}basic.css" media="all"/>
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}print.css" media="print"/>
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}full.css" media="screen and (min-device-width: 320px)"/>
{% endwith %}

<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}base.css"/>
<link rel="icon" type="image/x-icon" href="{{ STATIC_URL }}favicon.ico">

<!--<link rel="stylesheet" href="{{ STATIC_URL }}main.css" type="text/css"/>-->
{% if no_index %}<meta name="robots" content="noindex"/>{% endif %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="application/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="application/javascript" src="http://data.clarosnet.org/openlayers-media/OpenLayers.js"></script>
<script type="application/javascript" src="{{ STATIC_URL }}base.js"></script>
{% block extra_head %}{% endblock %}
</head>

{% block body %}
<body class="index">
<div id="all">
<div id="header">
<a id="logoLink" href="http://www.clarosnet.org/">
<span id="site-title">www.clarosnet.org: The world of art on the semantic web</span>
</a>
<div class="mainnav">
<ul>
{% block nav %}
<li><a href="{% host_url index on data %}">Home</a></li>
<li><a href="{% host_url claros-objects on data %}">Objects</a></li>
<li><a href="{% host_url claros-people on data %}">People</a></li>
<li><a href="{% host_url places:index on data %}">Places</a></li>
<li><a href="{% host_url sparql:endpoint on data %}">SPARQL</a></li>
{% endblock %}
</ul>
</div>
</div>

<div id="content">
{% block content %}
<h1>Home</h1>
{% endblock %}


</div>

{% if queries %}
<div id="query">
<div class="text-content" style="padding-top:0">
<h2>Quer{{ queries|pluralize:"y,ies" }} used to generate this page</h2>
{% for query in queries %}
<pre>{{ query }}</pre>
{% endfor %}
</div>
</div>
{% endif %}

</div>
<div id="footer">
<p>
Hosted by the University of Oxford's e-research centre, <a href="http://www.oerc.ox.ac.uk/">OeRC</a><br/>
This interface was built using <a href="http://openjena.org/wiki/Fuseki">Fuseki</a>,
<a href="https://github.com/oucs/humfrey">humfrey</a>, and
<a href="https://github.com/clarosnet/claros-voyager">a tweaked frontend</a>, all
<a href="http://www.opensource.org/">open-source software</a>.
</p>
</div>
</body>
{% endblock %}
</html>
{% extends base_template_name %}
3 changes: 3 additions & 0 deletions voyager/templates/hosts/admin.html
@@ -0,0 +1,3 @@
{% extends "admin/base_site.html" %}

{% block breadcrumbs %}{% endblock %}
77 changes: 77 additions & 0 deletions voyager/templates/hosts/data.html
@@ -0,0 +1,77 @@
{% load hosts %}<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title>{% block title %}Data from the CLAROS Project{% endblock %} | data.clarosnet.org | CLAROS Data</title>

{% with "http://explore.clarosnet.org/XDB/ASP/clarosHome/styles/" as EXPLORER_STYLE %}
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}basic.css" media="all"/>
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}print.css" media="print"/>
<link rel="stylesheet" type="text/css" href="{{ EXPLORER_STYLE }}full.css" media="screen and (min-device-width: 320px)"/>
{% endwith %}

<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}base.css"/>
<link rel="icon" type="image/x-icon" href="{{ STATIC_URL }}favicon.ico">

<!--<link rel="stylesheet" href="{{ STATIC_URL }}main.css" type="text/css"/>-->
{% if no_index %}<meta name="robots" content="noindex"/>{% endif %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="application/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="application/javascript" src="http://data.clarosnet.org/openlayers-media/OpenLayers.js"></script>
<script type="application/javascript" src="{{ STATIC_URL }}base.js"></script>
{% block extra_head %}{% endblock %}
</head>

{% block body %}
<body class="index">
<div id="all">
<div id="header">
<a id="logoLink" href="http://www.clarosnet.org/">
<span id="site-title">www.clarosnet.org: The world of art on the semantic web</span>
</a>
<div class="mainnav">
<ul>
{% block nav %}
<li><a href="{% host_url index on data %}">Home</a></li>
<li><a href="{% host_url claros-objects on data %}">Objects</a></li>
<li><a href="{% host_url claros-people on data %}">People</a></li>
<li><a href="{% host_url places:index on data %}">Places</a></li>
<li><a href="{% host_url sparql:endpoint on data %}">SPARQL</a></li>
{% endblock %}
</ul>
</div>
</div>

<div id="content">
{% block content %}
<h1>Home</h1>
{% endblock %}


</div>

{% if queries %}
<div id="query">
<div class="text-content" style="padding-top:0">
<h2>Quer{{ queries|pluralize:"y,ies" }} used to generate this page</h2>
{% for query in queries %}
<pre>{{ query }}</pre>
{% endfor %}
</div>
</div>
{% endif %}

</div>
<div id="footer">
<p>
Hosted by the University of Oxford's e-research centre, <a href="http://www.oerc.ox.ac.uk/">OeRC</a><br/>
This interface was built using <a href="http://openjena.org/wiki/Fuseki">Fuseki</a>,
<a href="https://github.com/oucs/humfrey">humfrey</a>, and
<a href="https://github.com/clarosnet/claros-voyager">a tweaked frontend</a>, all
<a href="http://www.opensource.org/">open-source software</a>.
</p>
</div>
</body>
{% endblock %}
</html>
12 changes: 12 additions & 0 deletions voyager/templates/registration/logged_out.html
@@ -0,0 +1,12 @@
{% extends "admin/base.html" %}

{% block title %}Logged out{% endblock %}

{% block body %}
<article>
<h1>Logged out</h1>

<p>You are now logged out of the Open Data Service administrative
interface.</p>
</article>
{% endblock %}
21 changes: 21 additions & 0 deletions voyager/templates/registration/login.html
@@ -0,0 +1,21 @@
{% extends "base.html" %}

{% block title %}Log in{% endblock %}

{% block content %}
<h1>Log in</h1>

<form method="post" action="">{% csrf_token %}
<input name="next" type="hidden" value="{{ next }}"/>
<table>
<tbody>{{ form }}</tbody>
<tfoot>
<tr>
<td colspan="2">
<input type="submit" value="Log in"/>
</td>
</tr>
</tfoot>
</table>
</form>
{% endblock %}
21 changes: 21 additions & 0 deletions voyager/urls/admin.py
@@ -0,0 +1,21 @@
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from humfrey.misc import views as misc_views
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required

admin.autodiscover()

urlpatterns = patterns('',
url(r'^$', login_required(misc_views.SimpleView.as_view(template_name='manage')), name='index'),
url(r'^update/', include('humfrey.update.urls', 'update')),
url(r'^stores/', include('humfrey.sparql.urls.stores', 'sparql-stores')),
url(r'^admin/', include(admin.site.urls)),
url(r'^login/$', auth_views.login, name='login'),
url(r'^logout/$', auth_views.logout, name='logout'),
) + staticfiles_urlpatterns()

handler404 = misc_views.SimpleView.as_view(context={'status_code': 404}, template_name='404')
handler500 = misc_views.SimpleView.as_view(context={'status_code': 500}, template_name='500')

0 comments on commit 58c2f69

Please sign in to comment.