[minor] [cleanup] fixes to new entry and seen

This commit is contained in:
Rushabh Mehta 2016-04-07 17:02:48 +05:30
parent 3c8f966cf2
commit a7cf3d9248
5 changed files with 19 additions and 4 deletions

View file

@ -13,9 +13,10 @@
<span class="likes-count">{{ (_liked_by.length > 9 ? "9+" : _liked_by.length) || "" }}</span>
</span>
<a class="grey list-id {{ css_seen }}"
data-name="{{ _name }}"
style="margin-right: 7px;"
href="#Form/{{ _doctype_encoded }}/{{ _name_encoded }}"
title="{{ _full_title }}">{{ _title }}</a>
title="{{ _full_title }}">{{ strip_html(_title) }}</a>
{% if (_workflow && !_without_workflow) { %}
<span class="label label-{{ _workflow.style }} filterable"
data-filter="{{ _workflow.fieldname }},=,{{ _workflow.value }}">

View file

@ -89,6 +89,10 @@ function replace_all(s, t1, t2) {
return s.split(t1).join(t2);
}
function strip_html(txt) {
return txt.replace(/<[^>]*>/g, "");
}
var strip = function(s, chars) {
if (s) {
var s= lstrip(s, chars)

View file

@ -329,8 +329,15 @@ frappe.new_doc = function (doctype, opts) {
} else {
frappe.ui.form.quick_entry(doctype, function(doc) {
//frappe.set_route('List', doctype);
var title = doc.name;
var title_field = frappe.get_meta(doc.doctype).title_field;
if (title_field) {
title = doc[title_field];
}
console.log(title, title_field);
show_alert('<a href="#Form/' + doc.doctype + '/' + doc.name + '">'
+ __('{0} {1} created', [doc.doctype, doc.name]) + '</a>');
+ __('{0} {1} created', [doc.doctype, strip_html(title)]) + '</a>');
});
}
});

View file

@ -289,7 +289,7 @@ frappe.ui.Page = Class.extend({
if(!txt) txt = "";
// strip html
txt = txt.replace(/<[^>]*>/g, "");
txt = strip_html(txt);
this.title = txt;
frappe.utils.set_title(txt);

View file

@ -575,7 +575,10 @@ _f.Frm.prototype.setnewdoc = function() {
});
frappe.breadcrumbs.add(me.meta.module, me.doctype)
})
});
// update seen
$('.list-id[data-name="'+ me.docname +'"]').addClass('seen');
}