Shared item duration on web interface

master
Bob Mottram 2019-07-28 12:35:57 +01:00
parent 1c2e073d0c
commit 35ef11d3d2
2 changed files with 24 additions and 3 deletions

View File

@ -240,6 +240,22 @@ input[type=text], select, textarea {
font-size: 18px; font-size: 18px;
} }
input[type=number] {
width: 10%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-top: 6px;
margin-bottom: 16px;
resize: vertical;
font-size: 18px;
}
.labels {
font-size: 18px;
}
input[type=submit] { input[type=submit] {
background-color: #555; background-color: #555;
color: white; color: white;

View File

@ -75,7 +75,11 @@ def htmlLogin(baseDir: str) -> str:
return loginForm return loginForm
def htmlNewPost(baseDir: str,path: str) -> str: def htmlNewPost(baseDir: str,path: str) -> str:
if not path.endswith('/newshare'):
newPostText='<p class="new-post-text">Enter your post text below.</p>' newPostText='<p class="new-post-text">Enter your post text below.</p>'
else:
newPostText='<p class="new-post-text">Enter the details for your shared item below.</p>'
if os.path.isfile(baseDir+'/accounts/newpost.txt'): if os.path.isfile(baseDir+'/accounts/newpost.txt'):
with open(baseDir+'/accounts/newpost.txt', 'r') as file: with open(baseDir+'/accounts/newpost.txt', 'r') as file:
newPostText = '<p class="new-post-text">'+file.read()+'</p>' newPostText = '<p class="new-post-text">'+file.read()+'</p>'
@ -111,8 +115,9 @@ def htmlNewPost(baseDir: str,path: str) -> str:
endpoint='newshare' endpoint='newshare'
extraFields= \ extraFields= \
'<div class="container">' \ '<div class="container">' \
' <input type="text" placeholder="Type of shared item. eg. hat" name="itemType">' \ ' <input type="text" class="itemType" placeholder="Type of shared item. eg. hat" name="itemType">' \
' <input type="text" placeholder="Category of shared item. eg. clothing" name="category">' \ ' <input type="text" class="category" placeholder="Category of shared item. eg. clothing" name="category">' \
' <label class="labels">Duration of listing in days:</label> <input type="number" name="duration" min="1" max="365" step="1" value="14">' \
'</div>' \ '</div>' \
'<input type="text" placeholder="City or location of the shared item" name="location">' '<input type="text" placeholder="City or location of the shared item" name="location">'