From 947f7131ef60220d792a9a4d7c082b26011cc956 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 22 Jul 2021 19:35:45 +0100 Subject: [PATCH] Tidying --- blog.py | 9 +++--- webapp_profile.py | 73 ++++++++++++++++------------------------------- webapp_utils.py | 7 +++-- 3 files changed, 33 insertions(+), 56 deletions(-) diff --git a/blog.py b/blog.py index 9adf15063..12d753906 100644 --- a/blog.py +++ b/blog.py @@ -15,6 +15,7 @@ from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlHeaderWithBlogMarkup from webapp_utils import htmlFooter from webapp_utils import getPostAttachmentsAsHtml +from webapp_utils import editTextArea from webapp_media import addEmbeddedElements from utils import getActorLanguagesList from utils import getBaseContentFromPost @@ -854,17 +855,15 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, editBlogForm += \ ' ' editBlogForm += '' - editBlogForm += '
' + editBlogForm += '
' messageBoxHeight = 800 contentStr = getBaseContentFromPost(postJsonObject, systemLanguage) contentStr = contentStr.replace('

', '').replace('

', '\n') editBlogForm += \ - ' ' + editTextArea(placeholderMessage, 'message', contentStr, + messageBoxHeight, '', True) editBlogForm += dateAndLocation if not mediaInstance: editBlogForm += editBlogImageSection diff --git a/webapp_profile.py b/webapp_profile.py index 9020c7f81..d542de00c 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1218,12 +1218,9 @@ def _htmlEditProfileInstance(baseDir: str, translate: {}, with open(counselorsFile, 'r') as f: counselors = f.read() roleAssignStr += \ - '
\n' + \ - ' ' + ' ' + \ + editTextArea(translate['Counselors'], 'counselors', counselors, + 200, '', False) # artists artists = '' @@ -1232,28 +1229,20 @@ def _htmlEditProfileInstance(baseDir: str, translate: {}, with open(artistsFile, 'r') as f: artists = f.read() roleAssignStr += \ - '
\n' + \ - ' ' + endEditSection() + ' ' + \ + editTextArea(translate['Artists'], 'artists', artists, + 200, '', False) + roleAssignStr += endEditSection() # Video section - idx = 'Show video previews for the following Peertube sites.' - peertubeStr = \ - beginEditSection(translate['Video Settings']) + \ - ' \n' + \ - '
\n' + peertubeStr = beginEditSection(translate['Video Settings']) peertubeInstancesStr = '' for url in peertubeInstances: peertubeInstancesStr += url + '\n' peertubeStr += \ - ' \n' + \ + editTextArea(translate['Peertube Instances'], 'ptInstances', + peertubeInstancesStr, 200, '', False) + peertubeStr += \ '
\n' YTReplacementDomain = getConfigParam(baseDir, "youtubedomain") if not YTReplacementDomain: @@ -1343,13 +1332,11 @@ def _htmlEditProfileGitProjects(baseDir: str, nickname: str, domain: str, gitProjectsStr = gitProjectsFile.read() idx = 'List of project names that you wish to receive git patches for' + editProfileForm = beginEditSection(translate['Git Projects']) editProfileForm = \ - beginEditSection(translate['Git Projects']) + \ - ' \n' + \ - ' \n' + endEditSection() + editTextArea(translate[idx], 'gitProjects', gitProjectsStr, + 100, '', False) + editProfileForm = endEditSection() return editProfileForm @@ -1472,21 +1459,14 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, idx = 'Blocked accounts, one per line, in the form ' + \ 'nickname@domain or *@blockeddomain' editProfileForm += \ - '
\n' + \ - '
\n' + \ - ' \n' + editTextArea(translate['Blocked accounts'], 'blocked', blockedStr, + 200, '', False) idx = 'Direct messages are always allowed from these instances.' editProfileForm += \ - '
\n' + \ - '
\n' + \ - ' \n' + editTextArea(translate['Direct Message permitted instances'], + 'dmAllowedInstances', dmAllowedInstancesStr, + 200, '', False) idx = 'Federate only with a defined set of instances. ' + \ 'One domain name per line.' @@ -1505,11 +1485,9 @@ def _htmlEditProfileFiltering(baseDir: str, nickname: str, domain: str, userAgentsBlockedStr += '\n' userAgentsBlockedStr += ua editProfileForm += \ - '
\n' + \ - ' \n' + editTextArea(translate['Blocked User Agents'], + 'userAgentsBlockedStr', userAgentsBlockedStr, + 200, '', False) editProfileForm += endEditSection() return editProfileForm @@ -1702,10 +1680,7 @@ def _htmlEditProfileMain(baseDir: str, displayNickname: str, bioStr: str, displayNickname) editProfileForm += \ - ' \n' + \ - ' \n' + editTextArea(translate['Your bio'], 'bio', bioStr, 200, '', True) editProfileForm += \ '