mirror of https://gitlab.com/bashrc2/epicyon
Required price field
parent
4cc0bd03d5
commit
91931b0e7b
|
@ -374,7 +374,8 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
extraFields += '</div>\n'
|
||||
extraFields += '<div class="container">\n'
|
||||
extraFields += \
|
||||
editCurrencyField(translate['Price'] + ':', 'itemPrice', '0.00')
|
||||
editCurrencyField(translate['Price'] + ':', 'itemPrice', '0.00',
|
||||
'0.00', True)
|
||||
extraFields += '<br>' + \
|
||||
editTextField(translate['Currency'] + ':', 'itemCurrency', 'EUR',
|
||||
'EUR / GBP / USD ...', True)
|
||||
|
|
|
@ -1190,7 +1190,8 @@ def editNumberField(label: str, name: str, value: int = 1,
|
|||
|
||||
|
||||
def editCurrencyField(label: str, name: str, value: str = "0.00",
|
||||
placeholder: str = "0.00") -> str:
|
||||
placeholder: str = "0.00",
|
||||
required: bool = False) -> str:
|
||||
"""Returns html for editing a currency field
|
||||
"""
|
||||
if value is None:
|
||||
|
@ -1199,11 +1200,15 @@ def editCurrencyField(label: str, name: str, value: str = "0.00",
|
|||
if placeholder:
|
||||
if placeholder.isdigit():
|
||||
placeholderStr = ' placeholder="' + str(placeholder) + '"'
|
||||
requiredStr = ''
|
||||
if required:
|
||||
requiredStr = ' required'
|
||||
return \
|
||||
'<label class="labels">' + label + '</label><br>\n' + \
|
||||
' <input type="text" name="' + name + '" value="' + \
|
||||
str(value) + '"' + placeholderStr + ' ' + \
|
||||
' pattern="^\\d{1,3}(,\\d{3})*(\\.\\d+)?" data-type="currency">\n'
|
||||
' pattern="^\\d{1,3}(,\\d{3})*(\\.\\d+)?" data-type="currency"' + \
|
||||
requiredStr + '>\n'
|
||||
|
||||
|
||||
def editCheckBox(label: str, name: str, checked: bool = False) -> str:
|
||||
|
|
Loading…
Reference in New Issue