mirror of https://gitlab.com/bashrc2/epicyon
Tidying of text fields
parent
1d11b177d8
commit
588b80af3c
|
@ -74,15 +74,19 @@ def _endEditSection() -> str:
|
||||||
return ' </div></details>\n'
|
return ' </div></details>\n'
|
||||||
|
|
||||||
|
|
||||||
def _editText(label: str, name: str, value: str = "") -> str:
|
def _editText(label: str, name: str, value: str = "",
|
||||||
|
placeholder: str = "") -> str:
|
||||||
"""Returns html for editing a text field
|
"""Returns html for editing a text field
|
||||||
"""
|
"""
|
||||||
if value is None:
|
if value is None:
|
||||||
value = ''
|
value = ''
|
||||||
|
placeholderStr = ''
|
||||||
|
if placeholder:
|
||||||
|
placeholderStr = ' placeholder="' + placeholder + '"'
|
||||||
return \
|
return \
|
||||||
'<label class="labels">' + label + '</label><br>\n' + \
|
'<label class="labels">' + label + '</label><br>\n' + \
|
||||||
' <input type="text" name="' + name + '" value="' + \
|
' <input type="text" name="' + name + '" value="' + \
|
||||||
value + '">\n'
|
value + '"' + placeholderStr + '>\n'
|
||||||
|
|
||||||
|
|
||||||
def _editCheckBox(label: str, name: str, checked: bool = False) -> str:
|
def _editCheckBox(label: str, name: str, checked: bool = False) -> str:
|
||||||
|
@ -1605,22 +1609,15 @@ def _htmlEditProfileLibreTranslate(translate: {},
|
||||||
libretranslateApiKey: str) -> str:
|
libretranslateApiKey: str) -> str:
|
||||||
"""Change automatic translation settings
|
"""Change automatic translation settings
|
||||||
"""
|
"""
|
||||||
if libretranslateUrl is None:
|
editProfileForm = _beginEditSection('LibreTranslate')
|
||||||
libretranslateUrl = ''
|
|
||||||
if libretranslateApiKey is None:
|
|
||||||
libretranslateApiKey = ''
|
|
||||||
|
|
||||||
editProfileForm = \
|
editProfileForm += \
|
||||||
' <details><summary class="cw">LibreTranslate</summary>\n' + \
|
_editText('URL', 'libretranslateUrl', libretranslateUrl,
|
||||||
' <div class="container">\n' + \
|
'http://0.0.0.0:5000')
|
||||||
'<label class="labels">URL</label><br>\n' + \
|
editProfileForm += \
|
||||||
' <input type="text" name="libretranslateUrl" ' + \
|
_editText('API Key', 'libretranslateApiKey', libretranslateApiKey)
|
||||||
'placeholder="http://0.0.0.0:5000" ' + \
|
|
||||||
'value="' + libretranslateUrl + '"><br>\n' + \
|
editProfileForm += _endEditSection()
|
||||||
'<label class="labels">API Key</label><br>\n' + \
|
|
||||||
' <input type="text" name="libretranslateApiKey" ' + \
|
|
||||||
'value="' + libretranslateApiKey + '">\n' + \
|
|
||||||
' </div></details>\n'
|
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -1776,10 +1773,7 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str,
|
||||||
editProfileForm = ' <div class="container">\n'
|
editProfileForm = ' <div class="container">\n'
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <label class="labels">' + \
|
_editText(translate['Nickname'], 'displayNickname', displayNickname)
|
||||||
translate['Nickname'] + '</label>\n' + \
|
|
||||||
' <input type="text" name="displayNickname" value="' + \
|
|
||||||
displayNickname + '"><br>\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <label class="labels">' + \
|
' <label class="labels">' + \
|
||||||
|
@ -1798,10 +1792,7 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str,
|
||||||
occupationName = getOccupationName(actorJson)
|
occupationName = getOccupationName(actorJson)
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">' + \
|
_editText(translate['Occupation'], 'occupationName', occupationName)
|
||||||
translate['Occupation'] + ':</label><br>\n' + \
|
|
||||||
' <input type="text" ' + \
|
|
||||||
'name="occupationName" value="' + occupationName + '">\n'
|
|
||||||
|
|
||||||
alsoKnownAsStr = ''
|
alsoKnownAsStr = ''
|
||||||
if actorJson.get('alsoKnownAs'):
|
if actorJson.get('alsoKnownAs'):
|
||||||
|
@ -1814,37 +1805,26 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str,
|
||||||
alsoKnownAsStr += altActor
|
alsoKnownAsStr += altActor
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">' + \
|
_editText(translate['Other accounts'], 'alsoKnownAs',
|
||||||
translate['Other accounts'] + ':</label><br>\n' + \
|
alsoKnownAsStr, 'https://...')
|
||||||
' <input type="text" placeholder="https://..." ' + \
|
|
||||||
'name="alsoKnownAs" value="' + alsoKnownAsStr + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">' + \
|
_editText(translate['Moved to new account address'], 'movedTo',
|
||||||
translate['Moved to new account address'] + ':</label><br>\n' + \
|
movedTo, 'https://...')
|
||||||
' <input type="text" placeholder="https://..." ' + \
|
|
||||||
'name="movedTo" value="' + movedTo + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">' + \
|
_editText(translate['Donations link'], 'donateUrl',
|
||||||
translate['Donations link'] + '</label><br>\n' + \
|
donateUrl, 'https://...')
|
||||||
' <input type="text" placeholder="https://..." ' + \
|
|
||||||
'name="donateUrl" value="' + donateUrl + '">\n'
|
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">Blog</label><br>\n' + \
|
_editText('Blog', 'blogAddress', blogAddress, 'https://...')
|
||||||
' <input type="text" name="blogAddress" value="' + \
|
|
||||||
blogAddress + '">\n'
|
|
||||||
|
|
||||||
languagesListStr = _getSupportedLanguages(baseDir)
|
languagesListStr = _getSupportedLanguages(baseDir)
|
||||||
showLanguages = getActorLanguages(actorJson)
|
showLanguages = getActorLanguages(actorJson)
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<label class="labels">' + \
|
_editText(translate['Languages'], 'showLanguages',
|
||||||
translate['Languages'] + '</label><br>\n' + \
|
showLanguages, languagesListStr)
|
||||||
' <input type="text" ' + \
|
|
||||||
'placeholder="' + languagesListStr + \
|
|
||||||
'" name="showLanguages" value="' + \
|
|
||||||
showLanguages + '">\n'
|
|
||||||
editProfileForm += ' </div>\n'
|
editProfileForm += ' </div>\n'
|
||||||
return editProfileForm
|
return editProfileForm
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue