Skip to content

Commit

Permalink
Add reading to settings form.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzohrab committed Nov 29, 2023
1 parent 585bb7e commit 3cc91f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
6 changes: 6 additions & 0 deletions lute/settings/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ class UserSettingsForm(FlaskForm):
show_highlights = BooleanField("Highlight terms by status")

mecab_path = StringField("MECAB_PATH environment variable")
reading_choices = [
("katakana", "Katakana"),
("hiragana", "Hiragana"),
("alphabet", "Romaji"),
]
japanese_reading = SelectField("Pronunciation characters", choices=reading_choices)

def validate_backup_dir(self, field):
"Field must be set if enabled."
Expand Down
26 changes: 15 additions & 11 deletions lute/templates/settings/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,11 @@ <h2>Appearance</h2>

<tr>
<td>
<h2>MeCab (Japanese only)</h2>
<h2>Japanese</h2>
</td>
<td />
</tr>

<tr>
<td>
<button onclick="test_mecab_setup(); return false;">
Test my MeCab configuration
</button>
</td>
<td>
<div id="parse_result"></div>
</td>
</tr>
<tr>
<td>
{{ form.mecab_path.label }}
Expand Down Expand Up @@ -127,6 +117,20 @@ <h2>MeCab (Japanese only)</h2>
</td>
<td>{{ form.mecab_path(class="form-control") }}</td>
</tr>
<tr>
<td>
</td>
<td>
<button onclick="test_mecab_setup(); return false;">
Test my MeCab configuration
</button>
<div style="margin-top: 5px" id="parse_result"></div>
</td>
</tr>
<tr>
<td>{{ form.japanese_reading.label }}</td>
<td>{{ form.japanese_reading }}</td>
</tr>

</table>

Expand Down

0 comments on commit 3cc91f3

Please sign in to comment.