Merge branch 'develop' into drop-py2-code

This commit is contained in:
Gavin D'souza 2021-05-28 10:51:39 +05:30
commit 4e7526066f
13 changed files with 103 additions and 34 deletions

View file

@ -3,6 +3,8 @@ name: UI
on:
pull_request:
workflow_dispatch:
push:
branches: [ develop ]
jobs:
test:

View file

@ -14,18 +14,21 @@
</div>
<div align="center">
<a href="https://github.com/frappe/frappe/actions/workflows/ci-tests.yml">
<img src="https://github.com/frappe/frappe/actions/workflows/ci-tests.yml/badge.svg?branch=develop">
</a>
<a href='https://frappeframework.com/docs'>
<img src='https://img.shields.io/badge/docs-📖-7575FF.svg?style=flat-square'/>
</a>
<a href="https://github.com/frappe/frappe/actions/workflows/server-mariadb-tests.yml">
<img src="https://github.com/frappe/frappe/actions/workflows/server-mariadb-tests.yml/badge.svg">
</a>
<a href="https://github.com/frappe/frappe/actions/workflows/ui-tests.yml">
<img src="https://github.com/frappe/frappe/actions/workflows/ui-tests.yml/badge.svg?branch=develop">
</a>
<a href='https://frappeframework.com/docs'>
<img src='https://img.shields.io/badge/docs-📖-7575FF.svg?style=flat-square'/>
</a>
<a href='https://www.codetriage.com/frappe/frappe'>
<img src='https://www.codetriage.com/frappe/frappe/badges/users.svg'>
</a>
<a href='https://coveralls.io/github/frappe/frappe?branch=develop'>
<img src='https://coveralls.io/repos/github/frappe/frappe/badge.svg?branch=develop'>
</a>
<a href='https://coveralls.io/github/frappe/frappe?branch=develop'>
<img src='https://coveralls.io/repos/github/frappe/frappe/badge.svg?branch=develop'>
</a>
</div>

View file

@ -343,12 +343,7 @@ async function write_assets_json(metafile) {
}
}
let assets_json_path = path.resolve(
assets_path,
"frappe",
"dist",
"assets.json"
);
let assets_json_path = path.resolve(assets_path, "assets.json");
let assets_json;
try {
assets_json = await fs.promises.readFile(assets_json_path, "utf-8");

View file

@ -50,7 +50,7 @@ def build_missing_files():
development = frappe.local.conf.developer_mode or frappe.local.dev_server
build_mode = "development" if development else "production"
assets_json = frappe.read_file(frappe.get_app_path('frappe', 'public', 'dist', 'assets.json'))
assets_json = frappe.read_file("assets/assets.json")
if assets_json:
assets_json = frappe.parse_json(assets_json)

View file

@ -4,6 +4,7 @@
frappe.ui.form.on('Document Naming Rule', {
refresh: function(frm) {
frm.trigger('document_type');
if (!frm.doc.__islocal) frm.trigger("add_update_counter_button");
},
document_type: (frm) => {
// update the select field options with fieldnames
@ -20,5 +21,44 @@ frappe.ui.form.on('Document Naming Rule', {
);
});
}
},
add_update_counter_button: (frm) => {
frm.add_custom_button(__('Update Counter'), function() {
const fields = [{
fieldtype: 'Data',
fieldname: 'new_counter',
label: __('New Counter'),
default: frm.doc.counter,
reqd: 1,
description: __('Warning: Updating counter may lead to document name conflicts if not done properly')
}];
let primary_action_label = __('Save');
let primary_action = (fields) => {
frappe.call({
method: 'frappe.core.doctype.document_naming_rule.document_naming_rule.update_current',
args: {
name: frm.doc.name,
new_counter: fields.new_counter
},
callback: function() {
frm.set_value("counter", fields.new_counter);
dialog.hide();
}
});
};
const dialog = new frappe.ui.Dialog({
title: __('Update Counter Value for Prefix: {0}', [frm.doc.prefix]),
fields,
primary_action_label,
primary_action
});
dialog.show();
});
}
});

View file

@ -29,3 +29,8 @@ class DocumentNamingRule(Document):
counter = frappe.db.get_value(self.doctype, self.name, 'counter', for_update=True) or 0
doc.name = self.prefix + ('%0'+str(self.prefix_digits)+'d') % (counter + 1)
frappe.db.set_value(self.doctype, self.name, 'counter', counter + 1)
@frappe.whitelist()
def update_current(name, new_counter):
frappe.only_for('System Manager')
frappe.db.set_value('Document Naming Rule', name, 'counter', new_counter)

View file

