-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigate.py
137 lines (129 loc) · 6.71 KB
/
navigate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
from wtforms import SubmitField, SelectField, SelectMultipleField
from wtforms.validators import DataRequired, Optional
from flask_wtf import FlaskForm
class NonValidatingSelectField(SelectField):
"""
Class to ignore the SelectField validation
"""
def pre_validate(self, form) -> None:
"""
Does nothing
:param form: form to validate
:return: None
"""
pass
class NavigatePassage(FlaskForm):
"""
FlaskForm for Bible passage navigation. Should be used with navigate.js on the frontend to make a dynamic dropdown
for passage selection.
"""
# Books of the Bible, as 2-tuples, for form creation.
books = [('Genesis', 'Genesis'),
('Exodus', 'Exodus'),
('Leviticus', 'Leviticus'),
('Numbers', 'Numbers'),
('Deuteronomy', 'Deuteronomy'),
('Joshua', 'Joshua'),
('Judges', 'Judges'),
('Ruth', 'Ruth'),
('1 Samuel', '1 Samuel'),
('2 Samuel', '2 Samuel'),
('1 Kings', '1 Kings'),
('2 Kings', '2 Kings'),
('1 Chronicles', '1 Chronicles'),
('2 Chronicles', '2 Chronicles'),
('Ezra', 'Ezra'),
('Nehemiah', 'Nehemiah'),
('Esther', 'Esther'),
('Job', 'Job'),
('Psalms', 'Psalms'),
('Proverbs', 'Proverbs'),
('Ecclesiastes', 'Ecclesiastes'),
('Song of Solomon', 'Song of Solomon'),
('Isaiah', 'Isaiah'),
('Jeremiah', 'Jeremiah'),
('Lamentations', 'Lamentations'),
('Ezekiel', 'Ezekiel'),
('Daniel', 'Daniel'),
('Hosea', 'Hosea'),
('Joel', 'Joel'),
('Amos', 'Amos'),
('Obadiah', 'Obadiah'),
('Jonah', 'Jonah'),
('Micah', 'Micah'),
('Nahum', 'Nahum'),
('Habakkuk', 'Habakkuk'),
('Zephaniah', 'Zephaniah'),
('Haggai', 'Haggai'),
('Zechariah', 'Zechariah'),
('Malachi', 'Malachi'),
('Matthew', 'Matthew'),
('Mark', 'Mark'),
('Luke', 'Luke'),
('John', 'John'),
('Acts', 'Acts'),
('Romans', 'Romans'),
('1 Corinthians', '1 Corinthians'),
('2 Corinthians', '2 Corinthians'),
('Galatians', 'Galatians'),
('Ephesians', 'Ephesians'),
('Philippians', 'Philippians'),
('Colossians', 'Colossians'),
('1 Thessalonians', '1 Thessalonians'),
('2 Thessalonians', '2 Thessalonians'),
('1 Timothy', '1 Timothy'),
('2 Timothy', '2 Timothy'),
('Titus', 'Titus'),
('Philemon', 'Philemon'),
('Hebrews', 'Hebrews'),
('James', 'James'),
('1 Peter', '1 Peter'),
('2 Peter', '2 Peter'),
('1 John', '1 John'),
('2 John', '2 John'),
('3 John', '3 John'),
('Jude', 'Jude'),
('Revelation', 'Revelation')]
book = SelectField('Book', choices=books, validators=[DataRequired()])
chapter = NonValidatingSelectField('Chapter', choices=[], validators=[Optional()])
submit = SubmitField("Go to passage")
class NavigateRel(FlaskForm):
"""
Two basic submit fields for chapter navigation
"""
next_button: SubmitField = SubmitField("▶")
previous_button: SubmitField = SubmitField("◀")
class NavigateVersion(FlaskForm):
"""
Field for selecting a Bible version
"""
select_version: SelectField = SelectMultipleField('Select version',
choices=[('ACV', 'A Conservative Version (ACV)'),
('AKJV', 'American King James Version (AKJV)'),
('AMP', 'Amplified Bible (AMP)'),
('ASV', 'American Standard Version (ASV)'),
('BBE', 'Bible in Basic English (BBE)'),
('BSB', 'Berean Standard Bible (BSB)'),
('CSB', 'Christian Standard Bible (CSB)'),
('Darby', 'Darby Bible (Darby)'),
('DRA', 'Douay-Rheims 1899 American Edition (DRA)'),
('EBR', 'Rotherham\'s Emphasized Bible (EBR)'),
('ESV', 'English Standard Version (ESV)'),
('GNV', 'Geneva Bible (GNV)'),
('KJV', 'King James Version (KJV, 1729)'),
('KJV 1611', 'King James Version 1611 (KJV, 1611)'),
('LSV', 'Literal Standard Version (LSV)'),
('MSG', 'The Message (MSG)'),
('NASB 1995', 'New American Standard Bible (NASB, 1995)'),
('NET', 'New English Translation (NET)'),
('NIV 1984', 'New International Version (NIV, 1984)'),
('NIV 2011', 'New International Version (NIV, 2011)'),
('NKJV', 'New King James Version (NKJV)'),
('NLT', 'New Living Translation (NLT)'),
('RNKJV', 'Restored Name King James Version (RNKJV)'),
('RSV', 'Revised Standard Version (RSV)'),
('RWV', 'Revised Webster Version 1833 (RWV)'),
('UKJV', 'Updated King James Version (UKJV)'),
('WEB', 'World English Bible (WEB)'),
('YLT', 'Young’s Literal Translation (YLT)')],
validators=[DataRequired()], default=['ESV'])