Add endpoints to serve the agreement

Rather than making users contact us to get the agreement, we should just
let them download it, when we know which version to send them.

This commit adds two endpoints:
- one to serve a page which links to the agreement
- one to serve the agreement itself

These pages are not linked to anywhere because the underlying files
don’t exist yet. So I haven’t bothered putting real content on the page
yet either. I imagine the deploy sequence will be:

1. Upload the files to the buckets in each environment
2. Deploy this code through each enviroment, checking the links work
3. Make another PR to start linking to the endpoints added by this
   commit
This commit is contained in:
Chris Hill-Scott
2018-03-16 17:27:47 +00:00
parent d1ae9cc1a6
commit 68292d2299
8 changed files with 191 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
from flask import render_template, send_file
from flask_login import login_required
from app.main import main
from app.main.views.sub_navigation_dictionaries import features_nav
from app.main.s3_client import get_mou
from app.utils import AgreementInfo
@main.route('/agreement')
@login_required
def agreement():
return render_template(
'views/agreement.html',
crown_status=AgreementInfo.from_current_user().crown_status_or_404,
navigation_links=features_nav(),
)
@main.route('/agreement.pdf')
@login_required
def download_agreement():
return send_file(**get_mou(
AgreementInfo.from_current_user().crown_status_or_404
))