@ -200,10 +200,11 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
if(frappe.model.can_create(doctype)) {
// new item
r.results.push({
label: "<span class='text-primary link-option'>"
html: "<span class='text-primary link-option'>"
+ "<i class='fa fa-plus' style='margin-right: 5px;'></i> "
+ __("Create a new {0}", [__(me.get_options())])
+ "</span>",
label: __("Create a new {0}", [__(me.get_options())]),
value: "create_new__link_option",
action: me.new_doc
});
@ -213,10 +214,11 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
if (locals && locals['DocType']) {
// not applicable in web forms
r.results.push({
label: "<span class='text-primary link-option'>"
html: "<span class='text-primary link-option'>"
+ "<i class='fa fa-search' style='margin-right: 5px;'></i> "
+ __("Advanced Search")
+ "</span>",
label: __("Advanced Search"),
value: "advanced_search__link_option",
action: me.open_advanced_search
});

View file

@ -724,9 +724,14 @@ frappe.views.CommunicationComposer = class {
}
message += await this.get_signature();
if (this.real_name && !message.includes("<!-- salutation-ends -->")) {
message = `<p>${__('Dear')} ${this.real_name},</p>
<!-- salutation-ends --><br>${message}`;
const SALUTATION_END_COMMENT = "<!-- salutation-ends -->";
if (this.real_name && !message.includes(SALUTATION_END_COMMENT)) {
this.message = `
<p>${__('Dear')} ${this.real_name},</p>
${SALUTATION_END_COMMENT}<br>
${message}
`;
}
if (this.is_a_reply) {

View file

@ -48,13 +48,13 @@
$active-border: darken($primary-light, 12.5%)
);
color: var(--blue-500);
color: var(--primary);
&:hover, &:active {
color: var(--blue-500);
color: var(--primary);
}
&:focus {
box-shadow: 0 0 0 0.2rem var(--blue-50)
box-shadow: 0 0 0 0.2rem var(--primary-light);
}
}
@ -77,11 +77,11 @@
}
.btn.btn-primary {
background-color: var(--primary-color);
background-color: var(--primary);
color: var(--white);
white-space: nowrap;
--icon-stroke: currentColor;
--icon-fill-bg: var(--primary-color);
--icon-fill-bg: var(--primary);
}
.btn.btn-danger {

View file

@ -28,4 +28,6 @@
--font-size-4xl: #{$font-size-4xl};
--font-size-5xl: #{$font-size-5xl};
--font-size-6xl: #{$font-size-6xl};
--card-border-radius: #{$card-border-radius};
}

View file

@ -10,7 +10,7 @@
margin-top: 0.25rem;
border-radius: 0.375rem;
font-size: $font-size-sm;
color: $gray-600;
color: var(--text-color);
text-decoration: none;
font-weight: 500;
@include transition();
@ -26,8 +26,8 @@
}
.sidebar-item a.active {
color: $primary;
background-color: $primary-light;
color: var(--primary);
background-color: var(--primary-light);
}
.sidebar-item-icon {

View file

@ -788,7 +788,7 @@ def get_assets_json():
assets_json = None
if not assets_json:
assets_json = frappe.read_file("assets/frappe/dist/assets.json")
assets_json = frappe.read_file("assets/assets.json")
cache.set_value("assets_json", assets_json, shared=True)
frappe.local.assets_json = frappe.safe_decode(assets_json)

View file

@ -1,13 +1,13 @@
{% if google_font %}
@import url("https://fonts.googleapis.com/css2?family={{ google_font.replace(' ', '+') }}:{{ font_properties }}&display=swap");
$font-family-sans-serif: "{{ google_font }}", -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
{% endif -%}
{% if primary_color %}$primary: {{ frappe.db.get_value('Color', primary_color, 'color') }};{% endif -%}
{% if dark_color %}$dark: {{ frappe.db.get_value('Color', dark_color, 'color') }};{% endif -%}
{% if text_color %}$body-color: {{ frappe.db.get_value('Color', text_color, 'color') }};{% endif -%}
{% if text_color %}$body-text-color: {{ frappe.db.get_value('Color', text_color, 'color') }};{% endif -%}
{% if background_color %}$body-bg: {{ frappe.db.get_value('Color', background_color, 'color') }};{% endif -%}
$enable-shadows: {{ button_shadows and "true" or "false" }};
@ -24,9 +24,24 @@ $enable-rounded: {{ button_rounded_corners and "true" or "false" }};
{% if font_size -%}
body {
font-size: {{ font_size }};
font-size: {{ font_size }};
}
{%- endif %}
// Custom Theme
{{ custom_scss or '' }}
:root {
{% if primary_color %}
--primary: #{$primary};
--primary-color: #{$primary};
{% endif -%}
{% if background_color %}
--bg-color: #{$body-bg};
{% endif -%}
{% if text_color %}
--text-color: #{$body-text-color};
--text-light: #{$body-text-color};
{% endif -%}
}