From e327f0c8bfd585e29da1875cb523d9a896705b41 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch <p.jentsch@uni-bielefeld.de> Date: Fri, 2 Aug 2019 13:24:52 +0200 Subject: [PATCH] Make the about page the index page. --- app/auth/views.py | 12 ++++++------ app/main/views.py | 15 ++++++--------- app/templates/base.html.j2 | 4 ++-- .../main/{about.html.j2 => index.html.j2} | 0 4 files changed, 14 insertions(+), 17 deletions(-) rename app/templates/main/{about.html.j2 => index.html.j2} (100%) diff --git a/app/auth/views.py b/app/auth/views.py index 0e8859a9..2043d4ae 100644 --- a/app/auth/views.py +++ b/app/auth/views.py @@ -18,7 +18,7 @@ def login(): login_user(user, form.remember_me.data) next = request.args.get('next') if next is None or not next.startswith('/'): - next = url_for('main.index') + next = url_for('main.dashboard') return redirect(next) flash('Invalid username or password.') return render_template('auth/login.html.j2', form=form, title='Log in') @@ -35,7 +35,7 @@ def logout(): @auth.route('/register', methods=['GET', 'POST']) def register(): if not current_user.is_anonymous: - return redirect(url_for('main.index')) + return redirect(url_for('main.dashboard')) form = RegistrationForm() if form.validate_on_submit(): user = User(email=form.email.data.lower(), @@ -61,7 +61,7 @@ def confirm(token): flash('You have confirmed your account. Thanks!') else: flash('The confirmation link is invalid or has expired.') - return redirect(url_for('main.index')) + return redirect(url_for('main.dashboard')) @auth.before_app_request @@ -91,13 +91,13 @@ def resend_confirmation(): send_email(current_user.email, 'Confirm Your Account', 'auth/email/confirm', user=current_user, token=token) flash('A new confirmation email has benn sent to you by email.') - return redirect(url_for('main.index')) + return redirect(url_for('main.dashboard')) @auth.route('/reset', methods=['GET', 'POST']) def password_reset_request(): if not current_user.is_anonymous: - return redirect(url_for('main.index')) + return redirect(url_for('main.dashboard')) form = PasswordResetRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data.lower()).first() @@ -116,7 +116,7 @@ def password_reset_request(): @auth.route('/reset/<token>', methods=['GET', 'POST']) def password_reset(token): if not current_user.is_anonymous: - return redirect(url_for('main.index')) + return redirect(url_for('main.dashboard')) form = PasswordResetForm() if form.validate_on_submit(): if User.reset_password(token, form.password.data): diff --git a/app/main/views.py b/app/main/views.py index b3543975..96c6e8a0 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -10,7 +10,12 @@ import hashlib import os -@main.route('/', methods=['GET', 'POST']) +@main.route('/') +def index(): + return render_template('main/index.html.j2', title='Opaque') + + +@main.route('/dashboard', methods=['GET', 'POST']) @login_required def dashboard(): create_corpus_form = CreateCorpusForm() @@ -44,18 +49,10 @@ def dashboard(): ) -@main.route('/about') -def about(): - return render_template('main/about.html.j2', title='About') - - @main.route('/admin', methods=['GET', 'POST']) @login_required @admin_required def for_admins_only(): - """ - View for admin page only accesible by admins. - """ users = User.query.order_by(User.username).all() items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed) for u in users] table = AdminUserTable(items) diff --git a/app/templates/base.html.j2 b/app/templates/base.html.j2 index 497dc6b9..d58bd373 100644 --- a/app/templates/base.html.j2 +++ b/app/templates/base.html.j2 @@ -29,7 +29,7 @@ <div class="navbar-fixed"> <nav> <div class="nav-wrapper"> - <a href="{{ url_for('main.dashboard') }}" class="brand-logo"><i class="material-icons">opacity</i>Opaque</a> + <a href="{{ url_for('main.index') }}" class="brand-logo"><i class="material-icons">opacity</i>Opaque</a> <a href="#" data-target="slide-out" class="sidenav-trigger"><i class="material-icons">menu</i></a> <ul class="right hide-on-med-and-down"> <li><a id="nav-notifications" class="dropdown-trigger" href="#!" data-target="nav-notifications-dropdown"><i class="material-icons">notifications</i></a></li> @@ -60,8 +60,8 @@ </span> </div> </li> + <li><a href="{{ url_for('main.index') }}"><i class="material-icons">opacity</i>Opaque</a></li> <li><a href="{{ url_for('main.dashboard') }}"><i class="material-icons">dashboard</i>Dashboard</a></li> - <li><a href="{{ url_for('main.about') }}"><i class="material-icons">info</i>About</a></li> <li class="no-padding"> <ul class="collapsible collapsible-accordion"> <li> diff --git a/app/templates/main/about.html.j2 b/app/templates/main/index.html.j2 similarity index 100% rename from app/templates/main/about.html.j2 rename to app/templates/main/index.html.j2 -- GitLab