Commit caa8155e authored by hynek's avatar hynek 🤤
Browse files

feat(dddatasets): add dariah tou forms to 'edit_publish_final` view and template

parent 15b3f7b6
......@@ -95,6 +95,7 @@ from discuss_data.dddatasets.utils import (
)
from discuss_data.ddpublications.forms import PublicationForm
from discuss_data.ddpublications.models import Publication
from discuss_data.ddusers.forms import DariahTermsOfUse
from discuss_data.ddusers.models import Country, User
from discuss_data.ddusers.views import (
user_search,
......@@ -1419,6 +1420,19 @@ def prep_dataset_edit_publish_final(request, ds_uuid):
requestUri = th.request_url
publish_message = None
target = _("DARIAH Terms of Use Declaration")
err = None
updated = False
if request.method == "POST":
form = DariahTermsOfUse(request.POST, instance=request.user)
if form.is_valid():
form.save()
updated = True
else:
err = form.errors.as_data()
else:
form = DariahTermsOfUse(instance=request.user)
return render(
request,
"dddatasets/prep/_dataset_edit_publish_final.html",
......@@ -1426,6 +1440,10 @@ def prep_dataset_edit_publish_final(request, ds_uuid):
"requestUri": requestUri,
"isTokenValid": isTokenValid,
"ds": ds,
"form": form,
"updated": updated,
"err": err,
"target": target,
"manpage": manpage,
"publish_message": publish_message,
"turtle_task": turtle_task,
......
......@@ -38,7 +38,15 @@
</p>
{% else %}
<p>{% trans "For this step you need to request an DARIAH Repository access token by clicking the request token button prior to publish." %}</p>
<a href="{{ requestUri }}" class="btn btn-primary">{% trans 'Request Token' %}</a>
<p>DARIAH TOU</p>
<p id="dariah-tou">
{% include 'core/_edit_form.html' with ds=ds form=form user=user updated=updated err=err target=target ictarget="ds-content" %}
</p>
{% if request.user.accepted_dariah_tou %}
<a href="{{ requestUri }}" class="btn btn-primary">{% trans 'Request Token' %}</a>
{% else %}
<button class="btn btn-primary" disabled>{% trans 'Request Token' %}</button>
{% endif %}
{% endif %}
{% else %}
{# publish to discuss data #}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment