updates for listviews
This commit is contained in:
parent
c80f460bba
commit
b3249ba112
7 changed files with 41 additions and 26 deletions
|
|
@ -6,26 +6,24 @@ frappe.core.Workflow = frappe.ui.form.Controller.extend({
|
|||
if(doc.is_active) {
|
||||
this.frm.set_intro("This Workflow is active.");
|
||||
}
|
||||
this.load_document_type(doc);
|
||||
this.update_field_options(doc);
|
||||
},
|
||||
document_type: function(doc) {
|
||||
this.load_document_type(doc);
|
||||
this.update_field_options(doc);
|
||||
},
|
||||
load_document_type: function(doc) {
|
||||
update_field_options: function(doc) {
|
||||
var me = this;
|
||||
if(doc.document_type && !locals.DocType[doc.document_type]) {
|
||||
frappe.model.with_doctype(doc.document_type, function() {
|
||||
me.update_field_options();
|
||||
if(doc.document_type) {
|
||||
frappe.model.with_doctype(doc.document_type, function() {
|
||||
var fields = $.map(frappe.get_doc("DocType",
|
||||
me.frm.doc.document_type).fields, function(d) {
|
||||
return frappe.model.no_value_type.indexOf(d.fieldtype)===-1 ? d.fieldname : null;
|
||||
})
|
||||
frappe.meta.get_docfield("Workflow Document State", "update_field", me.frm.doc.name).options
|
||||
= [""].concat(fields);
|
||||
});
|
||||
}
|
||||
},
|
||||
update_field_options: function() {
|
||||
var fields = $.map(frappe.get_doc("DocType", this.frm.doc.document_type).fields, function(d) {
|
||||
return frappe.model.no_value_type.indexOf(d.fieldtype)===-1 ? d.fieldname : null;
|
||||
})
|
||||
frappe.meta.get_docfield("Workflow Document State", "update_field", this.frm.doc.name).options
|
||||
= [""].concat(fields);
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.cscript = new frappe.core.Workflow({frm:cur_frm});
|
||||
cur_frm.cscript = new frappe.core.Workflow({frm:cur_frm});
|
||||
|
|
|
|||
2
frappe/public/css/bootstrap.css
vendored
2
frappe/public/css/bootstrap.css
vendored
|
|
@ -895,7 +895,7 @@ html {
|
|||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
body {
|
||||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-family: "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
color: #333;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
|
||||
@import url(http://fonts.googleapis.com/css?family=Noto+Sans:400,700);
|
||||
|
||||
html {
|
||||
min-height: 100%;
|
||||
|
|
|
|||
BIN
frappe/public/css/font/noto-sans.woff
Normal file
BIN
frappe/public/css/font/noto-sans.woff
Normal file
Binary file not shown.
|
|
@ -153,10 +153,12 @@ frappe.utils = {
|
|||
return '' !== val ? regExp.test( val ) : false;
|
||||
},
|
||||
guess_style: function(text, default_style) {
|
||||
var style = default_style;
|
||||
var style = default_style || "default";
|
||||
if(!text)
|
||||
return style;
|
||||
if(has_words(["Open", "Pending"], text)) {
|
||||
if(has_words(["Pending", "Review"], text)) {
|
||||
style = "warning";
|
||||
} else if(has_words(["Open", "Rejected"], text)) {
|
||||
style = "danger";
|
||||
} else if(has_words(["Closed", "Finished", "Converted", "Completed", "Confirmed",
|
||||
"Approved", "Yes", "Active"], text)) {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ frappe.views.ListView = Class.extend({
|
|||
colspans = 0,
|
||||
me = this;
|
||||
|
||||
$(me.get_avatar_and_id(data)).appendTo(body.find(".list-row-id-area"));
|
||||
$(me.get_avatar_and_id(data, true)).appendTo(body.find(".list-row-id-area"));
|
||||
|
||||
// make table
|
||||
$.each(this.columns, function(i, v) {
|
||||
|
|
@ -290,7 +290,7 @@ frappe.views.ListView = Class.extend({
|
|||
})
|
||||
return col;
|
||||
},
|
||||
get_avatar_and_id: function(data) {
|
||||
get_avatar_and_id: function(data, without_workflow) {
|
||||
this.title_offset_left = 15;
|
||||
|
||||
var html = "";
|
||||
|
|
@ -329,6 +329,15 @@ frappe.views.ListView = Class.extend({
|
|||
|
||||
this.title_offset_left += 5;
|
||||
|
||||
if(!without_workflow && this.workflow_state_fieldname) {
|
||||
html+= repl('<span class="label label-%(style)s filterable" data-filter="%(fieldname)s,=,%(value)s">\
|
||||
%(value)s</span>', {
|
||||
fieldname: this.workflow_state_fieldname,
|
||||
value: data[this.workflow_state_fieldname],
|
||||
style: frappe.utils.guess_style(data[this.workflow_state_fieldname])
|
||||
});
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
|
||||
|
|
@ -389,12 +398,9 @@ frappe.views.ListView = Class.extend({
|
|||
+ data[opts.content] + "</span>")
|
||||
.css({"cursor":"pointer"})
|
||||
.addClass("label")
|
||||
.addClass("filterable")
|
||||
.addClass(label_class)
|
||||
.attr("data-fieldname", opts.content)
|
||||
.click(function() {
|
||||
me.doclistview.set_filter($(this).attr("data-fieldname"),
|
||||
$(this).text());
|
||||
})
|
||||
.attr("data-filter", opts.fieldname + ",=," + opts.content)
|
||||
.appendTo(parent.css({"overflow":"hidden"}));
|
||||
}
|
||||
else if(opts.type=="link" && data[opts.content]) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,16 @@ def after_install():
|
|||
'parenttype':'User', 'parentfield':'user_roles'},
|
||||
{'doctype':'UserRole', 'parent': 'Guest', 'role': 'Guest',
|
||||
'parenttype':'User', 'parentfield':'user_roles'},
|
||||
{'doctype': "Role", "role_name": "Report Manager"}
|
||||
{'doctype': "Role", "role_name": "Report Manager"},
|
||||
{'doctype': "Workflow State", "workflow_state_name": "Pending",
|
||||
"icon": "question-sign", "style": ""},
|
||||
{'doctype': "Workflow State", "workflow_state_name": "Approved",
|
||||
"icon": "ok-sign", "style": "Success"},
|
||||
{'doctype': "Workflow State", "workflow_state_name": "Rejected",
|
||||
"icon": "remove", "style": "Danger"},
|
||||
{'doctype': "Workflow Action", "workflow_action_name": "Approve"},
|
||||
{'doctype': "Workflow Action", "workflow_action_name": "Reject"},
|
||||
{'doctype': "Workflow Action", "workflow_action_name": "Review"}
|
||||
]
|
||||
|
||||
for d in install_docs:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue