[style] [cleanup]
This commit is contained in:
parent
c121cccac1
commit
671f22f269
12 changed files with 142 additions and 36 deletions
|
|
@ -1,10 +1,9 @@
|
|||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// MIT License. See license.txt
|
||||
// MIT License. See license.txt
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.permission_manager = cur_frm.add_custom_button("Role Permissions Manager", function() {
|
||||
frappe.route_options = {"role": doc.name};
|
||||
frappe.set_route("permission-manager");
|
||||
});
|
||||
cur_frm.set_intro('<a onclick="cur_frm.permission_manager.click()">'+__('Edit Permissions') + '</a>');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
.form-page.second-page {
|
||||
border-top: 1px solid #d1d8dd;
|
||||
}
|
||||
.form-message {
|
||||
padding: 15px;
|
||||
}
|
||||
.form-dashboard {
|
||||
border-bottom: 1px solid #EBEFF2;
|
||||
}
|
||||
|
|
@ -41,6 +44,9 @@
|
|||
.form-heatmap {
|
||||
padding-top: 30px;
|
||||
}
|
||||
.form-heatmap .heatmap-message {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.inline-graph .inline-graph-half {
|
||||
width: 48%;
|
||||
display: inline-block;
|
||||
|
|
@ -88,25 +94,32 @@
|
|||
padding-bottom: 15px;
|
||||
}
|
||||
.form-links .document-link {
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 5px;
|
||||
height: 22px;
|
||||
position: relative;
|
||||
}
|
||||
.form-links .count {
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
top: 3px;
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.form-section {
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
}
|
||||
.form-section h6,
|
||||
.form-section .h6 {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.form-section .form-section-heading {
|
||||
margin: 0px 0px 10px 0px;
|
||||
margin: 10px 0px;
|
||||
text-transform: uppercase;
|
||||
color: #8D99A6;
|
||||
}
|
||||
.form-section .section-head {
|
||||
margin: 0px 0px 15px 15px;
|
||||
text-transform: uppercase;
|
||||
color: #8D99A6;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form-section .section-head .collapse-indicator {
|
||||
|
|
|
|||
|
|
@ -201,8 +201,10 @@ frappe.ui.form.ControlInput = frappe.ui.form.Control.extend({
|
|||
this.$wrapper = $('<div class="form-group frappe-control">').appendTo(this.parent);
|
||||
} else {
|
||||
this.$wrapper = $('<div class="frappe-control">\
|
||||
<div class="form-group" style="margin: 0px">\
|
||||
<label class="control-label" style="padding-right: 0px;"></label>\
|
||||
<div class="form-group">\
|
||||
<div class="clearfix">\
|
||||
<label class="control-label" style="padding-right: 0px;"></label>\
|
||||
</div>\
|
||||
<div class="control-input-wrapper">\
|
||||
<div class="control-input"></div>\
|
||||
<div class="control-value like-disabled-input" style="display: none;"></div>\
|
||||
|
|
@ -485,11 +487,16 @@ frappe.ui.form.ControlPassword = frappe.ui.form.ControlData.extend({
|
|||
});
|
||||
|
||||
frappe.ui.form.ControlInt = frappe.ui.form.ControlData.extend({
|
||||
make: function() {
|
||||
this._super();
|
||||
// $(this.label_area).addClass('pull-right');
|
||||
// $(this.disp_area).addClass('text-right');
|
||||
},
|
||||
make_input: function() {
|
||||
var me = this;
|
||||
this._super();
|
||||
this.$input
|
||||
.addClass("text-right")
|
||||
// .addClass("text-right")
|
||||
.on("focus", function() {
|
||||
setTimeout(function() {
|
||||
if(!document.activeElement) return;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
|
||||
// clear stats
|
||||
this.stats_area.empty().addClass('hidden');
|
||||
|
||||
// clear custom
|
||||
this.wrapper.find('.custom').remove();
|
||||
},
|
||||
set_headline: function(html) {
|
||||
this.headline.html(html).removeClass('hidden');
|
||||
|
|
@ -50,6 +53,10 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
}
|
||||
},
|
||||
|
||||
add_section: function(html) {
|
||||
return $('<div class="form-dashboard-section custom">'+html+'</div>').appendTo(this.wrapper);
|
||||
},
|
||||
|
||||
add_progress: function(title, percent, message) {
|
||||
var progress_chart = this.make_progress_chart(title);
|
||||
|
||||
|
|
@ -101,7 +108,7 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
}
|
||||
this.render_links();
|
||||
this.set_open_count();
|
||||
this.show_heatmap();
|
||||
this.render_heatmap();
|
||||
},
|
||||
filter_permissions: function() {
|
||||
// filter out transactions for which the user
|
||||
|
|
@ -178,7 +185,7 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
name: this.frm.doc.name,
|
||||
},
|
||||
callback: function(r) {
|
||||
me.heatmap.update(r.message.timeline_data);
|
||||
me.heatmap && me.heatmap.update(r.message.timeline_data);
|
||||
$.each(r.message.count, function(i, d) {
|
||||
me.frm.dashboard.set_badge_count(d.name, cint(d.open_count), cint(d.count));
|
||||
});
|
||||
|
|
@ -206,8 +213,8 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
},
|
||||
|
||||
// heatmap
|
||||
show_heatmap: function() {
|
||||
if(!this.heatmap) {
|
||||
render_heatmap: function() {
|
||||
if(this.show_heatmap && !this.heatmap) {
|
||||
this.heatmap = new CalHeatMap();
|
||||
this.heatmap.init({
|
||||
itemSelector: "#heatmap-" + this.frm.doctype,
|
||||
|
|
@ -228,7 +235,15 @@ frappe.ui.form.Dashboard = Class.extend({
|
|||
|
||||
// center the heatmap
|
||||
this.heatmap_area.removeClass('hidden').find('svg').css({'margin': 'auto'});
|
||||
}
|
||||
|
||||
// message
|
||||
var heatmap_message = this.heatmap_area.find('.heatmap-message');
|
||||
if(this.heatmap_message) {
|
||||
heatmap_message.removeClass('hidden').html(this.heatmap_message);
|
||||
} else {
|
||||
heatmap_message.addClass('hidden');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// stats
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ frappe.ui.to_do_dialog = function(opts){
|
|||
{fieldtype:'Check', fieldname:'myself', label:__("Assign to me"), "default":0},
|
||||
{fieldtype: 'Section Break'},
|
||||
{fieldtype: 'Link', fieldname:'assign_to', options:'User',
|
||||
label:__("Assign To"), reqd:true},
|
||||
label:__("Assign To"), reqd:true, filters: {'user_type': 'System User'}},
|
||||
{fieldtype:'Small Text', fieldname:'description', label:__("Comment"), reqd:true},
|
||||
{fieldtype: 'Section Break'},
|
||||
{fieldtype: 'Column Break'},
|
||||
|
|
|
|||
|
|
@ -22,17 +22,27 @@ frappe.ui.form.Layout = Class.extend({
|
|||
if(!this.parent && this.body)
|
||||
this.parent = this.body;
|
||||
this.wrapper = $('<div class="form-layout">').appendTo(this.parent);
|
||||
this.message = $('<div class="form-message text-muted small hidden"></div>').appendTo(this.wrapper);
|
||||
if(!this.fields)
|
||||
this.fields = frappe.meta.sort_docfields(frappe.meta.docfield_map[this.doctype]);
|
||||
this.setup_tabbing();
|
||||
this.render();
|
||||
},
|
||||
show_empty_form_message: function() {
|
||||
this.wrapper.find(".empty-form-alert").remove();
|
||||
if(!(this.wrapper.find(".frappe-control:visible").length || this.wrapper.find(".section-head.collapsed").length)) {
|
||||
$('<div class="empty-form-alert text-muted" style="padding: 15px;">'
|
||||
+__("This form does not have any input")+'</div>')
|
||||
.appendTo(this.page);
|
||||
this.show_message(__("This form does not have any input"));
|
||||
}
|
||||
},
|
||||
show_message: function(html) {
|
||||
if(html) {
|
||||
if(html.substr(0, 1)!=='<') {
|
||||
// wrap in a block
|
||||
html = '<div>' + html + '</div>';
|
||||
}
|
||||
console.log(html);
|
||||
$(html).appendTo(this.message.removeClass('hidden'));
|
||||
} else {
|
||||
this.message.empty().addClass('hidden');
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
|
|
@ -451,8 +461,8 @@ frappe.ui.form.Section = Class.extend({
|
|||
make_head: function() {
|
||||
var me = this;
|
||||
if(!this.df.collapsible) {
|
||||
$('<div class="col-sm-12"><h4 class="form-section-heading">'
|
||||
+ __(this.df.label) + '</h4></div>')
|
||||
$('<div class="col-sm-12"><h6 class="form-section-heading">'
|
||||
+ __(this.df.label) + '</h6></div>')
|
||||
.appendTo(this.wrapper);
|
||||
} else {
|
||||
this.head = $('<div class="section-head"><a class="h6">'
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
</h4>
|
||||
<div class="progress-area hidden form-dashboard-section">
|
||||
</div>
|
||||
<div class="form-heatmap hidden form-dashboard-section"
|
||||
id="heatmap-{{ frm.doctype }}"></div>
|
||||
<div class="form-heatmap hidden form-dashboard-section">
|
||||
<div id="heatmap-{{ frm.doctype }}"></div>
|
||||
<div class="text-muted small heatmap-message hidden"></div>
|
||||
</div>
|
||||
<div class="form-stats form-dashboard-section hidden"></div>
|
||||
<div class="form-links form-dashboard-section hidden">
|
||||
<div class="transactions"></div>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<div class="form-documents">
|
||||
{% for (var i=0; i < transactions.length; i++) { %}
|
||||
{% if((i % 2)===0) { %}<div class="row">{% } %}
|
||||
<div class="col-xs-6" style="padding-left: 30px;">
|
||||
<div class="col-xs-6">
|
||||
<h5 style="margin-top: 15px;">{{ transactions[i].label }}</h5>
|
||||
{% for (var j=0; j < transactions[i].items.length; j++) {
|
||||
var doctype = transactions[i].items[j]; %}
|
||||
<div class="document-link"
|
||||
data-doctype="{{ doctype }}">
|
||||
<span class="text-muted small count"></span>
|
||||
<a class="badge-link small">{{ __(doctype) }}</a>
|
||||
<span class="open-notification hidden"></span>
|
||||
<span class="text-muted small count"></span>
|
||||
<span class="open-notification hidden" title="{{ __("Open {0}", [__(doctype)])}}"></span>
|
||||
</div>
|
||||
{% } %}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -184,7 +184,13 @@ _f.Frm.prototype.set_hidden = function(status) {
|
|||
var form_page = this.page.wrapper.find('.form-page');
|
||||
form_page.toggleClass('hidden', this.hidden);
|
||||
this.toolbar.refresh();
|
||||
if(status===false) {
|
||||
if(status===true) {
|
||||
msg = __('Edit {0} properties', [__(this.doctype)]);
|
||||
this.layout.show_message('<div style="padding-left: 15px; padding-right: 15px;">\
|
||||
<a class="text-muted" onclick="cur_frm.set_hidden(false)">' + msg + '</a></div>');
|
||||
} else {
|
||||
// clear message
|
||||
this.layout.show_message();
|
||||
frappe.utils.scroll_to(form_page);
|
||||
}
|
||||
}
|
||||
|
|
@ -497,6 +503,9 @@ _f.Frm.prototype.render_form = function(is_a_different_doc) {
|
|||
// because add_custom_button
|
||||
this.refresh_header(is_a_different_doc);
|
||||
|
||||
// clear layout message
|
||||
this.layout.show_message();
|
||||
|
||||
// call trigger
|
||||
this.script_manager.trigger("refresh");
|
||||
|
||||
|
|
@ -527,7 +536,9 @@ _f.Frm.prototype.render_form = function(is_a_different_doc) {
|
|||
|
||||
$(cur_frm.wrapper).trigger('render_complete');
|
||||
|
||||
this.layout.show_empty_form_message();
|
||||
if(!this.hidden) {
|
||||
this.layout.show_empty_form_message();
|
||||
}
|
||||
|
||||
this.scroll_to_element();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,10 +248,42 @@ textarea.form-control {
|
|||
}
|
||||
|
||||
// fixes datepicker z-index issue
|
||||
|
||||
.form-control {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
// .form-page {
|
||||
// .form-group {
|
||||
// margin: 20px 0px;
|
||||
// }
|
||||
//
|
||||
// input.form-control, select.form-control {
|
||||
// position: relative;
|
||||
// box-shadow: none;
|
||||
// border: none;
|
||||
// padding: 0px;
|
||||
// border-bottom: 1px solid transparent;
|
||||
// border-radius: 0;
|
||||
// background-color: inherit;
|
||||
// font-size: 16px;
|
||||
// }
|
||||
// input.form-control:focus, select.form-control:focus {
|
||||
// box-shadow: none;
|
||||
// border-color: @text-color;
|
||||
// }
|
||||
//
|
||||
// .control-label {
|
||||
// margin-bottom: 3px;
|
||||
// }
|
||||
//
|
||||
// .frappe-control:not([data-fieldtype*="Text"]) {
|
||||
// .control-value {
|
||||
// font-size: 16px;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
.link-field.ui-front {
|
||||
z-index: inherit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
border-top: 1px solid @border-color;
|
||||
}
|
||||
|
||||
.form-message {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.form-dashboard {
|
||||
border-bottom: 1px solid @light-border-color;
|
||||
}
|
||||
|
|
@ -52,6 +56,10 @@
|
|||
|
||||
.form-heatmap {
|
||||
padding-top: 30px;
|
||||
|
||||
.heatmap-message {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-graph {
|
||||
|
|
@ -110,16 +118,14 @@
|
|||
|
||||
.form-links {
|
||||
.document-link {
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 5px;
|
||||
height: 22px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.count {
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
top: 3px;
|
||||
display: inline-block;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,12 +133,21 @@
|
|||
margin: 0px;
|
||||
padding: 15px;
|
||||
|
||||
h6, .h6 {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
|
||||
.form-section-heading {
|
||||
margin: 0px 0px 10px 0px;
|
||||
margin: 10px 0px;
|
||||
text-transform: uppercase;
|
||||
color: @text-muted;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
margin: 0px 0px 15px 15px;
|
||||
text-transform: uppercase;
|
||||
color: @text-muted;
|
||||
cursor: pointer;
|
||||
|
||||
.collapse-indicator {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ def extract_email_id(email):
|
|||
|
||||
def validate_email_add(email_str, throw=False):
|
||||
"""Validates the email string"""
|
||||
email_str = (email_str or "").strip()
|
||||
|
||||
if not email_str:
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue