From dc85793f952dbcd0710a02ae1011a36eee4ef726 Mon Sep 17 00:00:00 2001 From: osmala <ossi.laine@utu.fi> Date: Wed, 14 Apr 2021 18:30:08 +0300 Subject: [PATCH] Show all experiments if language not defined in session --- app/routes.py | 8 ++++---- app/templates/index.html | 22 +++------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/app/routes.py b/app/routes.py index 95f25cb..35c4632 100644 --- a/app/routes.py +++ b/app/routes.py @@ -23,8 +23,8 @@ def index(): session['group'] = None - if not session: - session['language'] = "English" + if 'language' not in session: + session['language'] = "All" return render_template('home.html', title='Home', groups=groups) @@ -42,8 +42,8 @@ def group_page(group_tag): experiments = experiment.query.filter_by(group_id=group.id).all() session['group'] = group_tag - if not session: - session['language'] = "English" + if 'language' not in session: + session['language'] = "All" return render_template('index.html', title='Home', experiments=experiments, group=group) diff --git a/app/templates/index.html b/app/templates/index.html index eefc3e6..9bebd0c 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -15,7 +15,7 @@ a previously started task, click on the "Continue task" button.') }}</p> <p class="lead text-center">{{ _('You can choose the language suitable for you from the language menu in the upper right corner.') }}</p> - + </p> <div class="row"> <div class="col mt-5"> @@ -23,7 +23,7 @@ <p class="lead text-left mt-3 font-weight-bold">{{ _('List of experiments:') }}</p> {% block attributes %} {% for exp in experiments %} - + {% if exp.status == 'Public' and session['language'] == exp.language %} <ul class="list-group mb-3"> @@ -74,9 +74,6 @@ {% autoescape false %} {{ exp.short_instruction }}</li> {% endautoescape %} - - - {% if current_user.is_authenticated %} <li class="list-group-item"><span class="font-weight-bold">ID number:</span> {{ exp.idexperiment }} </li> @@ -91,7 +88,7 @@ <li class="list-group-item"> <a class="btn btn-outline-primary" href="{{ url_for('consent', exp_id=exp.idexperiment) }}" role="button">{{ _('Begin task') }}</a> - <a class="btn btn-outline-primary" href="{{ url_for('task.continue_task', exp_id=exp.idexperiment) }}" role="button">{{ _('Continue task') }}</a + <a class="btn btn-outline-primary" href="{{ url_for('task.continue_task', exp_id=exp.idexperiment) }}" role="button">{{ _('Continue task') }}</a> {% if current_user.is_authenticated %} <span class="text-right"> @@ -108,14 +105,6 @@ {% endif %} - - - - - - - - {% if (exp.status == 'Private') and (current_user.is_authenticated) and session['language'] == exp.language %} <br> <h3>Private experiment:</h3> @@ -196,11 +185,6 @@ {% endif %} - - - - - {% if (exp.status == 'Hidden') and (current_user.is_authenticated) and session['language'] == exp.language %} <br> <h3>Unpublished experiment:</h3> -- GitLab