[fixes] mandatory css in grids, better welcome email
This commit is contained in:
parent
1652460f2a
commit
614098a84a
16 changed files with 85 additions and 27 deletions
|
|
@ -264,8 +264,14 @@ class User(Document):
|
|||
|
||||
link = self.reset_password()
|
||||
|
||||
self.send_login_mail(_("Verify Your Account"), "templates/emails/new_user.html",
|
||||
{"link": link, "site_url": get_url()})
|
||||
app_title = [t for t in frappe.get_hooks('app_title') if t != 'Frappe Framework']
|
||||
subject = _("Welcome to {0}").format(app_title[0])
|
||||
|
||||
self.send_login_mail(subject, "templates/emails/new_user.html",
|
||||
dict(
|
||||
link=link,
|
||||
site_url=get_url(),
|
||||
))
|
||||
|
||||
|
||||
def send_login_mail(self, subject, template, add_args, now=None):
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ def get_std_fields_list(meta, key):
|
|||
def build_for_autosuggest(res):
|
||||
results = []
|
||||
for r in res:
|
||||
out = {"value": r[0], "description": ", ".join(unique(cstr(d) for d in r)[1:])}
|
||||
out = {"value": r[0], "description": ", ".join(unique(cstr(d) for d in r if d)[1:])}
|
||||
results.append(out)
|
||||
return results
|
||||
|
||||
|
|
|
|||
|
|
@ -111,9 +111,6 @@ a.badge-hover:focus .badge,
|
|||
a.badge-hover:active .badge {
|
||||
background-color: #D8DFE5;
|
||||
}
|
||||
.msgprint {
|
||||
margin: 15px 0px;
|
||||
}
|
||||
.msgprint pre {
|
||||
text-align: left;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,6 @@ a.badge-hover:focus .badge,
|
|||
a.badge-hover:active .badge {
|
||||
background-color: #D8DFE5;
|
||||
}
|
||||
.msgprint {
|
||||
margin: 15px 0px;
|
||||
}
|
||||
.msgprint pre {
|
||||
text-align: left;
|
||||
}
|
||||
|
|
@ -499,6 +496,7 @@ fieldset[disabled] .form-control {
|
|||
color: #fff;
|
||||
border-radius: 10px;
|
||||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
}
|
||||
/* on small screens, show only icons on top */
|
||||
@media (max-width: 767px) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
border: 1px solid #d1d8dd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.form-grid.error {
|
||||
border-color: #ff5858;
|
||||
}
|
||||
.grid-heading-row {
|
||||
border-bottom: 1px solid #d1d8dd;
|
||||
background-color: #F7FAFC;
|
||||
|
|
@ -52,7 +55,13 @@
|
|||
padding: 10px 15px;
|
||||
max-height: 200px;
|
||||
border-right: 1px solid #d1d8dd;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.grid-static-col.bold {
|
||||
font-weight: bold;
|
||||
background-color: #fffdf4;
|
||||
}
|
||||
.validated-form .grid-static-col.error {
|
||||
background-color: #FFDCDC;
|
||||
}
|
||||
.grid-static-col input[type="checkbox"] {
|
||||
margin-left: -16px !important;
|
||||
|
|
|
|||
|
|
@ -111,9 +111,6 @@ a.badge-hover:focus .badge,
|
|||
a.badge-hover:active .badge {
|
||||
background-color: #D8DFE5;
|
||||
}
|
||||
.msgprint {
|
||||
margin: 15px 0px;
|
||||
}
|
||||
.msgprint pre {
|
||||
text-align: left;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -391,10 +391,10 @@ frappe.ui.form.ControlInput = frappe.ui.form.Control.extend({
|
|||
},
|
||||
set_bold: function() {
|
||||
if(this.$input) {
|
||||
this.$input.toggleClass("bold", !!this.df.bold);
|
||||
this.$input.toggleClass("bold", !!(this.df.bold || this.df.reqd));
|
||||
}
|
||||
if(this.disp_area) {
|
||||
$(this.disp_area).toggleClass("bold", !!this.df.bold);
|
||||
$(this.disp_area).toggleClass("bold", !!(this.df.bold || this.df.reqd));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ frappe.ui.form.Grid = Class.extend({
|
|||
.appendTo(this.parent)
|
||||
.attr("data-fieldname", this.df.fieldname);
|
||||
|
||||
this.form_grid = this.wrapper.find('.form-grid');
|
||||
|
||||
this.wrapper.find(".grid-add-row").click(function() {
|
||||
me.add_new_row(null, null, true);
|
||||
me.set_focus_on_row();
|
||||
|
|
@ -178,6 +180,9 @@ frappe.ui.form.Grid = Class.extend({
|
|||
frappe.utils.scroll_to(_scroll_y);
|
||||
}
|
||||
|
||||
// red if mandatory
|
||||
this.form_grid.toggleClass('error', !!(this.df.reqd && !(data && data.length)));
|
||||
|
||||
this.refresh_remove_rows_button();
|
||||
},
|
||||
setup_toolbar: function() {
|
||||
|
|
@ -783,6 +788,15 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
this.refresh_field(df.fieldname, txt);
|
||||
}
|
||||
|
||||
// background color for cellz
|
||||
if(this.doc) {
|
||||
if(df.reqd && !txt) {
|
||||
column.addClass('error');
|
||||
}
|
||||
if (df.reqd || df.bold) {
|
||||
column.addClass('bold');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
|
@ -1028,8 +1042,9 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
}
|
||||
},
|
||||
refresh_field: function(fieldname, txt) {
|
||||
var df = this.grid.get_docfield(fieldname);
|
||||
if(txt===undefined) {
|
||||
var txt = frappe.format(this.doc[fieldname], this.grid.get_docfield(fieldname),
|
||||
var txt = frappe.format(this.doc[fieldname], df,
|
||||
null, this.frm.doc);
|
||||
}
|
||||
|
||||
|
|
@ -1037,6 +1052,9 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
var column = this.columns[fieldname];
|
||||
if(column) {
|
||||
column.static_area.html(txt || "");
|
||||
if(df.reqd) {
|
||||
column.toggleClass('error', !!(txt===null || txt===''));
|
||||
}
|
||||
}
|
||||
|
||||
// reset field value
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ frappe.ui.form.save = function(frm, action, callback, btn) {
|
|||
|
||||
var save = function() {
|
||||
check_name(function() {
|
||||
$(frm.wrapper).addClass('validated-form');
|
||||
if(check_mandatory()) {
|
||||
_call({
|
||||
method: "frappe.desk.form.save.savedocs",
|
||||
|
|
@ -132,10 +133,21 @@ frappe.ui.form.save = function(frm, action, callback, btn) {
|
|||
|
||||
}
|
||||
});
|
||||
if(error_fields.length)
|
||||
msgprint(__('Mandatory fields required in {0}', [(doc.parenttype
|
||||
? (__(frappe.meta.docfield_map[doc.parenttype][doc.parentfield].label) + ' ('+ __("Table") + ')')
|
||||
: __(doc.doctype))]) + '<br> <ul><li>' + error_fields.join('</li><li>') + "</ul>");
|
||||
if(error_fields.length) {
|
||||
if(doc.parenttype) {
|
||||
var message = __('Mandatory fields required in table {0}, Row {1}',
|
||||
[__(frappe.meta.docfield_map[doc.parenttype][doc.parentfield].label).bold(), doc.idx]);
|
||||
} else {
|
||||
var message = __('Mandatory fields required in {0}', [__(doc.doctype)]);
|
||||
|
||||
}
|
||||
message = message + '<br><br><ul><li>' + error_fields.join('</li><li>') + "</ul>";
|
||||
msgprint({
|
||||
message: message,
|
||||
indicator: 'red',
|
||||
title: __('Missing Fields')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return !has_errors;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@
|
|||
<span class="open-notification hidden"
|
||||
title="{{ __("Open {0}", [__(doctype)])}}"></span>
|
||||
{% if !internal_links[doctype] %}
|
||||
<button class="btn btn-new btn-default btn-xs pull-right hidden"
|
||||
data-doctype="{{ doctype }}">{{ __("New") }}</button>
|
||||
<button class="btn btn-new btn-default btn-xs hidden"
|
||||
data-doctype="{{ doctype }}">
|
||||
<i class="octicon octicon-plus" style="font-size: 12px;"></i></button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% } %}
|
||||
|
|
|
|||
|
|
@ -455,6 +455,7 @@ _f.Frm.prototype.refresh = function(docname) {
|
|||
}
|
||||
|
||||
if(is_a_different_doc) {
|
||||
$(this.wrapper).removeClass('validated-form')
|
||||
if(this.show_print_first && this.doc.docstatus===1) {
|
||||
// show print view
|
||||
this.print_doc();
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ a.badge-hover& {
|
|||
}
|
||||
|
||||
.msgprint {
|
||||
margin: 15px 0px;
|
||||
// margin: 15px 0px;
|
||||
// text-align: center;
|
||||
|
||||
pre {
|
||||
|
|
|
|||
|
|
@ -327,6 +327,7 @@ textarea.form-control {
|
|||
color:#fff;
|
||||
border-radius:10px;
|
||||
cursor: pointer;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* on small screens, show only icons on top */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.form-grid.error {
|
||||
border-color: @indicator-red;
|
||||
}
|
||||
|
||||
.grid-heading-row {
|
||||
border-bottom: 1px solid @border-color;
|
||||
background-color: @panel-bg;
|
||||
|
|
@ -64,7 +68,15 @@
|
|||
padding: 10px 15px;
|
||||
max-height: 200px;
|
||||
border-right: 1px solid @border-color;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
.grid-static-col.bold {
|
||||
font-weight: bold;
|
||||
background-color: @extra-light-yellow;
|
||||
}
|
||||
|
||||
.validated-form .grid-static-col.error {
|
||||
background-color: @label-danger-bg;
|
||||
}
|
||||
|
||||
.grid-static-col {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
<h3>{{ title }}</h3>
|
||||
{% if title %}<h3>{{ title }}</h3>{% endif %}
|
||||
<p>{{_("Dear")}} {{ first_name }}{% if last_name %} {{ last_name}}{% endif %},</p>
|
||||
<p>{{_("A new account has been created for you at {0}").format(site_url)}}.</p>
|
||||
<p>{{_("Your login id is")}}: <b>{{ user }}</b>
|
||||
<p>{{_("Click on the link below to complete your registration and set a new password")}}.</p>
|
||||
<p><b><a href="{{ link }}">{{_("Complete Registration")}}</a></b></p>
|
||||
|
||||
<p style="margin: 30px 0px;">
|
||||
<a href="{{ link }}" rel="nofollow" style="padding: 8px 20px; background-color: #7575ff; color: #fff; border-radius: 4px; text-decoration: none; line-height: 1; border-bottom: 3px solid rgba(0, 0, 0, 0.2); font-size: 14px; font-weight: 200;">{{ _("Complete Registration") }}</a>
|
||||
</p>
|
||||
|
||||
{% if user_fullname != "Administrator" %}
|
||||
<br>
|
||||
<p>{{_("Thank you")}},<br>
|
||||
{{ user_fullname }}</p>
|
||||
|
||||
{% endif %}
|
||||
<br>
|
||||
<p style="font-size: 85%;">{{_("You can also copy-paste this link in your browser")}} <a href="{{ link }}">{{ link }}</a></p>
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ def add_system_manager(email, first_name=None, last_name=None, send_welcome_emai
|
|||
"user_type": "System User",
|
||||
"send_welcome_email": 1 if send_welcome_email else 0
|
||||
})
|
||||
|
||||
user.insert()
|
||||
|
||||
# add roles
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue