Add match context display options

This commit is contained in:
Stephan Porada 2020-04-14 15:51:26 +02:00
parent 9578a12f42
commit 34e8d952b6
3 changed files with 60 additions and 4 deletions

View File

@ -85,6 +85,24 @@ class DisplayOptionsForm(FlaskForm):
('100', '100')])
class InspectDisplayOptionsForm(FlaskForm):
expert_mode_inspect = BooleanField('Expert mode')
highlight_sentences = BooleanField('Highlight sentences')
context_sentences = SelectField('Context sentences',
choices=[('', 'Choose your option'),
('1', '1'),
('2', '2'),
('3', '3'),
('4', '4'),
('5', '5'),
('6', '6'),
('7', '7'),
('8', '8'),
('9', '9'),
('10', '10')],
default=3)
class QueryDownloadForm(FlaskForm):
file_type = SelectField('File type',
choices=[('', 'Choose file type'),

View File

@ -7,7 +7,8 @@ from . import corpora
from .background_functions import (delete_corpus_, delete_corpus_file_,
edit_corpus_file_)
from .forms import (AddCorpusFileForm, AddCorpusForm, EditCorpusFileForm,
QueryDownloadForm, QueryForm, DisplayOptionsForm)
QueryDownloadForm, QueryForm, DisplayOptionsForm,
InspectDisplayOptionsForm)
from .. import db
from ..models import Corpus, CorpusFile
import os
@ -62,11 +63,13 @@ def analyse_corpus(corpus_id):
query_form = QueryForm(prefix='query-form',
query=request.args.get('query'))
query_download_form = QueryDownloadForm()
inspect_display_options_form = InspectDisplayOptionsForm()
return render_template('corpora/analyse_corpus.html.j2',
corpus_id=corpus_id,
display_options_form=display_options_form,
query_form=query_form,
query_download_form=query_download_form,
inspect_display_options_form=inspect_display_options_form,
title='Corpus analysis')

View File

@ -198,9 +198,44 @@
<!-- Context modal used for detailed information about one match -->
<div id="context-modal" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Match context and information</h4>
<div>
<div id="context-results"></div>
<h4>Match context</h4>
<div class="divider"></div>
<div class="section" id="inspect-display-options">
<h5>Display options</h5>
<div class="row">
<div class="col s9">
<p>Expert Mode</p>
</div>
<div class="col s3 right-align">
<div class="switch">
<label>
{{ inspect_display_options_form.expert_mode_inspect() }}
<span class="lever"></span>
</label>
</div>
</div>
<div class="col s9">
<p>Highlight sentences</p>
</div>
<div class="col s3 right-align">
<div class="switch">
<label>
{{ inspect_display_options_form.highlight_sentences() }}
<span class="lever"></span>
</label>
</div>
</div>
<div class="col s12 m6">
<div class="input-field">
<i class="material-icons prefix">format_list_numbered</i>
{{ inspect_display_options_form.context_sentences() }}
{{ inspect_display_options_form.context_sentences.label }}
</div>
</div>
</div>
</div>
<div class="divider"></div>
<div class="section" id="context-results">
</div>
</div>
<div class="modal-footer">