Fixes to microtemplate feature

This commit is contained in:
Anand Doshi 2014-08-07 17:21:08 +05:30
parent a6b1900e70
commit ba4add6779
10 changed files with 32 additions and 26 deletions

View file

@ -21,12 +21,11 @@
"SMS": "comment",
"Visit": "male",
"Other": "comments"
}[doc.communication_medium] %}"></i>
}[doc.communication_medium] || "comments" %}"></i>
</span>
</div>
</div>
<!-- sample graph -->
<div class="col-xs-2">
<div class="text-ellipsis">
<span style="margin-right: 8px;" class="filterable small"

View file

@ -1,4 +1,4 @@
<div class="row" style="max-height: 32px;">
<div class="row" style="max-height: 32px; margin-bottom: 3px;">
<div class="col-xs-11">
<div class="text-ellipsis">
{%= list.get_avatar_and_id(doc) %}
@ -8,9 +8,20 @@
<span class="label label-{%= frappe.utils.guess_style(doc.priority) %}
filterable"
data-filter="priority,=,{%= doc.priority %}">{%= __(doc.priority) %}</span>
{% if (doc.reference_name) { %}
{% var reference_href = ("#Form/" + encodeURIComponent(doc.reference_type) + "/"
+ encodeURIComponent(doc.reference_name)) %}
<a href="{%= reference_href %}" style="text-decoration: none;">
<span class="label label-default">
<i class="{%= frappe.boot.doctype_icons[doc.reference_type] %}"></i>
{%= doc.reference_name %}
</span>
</a>
{% } %}
</div>
</div>
<div class="col-xs-1 text-right">
<div class="col-xs-1 text-right" style="margin-bottom: 3px;">
<span class="filterable" data-filter="assigned_to,=,{%= doc.assigned_to %}">
{%= frappe.avatar(doc.assigned_to) %}
</span>

View file

@ -5,8 +5,7 @@ frappe.listview_settings['ToDo'] = {
"status": "Open"
};
},
fields: ["status", "priority", "due_date", "assigned_to"],
filters: [["status","=","Open"]],
add_fields: ["reference_type", "reference_name"],
set_title_left: function() {
frappe.set_route();
},

View file

@ -1,6 +1 @@
[
{
"doctype": "Version",
"name": "_Test Version 1"
}
]
[]

View file

@ -41,7 +41,7 @@ frappe.ui.form.Toolbar = Class.extend({
set_title: function() {
if(this.frm.meta.title_field) {
var title = (this.frm.doc[this.frm.meta.title_field] || "").trim() || __(this.frm.docname);
if(this.frm.doc.__islocal) {
if(this.frm.doc.__islocal || title === this.frm.docname) {
this.appframe.set_title_sub("");
} else {
this.appframe.set_title_sub("#" + this.frm.docname);
@ -83,7 +83,7 @@ frappe.ui.form.Toolbar = Class.extend({
case 1:
return ' <i class="icon-lock" title="' +__("Submitted") + '">';
case 2:
return ' <i class="icon-remove text-danger" title="' +__("Cancelled") + '">';
return ' <i class="icon-ban-circle text-danger" title="' +__("Cancelled") + '">';
}
} else {
return "";
@ -118,7 +118,7 @@ frappe.ui.form.Toolbar = Class.extend({
// Cancel
if(this.can_cancel()) {
this.appframe.add_dropdown_button("File", __("Cancel"), function() {
me.frm.savecancel(this);}, 'icon-remove');
me.frm.savecancel(this);}, 'icon-ban-circle');
}
// Amend
@ -149,7 +149,7 @@ frappe.ui.form.Toolbar = Class.extend({
// copy
if(in_list(frappe.boot.user.can_create, me.frm.doctype) && !me.frm.meta.allow_copy) {
this.appframe.add_dropdown_button("File", __("Copy"), function() {
me.frm.copy_doc();}, 'icon-file');
me.frm.copy_doc();}, 'icon-copy');
}
// rename
@ -162,7 +162,7 @@ frappe.ui.form.Toolbar = Class.extend({
if((cint(me.frm.doc.docstatus) != 1) && !me.frm.doc.__islocal
&& frappe.model.can_delete(me.frm.doctype)) {
this.appframe.add_dropdown_button("File", __("Delete"), function() {
me.frm.savetrash();}, 'icon-remove-sign');
me.frm.savetrash();}, 'icon-trash');
}
},
@ -272,7 +272,7 @@ frappe.ui.form.Toolbar = Class.extend({
return;
} else if(docstatus==1 && p[CANCEL]) {
this.appframe.add_button('Cancel', function() {
me.frm.savecancel(this) }, 'icon-remove');
me.frm.savecancel(this) }, 'icon-ban-circle');
} else if(docstatus==2 && p[AMEND]) {
this.appframe.add_button('Amend', function() {
me.frm.amend_doc() }, 'icon-pencil', true);

View file

@ -38,7 +38,7 @@ function prettyDate(time){
var comment_when = function(datetime) {
return '<span class="frappe-timestamp" data-timestamp="'+datetime
+'" title="'+datetime+'">'
+'" title="'+frappe.datetime.str_to_user(datetime)+'">'
+ prettyDate(datetime) + '</span>';
};

View file

@ -346,11 +346,13 @@ frappe.ui.Filter = Class.extend({
var value = this.get_selected_value();
if(this.field.df.fieldname==="docstatus") {
value = {0:"Draft", 1:"Submitted", 2:"Cancelled"}[value];
value = {0:"Draft", 1:"Submitted", 2:"Cancelled"}[value] || value;
}
if(this.field.df.original_type==="Check") {
value = {0:"No", 1:"Yes"}[cint(value)];
} else if (in_list(["Date", "Datetime"], this.field.df.fieldtype)) {
value = frappe.datetime.str_to_user(value);
}
this.$btn_group.find(".toggle-filter")

View file

@ -128,7 +128,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
} else if(f[2]=="User") {
f[2] = user;
}
me.filter_list.add_filter(me.doctype, f[0], f[1], f[2]);
me.filter_list.add_filter(me.doctype, f[0], f[1], f.slice(2).join(","));
});
me.run();
})
@ -287,7 +287,7 @@ frappe.views.DocListView = frappe.ui.Listing.extend({
this.appframe.add_icon_btn("2", 'icon-tag', __('Show Tags'), function() { me.toggle_tags(); });
this.$page.on("click", ".list-tag-preview", function() { me.toggle_tags(); });
if(this.can_delete || this.listview.settings.selectable) {
this.appframe.add_icon_btn("2", 'icon-remove', __('Delete'),
this.appframe.add_icon_btn("2", 'icon-trash', __('Delete'),
function() { me.delete_items(); });
this.appframe.add_icon_btn("2", 'icon-ok', __('Select All'), function() {
me.$page.find('.list-delete').prop("checked",

View file

@ -223,7 +223,7 @@ frappe.views.ListView = Class.extend({
function(v) { return v ? v : null; }),
me = this;
if(me.title_field) {
if(me.title_field && data[me.title_field]!==data.name) {
$('<div class="list-doc-name">')
.appendTo(row)
.css({"left": me.title_offset_left})
@ -423,7 +423,7 @@ frappe.views.ListView = Class.extend({
})
.attr("data-fieldname", opts.content)
.attr("data-value", data[opts.content])
.find("a").attr("href", "#");
.find("a").removeAttr("href");
}
else if(data[opts.content]) {
@ -465,7 +465,7 @@ frappe.views.ListView = Class.extend({
data.docstatus_icon = 'icon-lock';
data.docstatus_title = __('Submitted');
} else if(data.docstatus==2) {
data.docstatus_icon = 'icon-remove';
data.docstatus_icon = 'icon-ban-circle';
data.docstatus_title = __('Cancelled');
}

View file

@ -551,7 +551,7 @@ frappe.views.ReportView = frappe.ui.Listing.extend({
});
}));
}, 'icon-remove');
}, 'icon-trash');
}
},