Merge branch 'develop' into perms-in-unrelated-doc
This commit is contained in:
commit
7cc64489e3
26 changed files with 127 additions and 89 deletions
6
.github/helper/install.sh
vendored
6
.github/helper/install.sh
vendored
|
|
@ -1,10 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd ~ || exit
|
||||
set -e
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source ./.nvm/nvm.sh
|
||||
nvm install 12
|
||||
cd ~ || exit
|
||||
|
||||
pip install frappe-bench
|
||||
|
||||
|
|
|
|||
10
.github/helper/install_dependencies.sh
vendored
10
.github/helper/install_dependencies.sh
vendored
|
|
@ -1,9 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
|
||||
if [[ $? != 2 ]];then
|
||||
exit;
|
||||
fi
|
||||
set -e
|
||||
|
||||
# python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
|
||||
# if [[ $? != 2 ]];then
|
||||
# exit;
|
||||
# fi
|
||||
|
||||
# install wkhtmltopdf
|
||||
wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
|
||||
|
|
|
|||
6
.github/helper/roulette.py
vendored
6
.github/helper/roulette.py
vendored
|
|
@ -24,10 +24,12 @@ def is_docs(file):
|
|||
|
||||
if __name__ == "__main__":
|
||||
build_type = os.environ.get("TYPE")
|
||||
commit_range = os.environ.get("TRAVIS_COMMIT_RANGE")
|
||||
before = os.environ.get("BEFORE")
|
||||
after = os.environ.get("AFTER")
|
||||
commit_range = before + '...' + after
|
||||
print("Build Type: {}".format(build_type))
|
||||
print("Commit Range: {}".format(commit_range))
|
||||
|
||||
|
||||
try:
|
||||
files_changed = get_output("git diff --name-only {}".format(commit_range), shell=False)
|
||||
except Exception:
|
||||
|
|
|
|||
20
.github/helper/run_tests.sh
vendored
20
.github/helper/run_tests.sh
vendored
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd ~/frappe-bench/ || exit
|
||||
|
||||
if [ "$TYPE" == "server" ]; then
|
||||
|
||||
if [ "$DB" == "mariadb" ]; then
|
||||
bench --verbose --site test_site run-tests --coverage
|
||||
fi
|
||||
|
||||
if [ "$DB" == "postgres" ]; then
|
||||
bench --verbose --site test_site run-tests --coverage
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "$TYPE" == "ui" ]; then
|
||||
bench --site test_site execute frappe.utils.install.complete_setup_wizard
|
||||
bench --site test_site run-ui-tests frappe --headless
|
||||
fi
|
||||
23
.github/workflows/ci-tests.yml
vendored
23
.github/workflows/ci-tests.yml
vendored
|
|
@ -15,12 +15,17 @@ jobs:
|
|||
- DB: "mariadb"
|
||||
TYPE: "server"
|
||||
JOB_NAME: "Python MariaDB"
|
||||
RUN_COMMAND: bench --verbose --site test_site run-tests --coverage
|
||||
|
||||
- DB: "postgres"
|
||||
TYPE: "server"
|
||||
JOB_NAME: "Python PostgreSQL"
|
||||
RUN_COMMAND: bench --verbose --site test_site run-tests --coverage
|
||||
|
||||
- DB: "mariadb"
|
||||
TYPE: "ui"
|
||||
JOB_NAME: "UI MariaDB"
|
||||
RUN_COMMAND: bench --site test_site run-ui-tests frappe --headless
|
||||
|
||||
name: ${{ matrix.JOB_NAME }}
|
||||
|
||||
|
|
@ -54,6 +59,11 @@ jobs:
|
|||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
|
||||
- name: Add to Hosts
|
||||
run: |
|
||||
echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
|
||||
|
|
@ -103,6 +113,10 @@ jobs:
|
|||
|
||||
- name: Install Dependencies
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
|
||||
env:
|
||||
BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
|
||||
AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
|
||||
TYPE: ${{ matrix.TYPE }}
|
||||
|
||||
- name: Install
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
||||
|
|
@ -110,8 +124,15 @@ jobs:
|
|||
DB: ${{ matrix.DB }}
|
||||
TYPE: ${{ matrix.TYPE }}
|
||||
|
||||
- name: Run Set-Up
|
||||
if: matrix.TYPE == 'ui'
|
||||
run: cd ~/frappe-bench/ && bench --site test_site execute frappe.utils.install.complete_setup_wizard
|
||||
env:
|
||||
DB: ${{ matrix.DB }}
|
||||
TYPE: ${{ matrix.TYPE }}
|
||||
|
||||
- name: Run Tests
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/run_tests.sh
|
||||
run: cd ~/frappe-bench/ && ${{ matrix.RUN_COMMAND }}
|
||||
env:
|
||||
DB: ${{ matrix.DB }}
|
||||
TYPE: ${{ matrix.TYPE }}
|
||||
|
|
|
|||
|
|
@ -483,7 +483,6 @@ def console(context):
|
|||
@click.option('--doctype', help="For DocType")
|
||||
@click.option('--doctype-list-path', help="Path to .txt file for list of doctypes. Example erpnext/tests/server/agriculture.txt")
|
||||
@click.option('--test', multiple=True, help="Specific test")
|
||||
@click.option('--driver', help="For Travis")
|
||||
@click.option('--ui-tests', is_flag=True, default=False, help="Run UI Tests")
|
||||
@click.option('--module', help="Run tests in a module")
|
||||
@click.option('--profile', is_flag=True, default=False)
|
||||
|
|
@ -493,9 +492,9 @@ def console(context):
|
|||
@click.option('--junit-xml-output', help="Destination file path for junit xml report")
|
||||
@click.option('--failfast', is_flag=True, default=False)
|
||||
@pass_context
|
||||
def run_tests(context, app=None, module=None, doctype=None, test=(),
|
||||
driver=None, profile=False, coverage=False, junit_xml_output=False, ui_tests = False,
|
||||
doctype_list_path=None, skip_test_records=False, skip_before_tests=False, failfast=False):
|
||||
def run_tests(context, app=None, module=None, doctype=None, test=(), profile=False,
|
||||
coverage=False, junit_xml_output=False, ui_tests = False, doctype_list_path=None,
|
||||
skip_test_records=False, skip_before_tests=False, failfast=False):
|
||||
|
||||
"Run tests"
|
||||
import frappe.test_runner
|
||||
|
|
@ -535,8 +534,8 @@ def run_tests(context, app=None, module=None, doctype=None, test=(),
|
|||
cov.start()
|
||||
|
||||
ret = frappe.test_runner.main(app, module, doctype, context.verbose, tests=tests,
|
||||
force=context.force, profile=profile, junit_xml_output=junit_xml_output,
|
||||
ui_tests=ui_tests, doctype_list_path=doctype_list_path, failfast=failfast)
|
||||
force=context.force, profile=profile, junit_xml_output=junit_xml_output,
|
||||
ui_tests=ui_tests, doctype_list_path=doctype_list_path, failfast=failfast)
|
||||
|
||||
if coverage:
|
||||
cov.stop()
|
||||
|
|
|
|||
|
|
@ -856,6 +856,11 @@ class BaseDocument(object):
|
|||
from frappe.model.meta import get_default_df
|
||||
df = get_default_df(fieldname)
|
||||
|
||||
if not currency:
|
||||
currency = self.get(df.get("options"))
|
||||
if not frappe.db.exists('Currency', currency, cache=True):
|
||||
currency = None
|
||||
|
||||
val = self.get(fieldname)
|
||||
|
||||
if translated:
|
||||
|
|
|
|||
|
|
@ -173,6 +173,9 @@ frappe.Application = Class.extend({
|
|||
frappe.router.route();
|
||||
}
|
||||
frappe.after_ajax(() => frappe.flags.setting_original_route = false);
|
||||
frappe.router.on('change', () => {
|
||||
$(".tooltip").hide();
|
||||
});
|
||||
},
|
||||
|
||||
setup_frappe_vue() {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ frappe.ui.form.ControlSelect = frappe.ui.form.ControlData.extend({
|
|||
}
|
||||
},
|
||||
toggle_placeholder: function() {
|
||||
const input_set = Boolean(this.$input.val());
|
||||
const input_set = Boolean(this.$input.find('option:selected').text());
|
||||
this.$wrapper.find('.placeholder').toggle(!input_set);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ frappe.show_alert = function(message, seconds=7, actions={}) {
|
|||
'yellow': "solid-warning",
|
||||
'blue': "solid-success",
|
||||
'green': "solid-success",
|
||||
'red': "solid-red"
|
||||
'red': "solid-error"
|
||||
};
|
||||
|
||||
if (typeof message==='string') {
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ frappe.ui.Page = Class.extend({
|
|||
},
|
||||
|
||||
get_inner_group_button: function(label) {
|
||||
return this.inner_toolbar.find(`.inner-group-button[data-label="${encodeURIComponent(label)}"`);
|
||||
return this.inner_toolbar.find(`.inner-group-button[data-label="${encodeURIComponent(label)}"]`);
|
||||
},
|
||||
|
||||
set_inner_btn_group_as_primary: function(label) {
|
||||
|
|
|
|||
|
|
@ -88,15 +88,15 @@ export default class WebForm extends frappe.ui.FieldGroup {
|
|||
|
||||
setup_delete_button() {
|
||||
this.add_button_to_header(
|
||||
'<i class="fa fa-trash" aria-hidden="true"></i>',
|
||||
"light",
|
||||
frappe.utils.icon('delete'),
|
||||
"danger",
|
||||
() => this.delete()
|
||||
);
|
||||
}
|
||||
|
||||
setup_print_button() {
|
||||
this.add_button_to_header(
|
||||
'<i class="fa fa-print" aria-hidden="true"></i>',
|
||||
frappe.utils.icon('print'),
|
||||
"light",
|
||||
() => this.print()
|
||||
);
|
||||
|
|
|
|||
29
frappe/public/scss/common/form.scss
Normal file
29
frappe/public/scss/common/form.scss
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
.form-control {
|
||||
border: none;
|
||||
font-size: var(--text-md);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.form-control.bold {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.like-disabled-input {
|
||||
.for-description {
|
||||
font-weight: normal;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
min-height: var(--input-height);
|
||||
border-radius: $border-radius;
|
||||
font-weight: 400;
|
||||
padding: 8px 12px;
|
||||
cursor: default;
|
||||
color: var(--disabled-text-color);
|
||||
background-color: var(--disabled-control-bg);
|
||||
}
|
||||
|
||||
.head-title {
|
||||
font-size: var(--text-lg);
|
||||
font-weight: 700;
|
||||
color: var(--heading-color);
|
||||
}
|
||||
|
|
@ -1,8 +1,4 @@
|
|||
.form-control {
|
||||
border: none;
|
||||
font-size: var(--text-md);
|
||||
position: relative;
|
||||
}
|
||||
@import "../common/form.scss";
|
||||
|
||||
.form-section, .form-dashboard-section {
|
||||
margin: 0px;
|
||||
|
|
@ -82,24 +78,6 @@
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
.form-control.bold {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.like-disabled-input {
|
||||
.for-description {
|
||||
font-weight: normal;
|
||||
font-size: var(--text-sm);
|
||||
}
|
||||
min-height: var(--input-height);
|
||||
border-radius: $border-radius;
|
||||
font-weight: 400;
|
||||
padding: 8px 12px;
|
||||
cursor: default;
|
||||
color: var(--disabled-text-color);
|
||||
background-color: var(--disabled-control-bg);
|
||||
}
|
||||
|
||||
.form-control:disabled, .form-control[readonly] {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,5 +43,5 @@
|
|||
@import "user_profile";
|
||||
@import "theme_switcher";
|
||||
@import "link_preview";
|
||||
@import "quill";
|
||||
@import "../common/quill";
|
||||
@import "plyr";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// @import "~bootstrap/scss/bootstrap";
|
||||
@import './desk/quill';
|
||||
@import './common/quill';
|
||||
@import "./desk/css_variables";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
@import '~quill/dist/quill.core';
|
||||
@import '~quill/dist/quill.snow.css';
|
||||
@import '~quill/dist/quill.bubble.css';
|
||||
@import '../common/quill';
|
||||
@import 'variables';
|
||||
@import '~bootstrap/scss/bootstrap';
|
||||
@import "../common/mixins";
|
||||
|
|
@ -15,6 +13,7 @@
|
|||
@import 'multilevel_dropdown';
|
||||
@import 'website_image';
|
||||
@import 'website_avatar';
|
||||
@import 'web_form';
|
||||
@import 'page_builder';
|
||||
@import 'blog';
|
||||
@import 'markdown';
|
||||
|
|
|
|||
17
frappe/public/scss/website/web_form.scss
Normal file
17
frappe/public/scss/website/web_form.scss
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@import "../common/form";
|
||||
|
||||
.web-form-wrapper {
|
||||
.form-control {
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.form-column {
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
{{ item }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="more-block {% if not show_more -%} hidden {%- endif %}">
|
||||
<div class="more-block mt-6 {% if not show_more -%} hidden {%- endif %}">
|
||||
<button class="btn btn-light btn-more btn-sm">{{ _("More") }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ data-web-form="{{ name }}" data-web-form-doctype="{{ doc_type }}" data-login-req
|
|||
{% endif %} {# attachments #}
|
||||
|
||||
{% if allow_comments and not frappe.form_dict.new and not is_list -%}
|
||||
<div class="comments">
|
||||
<div class="comments mt-6">
|
||||
<h3>{{ _("Comments") }}</h3>
|
||||
{% include 'templates/includes/comments/comments.html' %}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ from frappe import _
|
|||
import frappe.sessions
|
||||
|
||||
def get_context(context):
|
||||
# if frappe.session.user == "Guest":
|
||||
# frappe.throw(_("Log in to access this page."), frappe.PermissionError)
|
||||
# elif frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User":
|
||||
# frappe.throw(_("You are not permitted to access this page."), frappe.PermissionError)
|
||||
if frappe.session.user == "Guest":
|
||||
frappe.throw(_("Log in to access this page."), frappe.PermissionError)
|
||||
elif frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User":
|
||||
frappe.throw(_("You are not permitted to access this page."), frappe.PermissionError)
|
||||
|
||||
hooks = frappe.get_hooks()
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -85,7 +85,10 @@
|
|||
<div class="login-button-wrapper">
|
||||
<a href="{{ provider.auth_url }}"
|
||||
class="btn btn-block btn-default btn-sm btn-login-option btn-{{ provider.name }}">
|
||||
{{ provider.icon }} {{ _("Login With") }} {{ provider.provider_name }}</a>
|
||||
{% if provider.icon %}
|
||||
{{ provider.icon }}
|
||||
{% endif %}
|
||||
{{ _("Login With {0}").format(provider.provider_name) }}</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<p class="text-muted login-divider">{{ _("or") }}</p>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ def get_context(context):
|
|||
redirect_to = get_home_page()
|
||||
else:
|
||||
redirect_to = "/app"
|
||||
|
||||
|
||||
if redirect_to != 'login':
|
||||
frappe.local.flags.redirect_location = redirect_to
|
||||
raise frappe.Redirect
|
||||
|
|
@ -44,11 +44,13 @@ def get_context(context):
|
|||
client_secret = get_decrypted_password("Social Login Key", provider, "client_secret")
|
||||
provider_name = frappe.get_value("Social Login Key", provider, "provider_name")
|
||||
|
||||
if provider_name != "Custom":
|
||||
icon_url = frappe.get_value("Social Login Key", provider, "icon")
|
||||
icon = "<img src='{0}' alt={1}>".format(icon_url, provider_name)
|
||||
else:
|
||||
icon = get_icon_html(frappe.get_value("Social Login Key", provider, "icon"), small=True)
|
||||
icon = None
|
||||
icon_url = frappe.get_value("Social Login Key", provider, "icon")
|
||||
if icon_url:
|
||||
if provider_name != "Custom":
|
||||
icon = "<img src='{0}' alt={1}>".format(icon_url, provider_name)
|
||||
else:
|
||||
icon = get_icon_html(icon_url, small=True)
|
||||
|
||||
if (get_oauth_keys(provider) and client_secret and client_id and base_url):
|
||||
context.provider_logins.append({
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
"driver.js": "^0.9.8",
|
||||
"express": "^4.17.1",
|
||||
"fast-deep-equal": "^2.0.1",
|
||||
"frappe-charts": "^2.0.0-rc5",
|
||||
"frappe-charts": "^2.0.0-rc10",
|
||||
"frappe-datatable": "^1.15.3",
|
||||
"frappe-gantt": "^0.5.0",
|
||||
"fuse.js": "^3.4.6",
|
||||
|
|
|
|||
|
|
@ -2467,10 +2467,10 @@ fragment-cache@^0.2.1:
|
|||
dependencies:
|
||||
map-cache "^0.2.2"
|
||||
|
||||
frappe-charts@^2.0.0-rc5:
|
||||
version "2.0.0-rc5"
|
||||
resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc5.tgz#16f5c744c3cdb134a41bb4581ea3c816e6b8601f"
|
||||
integrity sha512-4wEsSeGVlEBxr3qA2FF/CTrn+XRjf73txdID+vEBhr22Osc+wcJNhY5sJWFtq4wrihz3WHFnNOTGu+uUNdb0lw==
|
||||
frappe-charts@^2.0.0-rc10:
|
||||
version "2.0.0-rc10"
|
||||
resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc10.tgz#6e4cfbb99eb48374f78c0c048e1b04f278a3848a"
|
||||
integrity sha512-qj1yFdBF7e0aW6xES/SK7cb4plimcm63ENG/0HOMKprijNj0V938/v9uhe1lSATvuqu65pPkHNbt93zfCLx9gQ==
|
||||
|
||||
frappe-datatable@^1.15.3:
|
||||
version "1.15.3"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue