Skip to content

Commit

Permalink
Merge pull request #37 from acdh-oeaw/36-hook-to-new-imprint-service
Browse files Browse the repository at this point in the history
uses new imprint service
  • Loading branch information
csae8092 authored Nov 7, 2024
2 parents b7f8db4 + d783b5f commit 97774d4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 32 deletions.
6 changes: 2 additions & 4 deletions djangobaseproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
PROJECT_NAME = os.environ.get("PROJECT_NAME", "nabucco")


ACDH_IMPRINT_URL = (
"https://shared.acdh.oeaw.ac.at/acdh-common-assets/api/imprint.php?serviceID="
)
REDMINE_ID = os.environ.get("REDMINE_ID", 19545)
ACDH_IMPRINT_URL = "https://imprint.acdh.oeaw.ac.at/"
REDMINE_ID = os.environ.get("REDMINE_ID", 19546)

SHEET_ID = os.environ.get(
"SHEET_ID", "19tfPPMRiIQf6SPicfhvX3gMQd0Hfb5I6eEeKg2xw3Lc asdf"
Expand Down
8 changes: 3 additions & 5 deletions webpage/templates/webpage/imprint.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
{% load webpage_extras %}
{% block title %} Imprint {% endblock %}
{% block content %}
<div class="container">
<div class="card imprint">
<div class="card-body">
<div class="container p-5">

{{ imprint_body|safe }}
</div>
</div>

</div>
{% endblock %}
4 changes: 2 additions & 2 deletions webpage/templates/webpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</style>
<div class="my-5">
<div class="p-5 text-center bg-body-tertiary rounded-1 jumbotron-background">
<h1 class="display-1 p-5">Nabucco</h1>
<h1 class="display-1 p-5">NaBuCCo</h1>
<h2 class="display-3 text-light">A Neo-Babylonian Cuneiform Corpus</h2>
<p class="container lead fs-2">
THE NEO-BABYLONIAN CUNEIFORM CORPUS aims at making available the large corpus of archival documents from first millennium BCE Babylonia to historians of the ancient world in general and Assyriologists in particular.
NaBuCCo aims at making available the large corpus of archival documents from first millennium BCE Babylonia to historians of the ancient world in general and Assyriologists in particular.
</p>
<div class="d-inline-flex gap-2 mb-5 pt-5">
<a class="btn btn-outline-light btn-lg px-4" type="button" href="{% url 'webpage:staticpage' template='about' %}">
Expand Down
33 changes: 12 additions & 21 deletions webpage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,25 @@
from .metadata import PROJECT_METADATA as PM


def get_imprint_url():
try:
base_url = settings.ACDH_IMPRINT_URL
except AttributeError:
base_url = "https://provide-an-acdh-imprint-url/"
try:
redmine_id = settings.REDMINE_ID
except AttributeError:
redmine_id = "go-register-a-redmine-service-issue"
return "{}{}".format(base_url, redmine_id)


class ImprintView(TemplateView):
template_name = "webpage/imprint.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# imprint_url = get_imprint_url()
r = requests.get(get_imprint_url())

try:
imprint_url = f"{settings.ACDH_IMPRINT_URL}{settings.REDMINE_ID}"
except Exception as e:
context["imprint_body"] = e
return context
r = requests.get(imprint_url)
if r.status_code == 200:
context["imprint_body"] = "{}".format(r.text)
context["imprint_body"] = f"{r.text}"
else:
context[
"imprint_body"
] = """
On of our services is currently not available. Please try it later or write an email to
[email protected]; if you are service provide, make sure that you provided ACDH_IMPRINT_URL and REDMINE_ID
context["imprint_body"] = """
On of our services is currently not available.\
Please try it later or write an email to\
[email protected]; if you are service provide,\
make sure that you provided ACDH_IMPRINT_URL and REDMINE_ID
"""
return context

Expand Down

0 comments on commit 97774d4

Please sign in to comment.