Skip to content

Commit

Permalink
Base manifest page.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrbyers committed Apr 4, 2017
1 parent 20a56fb commit d123686
Show file tree
Hide file tree
Showing 6 changed files with 752 additions and 0 deletions.
Empty file added __init__.py
Empty file.
674 changes: 674 additions & 0 deletions docs/LICENSE

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions plugin_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PLUGIN_NAME = 'Clockss Plugin'
DESCRIPTION = 'CLOCKSS preservation plugin'
AUTHOR = 'Andy Byers'
VERSION = '1.0'
SHORT_NAME = 'clockss'
MANAGER_URL = None

from utils import models


def install():
new_plugin, created = models.Plugin.objects.get_or_create(name=SHORT_NAME, version=VERSION, enabled=True)

if created:
print('Plugin {0} installed.'.format(PLUGIN_NAME))
else:
print('Plugin {0} is already installed.'.format(PLUGIN_NAME))


def hook_registry():
# On site load, the load function is run for each installed plugin to generate
# a list of hooks.
pass
23 changes: 23 additions & 0 deletions templates/clockss/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% load static from staticfiles %}

<html>
<head>
<title>CLOCKSS Preservation - {{ current_year }}</title>
<link href="{% static "dist/css/app.css" %}" rel="stylesheet">
{% if request.journal %}<link href="{% static "dist/css/journal" %}{{ request.journal.id }}_override.css" rel="stylesheet">{% endif %}
</head>
<body>
<div class="row">
<div class="columns-12 large">
<h3>CLOCKSS Manifest - {{ current_year }}</h3>
<h5>Archive of Issues - {{ current_year }}</h5>
<ul>{% for issue in issues %}
<li>{{ issue }}</li>{% endfor %}
</ul>
<h5>Archive of Articles - {{ current_year }}</h5>
<ul>{% for article in articles %}
<li>{{ article.title }}{% endfor %}</li></ul>
</div>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.conf.urls import url

from plugins.clockss import views

urlpatterns = [
url(r'^$', views.index, name='index'),
]
25 changes: 25 additions & 0 deletions views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.utils import timezone

from journal import models
from submission import models as submission_models


def index(request):
if not request.GET.get('year'):
current_year = timezone.now().year
else:
current_year = request.GET.get('year')

issues = models.Issue.objects.filter(date__year=current_year)
articles = submission_models.Article.objects.filter(date_published__year=current_year)

template = 'clockss/index.html'
context = {
'issues': issues,
'articles': articles,
'current_year': current_year,
}

return render(request, template, context)

0 comments on commit d123686

Please sign in to comment.