mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-27 11:19:21 -04:00
Based on discussion with Pete. Make the blue banner an ‘important’ banner (copied from Register to Vote, used because it’s not as boxy and fits on the page better). Remove the back button because you haven’t changed any data yet. If you need to go back you can just press back or start again. Make the filename stand out more. Remove the ‘download example’ link. Will need to revist the best way of doing this. Make text messages consistently 2/3rd width.
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from flask import render_template, redirect, session, url_for
|
|
from flask_login import login_required, current_user
|
|
from app.main import main
|
|
from app.main.dao import services_dao, users_dao
|
|
from app.main.forms import AddServiceForm
|
|
|
|
|
|
@main.route("/add-service", methods=['GET', 'POST'])
|
|
@login_required
|
|
def add_service():
|
|
form = AddServiceForm(services_dao.find_all_service_names)
|
|
services = services_dao.get_services(current_user.id)
|
|
if len(services['data']) == 0:
|
|
heading = 'Which service do you want to set up notifications for?'
|
|
else:
|
|
heading = 'Add a new service'
|
|
if form.validate_on_submit():
|
|
user = users_dao.get_user_by_id(session['user_id'])
|
|
service_id = services_dao.insert_new_service(form.name.data, user.id)
|
|
session['service_name'] = form.name.data
|
|
return redirect(url_for('main.service_dashboard', service_id=service_id))
|
|
else:
|
|
return render_template(
|
|
'views/add-service.html',
|
|
form=form,
|
|
heading=heading
|
|
)
|