diff --git a/epicyon.py b/epicyon.py index 684ae8521..b80ad04df 100644 --- a/epicyon.py +++ b/epicyon.py @@ -2327,8 +2327,8 @@ if args.testdata: httpPrefix, nickname, domain, port, "spanner", "It's a spanner", - "img/shares1.png", - "tool", + "img/shares1.png", + 1, "tool", "mechanical", "City", "2 months", @@ -2338,7 +2338,7 @@ if args.testdata: "witch hat", "Spooky", "img/shares2.png", - "hat", + 1, "hat", "clothing", "City", "3 months", diff --git a/webapp_create_post.py b/webapp_create_post.py index 408a22b96..d83324465 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -18,6 +18,7 @@ from webapp_utils import getBannerFile from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import editTextField +from webapp_utils import editNumberField def _htmlFollowingDataList(baseDir: str, nickname: str, @@ -354,6 +355,9 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, translate['Description of the item being shared'] + '...' endpoint = 'newshare' extraFields = '
\n' + extraFields += \ + editNumberField(translate['Quantity'], + 'itemQty', 1, 1, 999999, 1) extraFields += \ editTextField(translate['Quantity'] + ':', 'itemQty', '1') @@ -362,11 +366,10 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, 'itemType', '') catStr = translate['Category of shared item. eg. clothing'] extraFields += editTextField(catStr + ':', 'category', '') + extraFields += '
' extraFields += \ - '
\n' - extraFields += ' \n' + editNumberField(translate['Duration of listing in days'], + 'duration', 14, 1, 365, 1) extraFields += '
\n' extraFields += '
\n' cityOrLocStr = translate['City or location of the shared item'] diff --git a/webapp_utils.py b/webapp_utils.py index 9d9135006..1a22efa36 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -1142,6 +1142,23 @@ def editTextField(label: str, name: str, value: str = "", value + '"' + placeholderStr + '>\n' +def editNumberField(label: str, name: str, value: int = 1, + minValue: int = 1, maxValue: int = 999999, + placeholder: int = 1) -> str: + """Returns html for editing an integer number field + """ + if value is None: + value = '' + placeholderStr = '' + if placeholder: + placeholderStr = ' placeholder="' + str(placeholder) + '"' + return \ + '
\n' + \ + ' \n' + + def editCheckBox(label: str, name: str, checked: bool = False) -> str: """Returns html for editing a checkbox field """