merge-requests/30/head
Bob Mottram 2021-07-22 19:35:45 +01:00
parent e1a9041586
commit 947f7131ef
3 changed files with 33 additions and 56 deletions

View File

@ -15,6 +15,7 @@ from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlHeaderWithBlogMarkup from webapp_utils import htmlHeaderWithBlogMarkup
from webapp_utils import htmlFooter from webapp_utils import htmlFooter
from webapp_utils import getPostAttachmentsAsHtml from webapp_utils import getPostAttachmentsAsHtml
from webapp_utils import editTextArea
from webapp_media import addEmbeddedElements from webapp_media import addEmbeddedElements
from utils import getActorLanguagesList from utils import getActorLanguagesList
from utils import getBaseContentFromPost from utils import getBaseContentFromPost
@ -854,17 +855,15 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
editBlogForm += \ editBlogForm += \
' <input type="text" name="subject" value="' + titleStr + '">' ' <input type="text" name="subject" value="' + titleStr + '">'
editBlogForm += '' editBlogForm += ''
editBlogForm += ' <br><label class="labels">' + \ editBlogForm += ' <br>'
placeholderMessage + '</label>'
messageBoxHeight = 800 messageBoxHeight = 800
contentStr = getBaseContentFromPost(postJsonObject, systemLanguage) contentStr = getBaseContentFromPost(postJsonObject, systemLanguage)
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n') contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
editBlogForm += \ editBlogForm += \
' <textarea id="message" name="message" style="height:' + \ editTextArea(placeholderMessage, 'message', contentStr,
str(messageBoxHeight) + 'px" spellcheck="true">' + \ messageBoxHeight, '', True)
contentStr + '</textarea>'
editBlogForm += dateAndLocation editBlogForm += dateAndLocation
if not mediaInstance: if not mediaInstance:
editBlogForm += editBlogImageSection editBlogForm += editBlogImageSection

View File

@ -1218,12 +1218,9 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
with open(counselorsFile, 'r') as f: with open(counselorsFile, 'r') as f:
counselors = f.read() counselors = f.read()
roleAssignStr += \ roleAssignStr += \
' <b><label class="labels">' + \ ' <b>' + \
translate['Counselors'] + '</label></b><br>\n' + \ editTextArea(translate['Counselors'], 'counselors', counselors,
' <textarea id="message" name="counselors" ' + \ 200, '', False)
'placeholder="" ' + \
'style="height:200px" spellcheck="false">' + \
counselors + '</textarea>'
# artists # artists
artists = '' artists = ''
@ -1232,28 +1229,20 @@ def _htmlEditProfileInstance(baseDir: str, translate: {},
with open(artistsFile, 'r') as f: with open(artistsFile, 'r') as f:
artists = f.read() artists = f.read()
roleAssignStr += \ roleAssignStr += \
' <b><label class="labels">' + \ ' <b>' + \
translate['Artists'] + '</label></b><br>\n' + \ editTextArea(translate['Artists'], 'artists', artists,
' <textarea id="message" name="artists" ' + \ 200, '', False)
'placeholder="" ' + \ roleAssignStr += endEditSection()
'style="height:200px" spellcheck="false">' + \
artists + '</textarea>' + endEditSection()
# Video section # Video section
idx = 'Show video previews for the following Peertube sites.' peertubeStr = beginEditSection(translate['Video Settings'])
peertubeStr = \
beginEditSection(translate['Video Settings']) + \
' <b><label class="labels">' + \
translate['Peertube Instances'] + '</label></b>\n' + \
' <br><label class="labels">' + \
translate[idx] + '</label>\n'
peertubeInstancesStr = '' peertubeInstancesStr = ''
for url in peertubeInstances: for url in peertubeInstances:
peertubeInstancesStr += url + '\n' peertubeInstancesStr += url + '\n'
peertubeStr += \ peertubeStr += \
' <textarea id="message" name="ptInstances" ' + \ editTextArea(translate['Peertube Instances'], 'ptInstances',
'style="height:200px" spellcheck="false">' + \ peertubeInstancesStr, 200, '', False)
peertubeInstancesStr + '</textarea>\n' + \ peertubeStr += \
' <br>\n' ' <br>\n'
YTReplacementDomain = getConfigParam(baseDir, "youtubedomain") YTReplacementDomain = getConfigParam(baseDir, "youtubedomain")
if not YTReplacementDomain: if not YTReplacementDomain:
@ -1343,13 +1332,11 @@ def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str,
gitProjectsStr = gitProjectsFile.read() gitProjectsStr = gitProjectsFile.read()
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 = beginEditSection(translate['Git Projects'])
editProfileForm = \ editProfileForm = \
beginEditSection(translate['Git Projects']) + \ editTextArea(translate[idx], 'gitProjects', gitProjectsStr,
' <label class="labels">' + \ 100, '', False)
translate[idx] + '</label>\n' + \ editProfileForm = endEditSection()
' <textarea id="message" name="gitProjects" ' + \
'style="height:100px" spellcheck="false">' + \
gitProjectsStr + '</textarea>\n' + endEditSection()
return editProfileForm return editProfileForm
@ -1472,21 +1459,14 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
idx = 'Blocked accounts, one per line, in the form ' + \ idx = 'Blocked accounts, one per line, in the form ' + \
'nickname@domain or *@blockeddomain' 'nickname@domain or *@blockeddomain'
editProfileForm += \ editProfileForm += \
' <br><b><label class="labels">' + \ editTextArea(translate['Blocked accounts'], 'blocked', blockedStr,
translate['Blocked accounts'] + '</label></b>\n' + \ 200, '', False)
' <br><label class="labels">' + translate[idx] + '</label>\n' + \
' <textarea id="message" name="blocked" style="height:200px" ' + \
'spellcheck="false">' + blockedStr + '</textarea>\n'
idx = 'Direct messages are always allowed from these instances.' idx = 'Direct messages are always allowed from these instances.'
editProfileForm += \ editProfileForm += \
' <br><b><label class="labels">' + \ editTextArea(translate['Direct Message permitted instances'],
translate['Direct Message permitted instances'] + '</label></b>\n' + \ 'dmAllowedInstances', dmAllowedInstancesStr,
' <br><label class="labels">' + \ 200, '', False)
translate[idx] + '</label>\n' + \
' <textarea id="message" name="dmAllowedInstances" ' + \
'style="height:200px" spellcheck="false">' + \
dmAllowedInstancesStr + '</textarea>\n'
idx = 'Federate only with a defined set of instances. ' + \ idx = 'Federate only with a defined set of instances. ' + \
'One domain name per line.' 'One domain name per line.'
@ -1505,11 +1485,9 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str,
userAgentsBlockedStr += '\n' userAgentsBlockedStr += '\n'
userAgentsBlockedStr += ua userAgentsBlockedStr += ua
editProfileForm += \ editProfileForm += \
' <br><b><label class="labels">' + \ editTextArea(translate['Blocked User Agents'],
translate['Blocked User Agents'] + '</label></b>\n' + \ 'userAgentsBlockedStr', userAgentsBlockedStr,
' <textarea id="message" name="userAgentsBlockedStr" ' + \ 200, '', False)
'style="height:200px" spellcheck="false">' + \
userAgentsBlockedStr + '</textarea>\n'
editProfileForm += endEditSection() editProfileForm += endEditSection()
return editProfileForm return editProfileForm
@ -1702,10 +1680,7 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str,
displayNickname) displayNickname)
editProfileForm += \ editProfileForm += \
' <label class="labels">' + \ editTextArea(translate['Your bio'], 'bio', bioStr, 200, '', True)
translate['Your bio'] + '</label>\n' + \
' <textarea id="message" name="bio" style="height:200px" ' + \
'spellcheck="true">' + bioStr + '</textarea>\n'
editProfileForm += \ editProfileForm += \
' <label class="labels">' + translate['Avatar image'] + \ ' <label class="labels">' + translate['Avatar image'] + \

View File

@ -1162,10 +1162,13 @@ def editTextArea(label: str, name: str, value: str = "",
""" """
if value is None: if value is None:
value = '' value = ''
return \ text = ''
'<label class="labels">' + label + '</label><br>\n' + \ if label:
text = '<label class="labels">' + label + '</label><br>\n'
text += \
' <textarea id="message" placeholder=' + \ ' <textarea id="message" placeholder=' + \
'"' + placeholder + '" name="' + name + '" ' + \ '"' + placeholder + '" name="' + name + '" ' + \
'style="height:' + height + 'px" spellcheck="' + \ 'style="height:' + height + 'px" spellcheck="' + \
str(spellcheck).lower() + '">' + \ str(spellcheck).lower() + '">' + \
value + '</textarea>\n' value + '</textarea>\n'
return text