Beginning and end of dropdown sections on edit profile screen

merge-requests/30/head
Bob Mottram 2021-07-22 14:37:41 +01:00
parent 588b80af3c
commit e66891f8ab
1 changed files with 20 additions and 42 deletions

View File

@ -1116,9 +1116,8 @@ def _htmlEditProfileGraphicDesign(baseDir: str, translate: {}) -> str:
""" """
themeFormats = '.zip, .gz' themeFormats = '.zip, .gz'
graphicsStr = '<details><summary class="cw">' + \ graphicsStr = _beginEditSection(translate['Graphic Design'])
translate['Graphic Design'] + '</summary>\n'
graphicsStr += '<div class="container">'
graphicsStr += _htmlThemesDropdown(baseDir, translate) graphicsStr += _htmlThemesDropdown(baseDir, translate)
graphicsStr += \ graphicsStr += \
' <label class="labels">' + \ ' <label class="labels">' + \
@ -1133,7 +1132,7 @@ def _htmlEditProfileGraphicDesign(baseDir: str, translate: {}) -> str:
' <button type="submit" class="button" ' + \ ' <button type="submit" class="button" ' + \
'name="submitExportTheme">➤</button>\n' 'name="submitExportTheme">➤</button>\n'
graphicsStr += ' </div></details>\n' graphicsStr += _endEditSection()
return graphicsStr return graphicsStr
@ -1240,9 +1239,7 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
moderators = f.read() moderators = f.read()
# site moderators # site moderators
roleAssignStr = \ roleAssignStr = \
'<details><summary class="cw">' + \ _beginEditSection(translate['Role Assignment']) + \
translate['Role Assignment'] + '</summary>\n' + \
'<div class="container">' + \
' <b><label class="labels">' + \ ' <b><label class="labels">' + \
translate['Moderators'] + '</label></b><br>\n' + \ translate['Moderators'] + '</label></b><br>\n' + \
' ' + \ ' ' + \
@ -1293,15 +1290,12 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
' <textarea id="message" name="artists" ' + \ ' <textarea id="message" name="artists" ' + \
'placeholder="" ' + \ 'placeholder="" ' + \
'style="height:200px" spellcheck="false">' + \ 'style="height:200px" spellcheck="false">' + \
artists + '</textarea>' + \ artists + '</textarea>' + _endEditSection()
' </div></details>\n'
# Video section # Video section
idx = 'Show video previews for the following Peertube sites.' idx = 'Show video previews for the following Peertube sites.'
peertubeStr = \ peertubeStr = \
' <details><summary class="cw">' + \ _beginEditSection(translate['Video Settings']) + \
translate['Video Settings'] + '</summary>\n' + \
' <div class="container">\n' + \
' <b><label class="labels">' + \ ' <b><label class="labels">' + \
translate['Peertube Instances'] + '</label></b>\n' + \ translate['Peertube Instances'] + '</label></b>\n' + \
' <br><label class="labels">' + \ ' <br><label class="labels">' + \
@ -1335,21 +1329,17 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
def _htmlEditProfileDangerZone(translate: {}) -> str: def _htmlEditProfileDangerZone(translate: {}) -> str:
"""danger zone section of Edit Profile screen """danger zone section of Edit Profile screen
""" """
editProfileForm = \ editProfileForm = _beginEditSection(translate['Danger Zone'])
' <details><summary class="cw">' + \
translate['Danger Zone'] + '</summary>\n' + \
' <div class="container">\n'
editProfileForm = \ editProfileForm += \
' <b><label class="labels">' + \ ' <b><label class="labels">' + \
translate['Danger Zone'] + '</label></b><br>\n' translate['Danger Zone'] + '</label></b><br>\n'
editProfileForm = \ editProfileForm += \
_editCheckBox(translate['Deactivate this account'], _editCheckBox(translate['Deactivate this account'],
'deactivateThisAccount', False) 'deactivateThisAccount', False)
editProfileForm = \ editProfileForm += _endEditSection()
' </div></details>\n'
return editProfileForm return editProfileForm
@ -1379,17 +1369,14 @@ def _htmlEditProfileSkills(baseDir: str, nickname: str, domain: str,
'" value="" style="width:40%">' + \ '" value="" style="width:40%">' + \
'<input type="range" min="1" max="100" ' + \ '<input type="range" min="1" max="100" ' + \
'class="slider" name="skillValue' + \ 'class="slider" name="skillValue' + \
str(skillCtr) + '" value="50"></p>' + \ str(skillCtr) + '" value="50"></p>' + _endEditSection()
' </div></details>\n'
idx = 'If you want to participate within organizations then you ' + \ idx = 'If you want to participate within organizations then you ' + \
'can indicate some skills that you have and approximate ' + \ 'can indicate some skills that you have and approximate ' + \
'proficiency levels. This helps organizers to construct ' + \ 'proficiency levels. This helps organizers to construct ' + \
'teams with an appropriate combination of skills.' 'teams with an appropriate combination of skills.'
editProfileForm = \ editProfileForm = \
'<details><summary class="cw">' + \ _beginEditSection(translate['Skills']) + \
translate['Skills'] + '</summary>\n' + \
' <div class="container">\n' + \
' <b><label class="labels">' + \ ' <b><label class="labels">' + \
translate['Skills'] + '</label></b><br>\n' + \ translate['Skills'] + '</label></b><br>\n' + \
' <label class="labels">' + \ ' <label class="labels">' + \
@ -1410,15 +1397,12 @@ def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str,
idx = 'List of project names that you wish to receive git patches for' idx = 'List of project names that you wish to receive git patches for'
editProfileForm = \ editProfileForm = \
'<details><summary class="cw">' + \ _beginEditSection(translate['Git Projects']) + \
translate['Git Projects'] + '</summary>\n' + \
' <div class="container">\n' + \
' <label class="labels">' + \ ' <label class="labels">' + \
translate[idx] + '</label>\n' + \ translate[idx] + '</label>\n' + \
' <textarea id="message" name="gitProjects" ' + \ ' <textarea id="message" name="gitProjects" ' + \
'style="height:100px" spellcheck="false">' + \ 'style="height:100px" spellcheck="false">' + \
gitProjectsStr + '</textarea>\n' + \ gitProjectsStr + '</textarea>\n' + _endEditSection()
' </div></details>\n'
return editProfileForm return editProfileForm
@ -1475,9 +1459,7 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
with open(allowedInstancesFilename, 'r') as allowedInstancesFile: with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
allowedInstancesStr = allowedInstancesFile.read() allowedInstancesStr = allowedInstancesFile.read()
editProfileForm = '<details><summary class="cw">' + \ editProfileForm = _beginEditSection(translate['Filtering and Blocking'])
translate['Filtering and Blocking'] + '</summary>\n'
editProfileForm += ' <div class="container">\n'
editProfileForm += \ editProfileForm += \
'<label class="labels">' + \ '<label class="labels">' + \
@ -1582,7 +1564,7 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
'style="height:200px" spellcheck="false">' + \ 'style="height:200px" spellcheck="false">' + \
userAgentsBlockedStr + '</textarea>\n' userAgentsBlockedStr + '</textarea>\n'
editProfileForm += ' </div></details>\n' editProfileForm += _endEditSection()
return editProfileForm return editProfileForm
@ -1590,9 +1572,7 @@ def _htmlEditProfileChangePassword(translate: {}) -> str:
"""Change password section of edit profile screen """Change password section of edit profile screen
""" """
editProfileForm = \ editProfileForm = \
' <details><summary class="cw">' + \ _beginEditSection(translate['Change Password']) + \
translate['Change Password'] + '</summary>\n' + \
' <div class="container">\n' + \
'<label class="labels">' + translate['Change Password'] + \ '<label class="labels">' + translate['Change Password'] + \
'</label><br>\n' + \ '</label><br>\n' + \
' <input type="password" name="password" ' + \ ' <input type="password" name="password" ' + \
@ -1600,7 +1580,7 @@ def _htmlEditProfileChangePassword(translate: {}) -> str:
'<label class="labels">' + translate['Confirm Password'] + \ '<label class="labels">' + translate['Confirm Password'] + \
'</label><br>\n' + \ '</label><br>\n' + \
' <input type="password" name="passwordconfirm" value="">\n' + \ ' <input type="password" name="passwordconfirm" value="">\n' + \
' </div></details>\n' _endEditSection()
return editProfileForm return editProfileForm
@ -1627,9 +1607,7 @@ def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str:
idx = 'The files attached below should be no larger than ' + \ idx = 'The files attached below should be no larger than ' + \
'10MB in total uploaded at once.' '10MB in total uploaded at once.'
editProfileForm = \ editProfileForm = \
' <details><summary class="cw">' + \ _beginEditSection(translate['Background Images']) + \
translate['Background Images'] + '</summary>\n' + \
' <div class="container">\n' + \
' <label class="labels">' + translate[idx] + '</label><br><br>\n' ' <label class="labels">' + translate[idx] + '</label><br><br>\n'
if not newsInstance: if not newsInstance:
@ -1659,7 +1637,7 @@ def _htmlEditProfileBackground(newsInstance: bool, translate: {}) -> str:
'name="right_col_image"' + \ 'name="right_col_image"' + \
' accept="' + imageFormats + '">\n' ' accept="' + imageFormats + '">\n'
editProfileForm += ' </div></details>\n' editProfileForm += _endEditSection()
return editProfileForm return editProfileForm