Skip to content

Commit

Permalink
implement imprint service properly (#71)
Browse files Browse the repository at this point in the history
* chore: updated gh-actions

* chore: fix test

* added proper imprint page
  • Loading branch information
csae8092 authored Jun 3, 2024
1 parent 8e2d0df commit 4a34fc8
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 34 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ exclude =
.git,
build,
env
venv
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.10"
- name: flake8 Lint
uses: py-actions/flake8@v1
uses: py-actions/flake8@v2
10 changes: 4 additions & 6 deletions .github/workflows/test-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Test

on:
push:
branches:
- master

jobs:
test:
Expand All @@ -12,13 +10,13 @@ jobs:
env:
SQLITE: True
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
Expand Down
2 changes: 1 addition & 1 deletion webpage/templates/webpage/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<body class="d-flex flex-column h-100">
{% include 'webpage/partials/navbar.html' %}
<main class="flex-shrink-0">
<div id="content" class="pt-5">
<div id="content" class="pt-5 mb-5">
{% block content %}{% endblock %}
</div>
</main>
Expand Down
6 changes: 4 additions & 2 deletions webpage/templates/webpage/imprint.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<div class="container">
<div class="card imprint">
<div class="card-header">
<h1>Imprint | Impressum</h1>
<h1>Imprint</h1>
</div>
<div class="card-body">
<div id="imprint-content"></div>
<div id="imprint-content">
{{ imprint_body|safe }}
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion webpage/templates/webpage/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>HELPDESK</h3>
</div>
</div>
<div class="d-flex justify-content-center pb-3">
<a href="https://github.com/acdh-oeaw/vocabseditor" title="link to code repo"><i class="bi bi-github pe-2"></i></a><a class="ps-2" href="#">Imprint</a>
<a href="https://github.com/acdh-oeaw/vocabseditor" title="link to code repo"><i class="bi bi-github pe-2"></i></a><a class="ps-2" href="{% url 'webpage:imprint' %}">Imprint</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion webpage/templates/webpage/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</li>
</ul>
{% if user.is_authenticated %}
<a href="{% url 'webpage:user_logout' %}"><i class="bi bi-person-check"></i></a>
<a href="{% url 'webpage:user_logout' %}" title="Hi {{ user.username }}! Click here to log out"><i class="bi bi-person-check"></i></a>
{% else %}
<a href="{% url 'webpage:user_login' %}"><i class="bi bi-box-arrow-in-right"></i></a>
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions webpage/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
path('project-info/', views.project_info, name='project_info'),
path('accounts/login/', views.user_login, name='user_login'),
path('logout/', views.user_logout, name='user_logout'),
path('imprint/', views.ImprintView.as_view(), name='imprint'),
path('<slug:template>', views.GenericWebpageView.as_view(), name='staticpage'),
path('user/<int:pk>', views.UserDetailView.as_view(), name='user_detail'),
]
15 changes: 1 addition & 14 deletions webpage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,12 @@
from copy import deepcopy


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)
r = requests.get(get_imprint_url())

r = requests.get("https://imprint.acdh.oeaw.ac.at/12305")
if r.status_code == 200:
context['imprint_body'] = "{}".format(r.text)
else:
Expand Down

0 comments on commit 4a34fc8

Please sign in to comment.