feat: Open Link from read-only URL field
- Also, remove one depracated $ method
This commit is contained in:
parent
af95a2452c
commit
794308cb4a
2 changed files with 6 additions and 5 deletions
|
|
@ -15,7 +15,10 @@ frappe.form.formatters = {
|
|||
return "<div style='text-align: right'>" + value + "</div>";
|
||||
}
|
||||
},
|
||||
Data: function(value) {
|
||||
Data: function(value, df) {
|
||||
if (df && df.options == "URL") {
|
||||
return `<a href="${value}" title="Open Link" target="_blank">${value}</a>`;
|
||||
}
|
||||
return value==null ? "" : value;
|
||||
},
|
||||
Select: function(value) {
|
||||
|
|
@ -159,7 +162,7 @@ frappe.form.formatters = {
|
|||
return value || "";
|
||||
},
|
||||
DateRange: function(value) {
|
||||
if($.isArray(value)) {
|
||||
if(Array.isArray(value)) {
|
||||
return __("{0} to {1}", [frappe.datetime.str_to_user(value[0]), frappe.datetime.str_to_user(value[1])]);
|
||||
} else {
|
||||
return value || "";
|
||||
|
|
|
|||
|
|
@ -169,9 +169,7 @@ def validate_url(txt, throw=False):
|
|||
except Exception:
|
||||
if throw:
|
||||
frappe.throw(
|
||||
frappe._(
|
||||
"'{0}' is not a valid URL"
|
||||
).format('<strong>' + txt +'</strong>')
|
||||
frappe._("'{0}' is not a valid URL").format(frappe.bold(txt))
|
||||
)
|
||||
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue